Locked History Actions

Diff for "InfolabClusterComputeHowtoSingle"

Differences between revisions 3 and 4
Revision 3 as of 2012-10-16 23:02:23
Size: 1069
Editor: akrevl
Comment:
Revision 4 as of 2012-10-17 00:05:39
Size: 1752
Editor: akrevl
Comment:
Deletions are marked like this. Additions are marked like this.
Line 27: Line 27:

It's a good idea to check if the program will run on the target platform. It doesn't make much difference for a Python script, but if you were running a C binary it's worth checking if it runs on the AMD platform. This is where '''ild1''' comes in. The development node '''ild1''' is set up in the same way as the cluster nodes are. So let's test the script on ild1:

{{{
/usr/bin/python2.7 /afs/cs.stanford.edu/u/akrevl/tutorial/SingleCore/SingleCore.py
}}}

Note that we are using a full path both to the python executable and to the Python script. The result is as expected:

{{{
Started: 2012-10-16 17:04:44 Finished: 2012-10-16 17:04:54 Host: ild1 User: akrevl
}}}

This HOWTO describes how to run a single core job on the Infolab Compute Cluster.

1. The program

We are going to use just a simple Python script as our main program for this HOWTO. You can download the script here SingleCore.py.

   1 #!/usr/bin/python2.7
   2 
   3 import socket, datetime, time, getpass
   4 
   5 start = datetime.datetime.now()
   6 hostname = socket.gethostname().split('.')[0]
   7 username = getpass.getuser()
   8 time.sleep(10)
   9 end = datetime.datetime.now()
  10 
  11 dfmt = "%Y-%m-%d %H:%M:%S"
  12 print "Started: %s Finished: %s Host: %s User: %s" % (start.strftime(dfmt), end.strftime(dfmt), hostname, username)

The script starts, records the current time, figures out the hostname it is running on and the username it is running as. Then it sleeps for 10 seconds (so we at least have some impact on the cluster), records the time again and prints out a string that may look a little something like this:

Started: 2012-10-16 15:56:55 Finished: 2012-10-16 15:57:05 Host: ilhead1 User: akrevl

It's a good idea to check if the program will run on the target platform. It doesn't make much difference for a Python script, but if you were running a C binary it's worth checking if it runs on the AMD platform. This is where ild1 comes in. The development node ild1 is set up in the same way as the cluster nodes are. So let's test the script on ild1:

/usr/bin/python2.7 /afs/cs.stanford.edu/u/akrevl/tutorial/SingleCore/SingleCore.py

Note that we are using a full path both to the python executable and to the Python script. The result is as expected:

Started: 2012-10-16 17:04:44 Finished: 2012-10-16 17:04:54 Host: ild1 User: akrevl