An Example Run on the IU Tiger Cluster using PBS
|
The following is an example MPI Hello World program written in C:
th1 pewang/tiger-doc> cat hello.c
#include <mpi.h>
#include <stdio.h>
int main(int argc, char ** argv)
{
int myrank;
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
printf("Hello, world, this is processor # %d\n", myrank);
MPI_Finalize();
exit(0);
}
To compile that program, do this:
th1 pewang/tiger-doc> soft add +mpich-gm-1.2.5..10-intel-r2
th1 pewang/tiger-doc> which mpicc
/N/soft/linux-sles8-ia64/mpich-gm-1.2.5..10-intel-r2/bin/mpicc
th1 pewang/tiger-doc> mpicc -o hello hello.c
The command "soft add ..." utilized the softenv environment to set up the appropriate
path for the mpicc and later mpirun binary, for more information about softenv, run "man softenv-intro".
Jobs on the tiger cluster must run under the PBS queuing system. For information on PBS and the related commands, please see Getting Started on AVIDD. The following is an example PBS script with appropriate comments:
# I need all the 4 processors on 1 node, and the cpu time limit
# of my job is 10 minutes, wall clock time limit is also 10 min
#PBS -l nodes=1:ppn=4,cput=00:10:00,walltime=00:10:00
# Where my output and error files are
#PBS -o outputfile
#PBS -e errorfile
# PBS spawns a shell to run the job, ask PBS to export all the
# environment variables of my current shell to the job running shell
#PBS -V
# This is a required field of your PBS script on the tiger cluster,
# use tgusage command to get your project account number
#PBS -A teragrid account number
# My email address
#PBS -M pewang@indiana.edu
# Send me email when the job begins, aborts and terminates
#PBS -m bae
cd $PBS_O_WORKDIR
soft add +mpich-gm-1.2.5..10-intel-r2
which mpirun
mpirun -np 4 ./hello
Please note: the teragrid account number needs to be replaced with your actual account
number. It can be obtained on the tiger cluster using tgusage command with no argument.
The following is the output generated by submitting the above job submission script:
th1 pewang/tiger-doc> cat outputfile
Warning: no access to tty (Bad file descriptor).
Thus no job control in this shell.
-----------------------------------------------------------------------------
Welcome to the AVIDD Teragrid Cluster
This system is managed by Research and Technical Services
Please address email questions or comments to rats in the indiana.edu domain
Further information is available at http://www.iu.teragrid.org/
------------------------------------------------------------------------------
The IPGrid border router will be down for emergency maintenance
1/27/2005 from 6-6:30am. This will interrupt any connections to the TeraGrid.
The next maintenance day is 1-Feb-2005.
------------------------------------------------------------------------------
Directory: /N/T/pewang
/N/soft/linux-sles8-ia64/mpich-gm-1.2.5..10-intel-r2/bin/mpirun
Hello, world, this is processor # 2
Hello, world, this is processor # 3
Hello, world, this is processor # 1
Hello, world, this is processor # 0
Please contact the HPC Support Team if you have questions.
|




