Languages
Menus
Search
Using MPICH1
MPICH for GNU Compiler
Compile your application
MPICH for GNU compiler is installed at /share/apps/mpich/gnu. Below are step-by-step guide to use MPICH for GNU compiler. To compile your code, either type the full path to your desired MPI compiler for your language. Below are an example.
[user@tera mpich]$ /share/apps/mpich/gnu/bin/mpicc -o cpi cpi.c
The character in orange is source code of MPI application and the character in green is executable program. If you want, you can download cpi.c from here.
Run your program
To run your compiled program, you need to submit your program to SGE (Sun Grid Engine) batch scheduling system. Below are step-by-step instruction.
Create job submission script for SGE scheduler with your desired editor, such as vi or nano
[user@tera mpich]$ vi mpich_test.job
Below are an example content of job script. You’ll need to replace
MPICH_APPwith the full path to your program. Note that,$NSLOTSand$TMPDIRwill be replaced automatically by SGE.#!/bin/bash #$ -cwd #$ -S /bin/bash export MPICH_HOME=/share/apps/mpich/gnu export MPICH_APP=/home/user/mpich/cpi $MPICH_HOME/bin/mpirun -np $NSLOTS -machinefile $TMPDIR/machines \ $MPICH_APP
Now submit the script to SGE. Since this application is the parallel application, user need to indicate parallel environment (highlighted in green) and a number of processors (in orange) with option
-pe. Note that, you can specify queue name other than default queue by using-qoption. You can find more instruction on SGE here.[user@tera mpich]$ qsub -pe mpich 4 mpich_test.job
To view your job status
[user@tera mpich]$ qstat
The output and error from MPI application are created in directory where user submitted jobs.
MPICH for Intel Compiler
MPICH for Intel Compiler is recommended to be used only if you want to compile your MPI program using Intel Compiler. If you just want to simply link with MPICH, please consider to use MPICH for GNU instead.
The usage of MPICH for Intel compiler is the same as MPICH for GNU compiler, except that you need to replace all path to MPICH compiler from /share/fs/mpich/gnu to /share/fs/mpich/intel.
