MPI Batch Script Example
This is a simple example for invoking an MPI job from a batch script.
1. Create your job script. For example, create a batch script containing the following:
#-----------------------
#!/bin/tcsh
#SBATCH -p pdebug
#SBATCH -J myJob
#SBATCH -N 2
# Wait for a front end TV to accept this reverse connection request
tvconnect srun -n4 myMPIprogram
echo 'DONE!'
#-----------------------
Once the script is run, the tvconnect command creates the request file with the necessary details, then holds and waits for a connection request.
2. Start TotalView on your front-end node and accept the request. The debugger begins debugging srun. Pressing Go starts the MPI job and TotalView will attach to the MPI processes running on the compute nodes in the normal way.
NOTE: If the application is in your system path, TotalView will find it. i.e., you do not need to enter the full path in your command.
it is not required that you include the full path to your application in the command, if the application is in your path. In the above case, myMPIprogram was in the current working directory when the batch job was submitted. The request file reports the current working directory, so that the front-end TotalView can find the application even if it was not started from same directory.