Some definitions when using "myjob":
A set of process working together to achieve a common task is called a job.
The number of process participating in a job is called the "size" of the job.
Each process in a job is assigned a unique position in the job, or "rank".
Note that this set of process must be located on the same machine. For job spanned accross several machines, please see the example globus_duroc_ring, which enable this feature. (actually, I should not "same machine" but the same "resource manager". See duroc documentation for a precise description)
In this example, the process of rank 0 initiates the comunication by sending a message to the process of rank 1. The process of rank 1 forwards this message to the next process (rank+1) and so forth until the "last process (of rank size-1) forwards the message to the first process (rank 0). The ring is now closed.
The message is the first and only argument of the program. If the message contains blanks, it should be double quoted.
Amoung the several possibilities existing to do so, the easiest is probably to use globusrun, as in the example below:
#promtp> globusrun -r pitcairn.mcs.anl.gov-fork -- '&( directory = /usr/local/globus/Examples/nexus_myjob_ring/ )( executable = nexus_myjob_ring )( stdout = my_std_out)( stderr = my_std_err )( count = 5 )(arguments = "Test me")'
It will create a job containing 5 process, exchanging the message "Test me".
"pitcairn.mcs.anl.gov-fork" is the "short" name of the fork GRAM running
on our machine pitcairn. (Ref. globusrun for more information)
This command should output the following text:
globus_gram_client_callback_allow successful GLOBUS_GRAM_CLIENT_JOB_STATE_ACTIVE globus_gram_client_job_request successful GLOBUS_GRAM_CLIENT_JOB_STATE_DONE
To see the result of the execution, check the file my_std_out and my_std_err in the execution directory. (in our example: /usr/local/globus/Examples/gram_myjob_ring/)
The output should look like this (the order of the messages might be different: the order is preserved only inside a job):
Job of rank 4 Total number of jobs (job size): 5 4: Send my startpoint 4: Received startpoint 4: Got a NEXUS remote service call 4: Message lenght : 7 4: Message received: Test me 4: Message size to send 7 4: test complete. Job of rank 3 Total number of jobs (job size): 5 3: Received startpoint 3: Send my startpoint 3: Got a NEXUS remote service call 3: Message lenght : 7 3: Message received: Test me 3: Message size to send 7 3: test complete. Job of rank 2 Total number of jobs (job size): 5 2: Send my startpoint 2: Received startpoint 2: Got a NEXUS remote service call 2: Message lenght : 7 2: Message received: Test me 2: Message size to send 7 2: test complete. Job of rank 1 Total number of jobs (job size): 5 1: Received startpoint 1: Send my startpoint 1: Got a NEXUS remote service call 1: Message lenght : 7 1: Message received: Test me 1: Message size to send 7 1: test complete. Job of rank 0 Total number of jobs (job size): 5 0: Send my startpoint 0: Received startpoint Message to send around: Test me 0: Message size to send 7 0: Got a NEXUS remote service call 0: Message lenght : 7 0: Message received: Test me 0: Received the correct message ! 0: test complete.Note: