MPIOnHPCClusters

From NJIT-ARCS HPC Wiki
Jump to: navigation, search

Using MPI

To use a message passing interface (MPI), the MPI executables must be in your path. Use the "module" command to do that. List the available modules using "module available" and load the MPI you want to use. Check that the desired module is loaded via "module list". The module command also makes the manual pages for the loaded module available.

module avail module load <some.mpi>
module list

MPI can be used to compile Fortran 77, Fortran 90, C, or C++ code. See the following table for the compilation command to use for each language.

Language MPI Compile Command
Fortran 77 mpif77
Fortran 90 mpif90
C mpicc
C++ mpic++

For example, to compile Fortran 77 code:

mpif77 -o [output_filename] code_filename.F

To run the compiled program use mpirun:

mpirun -n [number of processors] filename

Sample Programs

Sample programs are available in the following (legacy) directory:

/afs/cad/linux/openmpi-1.2.8/sample_programs

These programs compute pi by integrating the following function from 0 to 1:

f(x) = 4/(1 + x**2)

To use these programs copy them to a directory you control, where you can edit and compile the code.

Contact ARCS@njit.edu with any questions regarding using MPI.