MPICH is a freely available, portable implementation of MPI, the standard for message-passing libraries.
Building Your Applications
To build applications with MPICH, you should replace direct references to compilers (gcc, g77, etc.) with references to the appropriate MPICH wrapper scripts (mpicc, mpif77, etc.). The wrapper scripts are intended to supply correct include and library paths and options automatically. The wrapper script names are:
mpicc
the C compiler wrapper forgcc
,pgcc
,icc
.mpif77
the Fortran 77 compiler wrapper forf77
,pgf77
,ifc
.mpif90
the Fortran 90 compiler wrapper forpgf90
,f90com
.mpiCC
the C++ compiler wrapper forg++
,pgCC
,icc
.
To troubleshoot problems compiling with a wrapper script, use the -show
argument to see what commands it is executing, and try executing those commands manually. Try running mpicc -show
alone to see the general effect of the wrapper script. Here's an example:
% mpicc -show test.c -o test gcc -DUSE_STDARG -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STDARG_H=1 -DUSE_STDARG=1 -DMALLOC_RET_VOID=1 -L/usr/local/mpich/1.2.5.2/gcc/i686/lib test.c -o test -lmpich
Running Your Applications
Start MPICH programs using the mpirun
wrapper script.
The most common mpirun
arguments are briefly described below:
Argument | Purpose |
---|---|
-np N |
Request quantity N processors. |
-nolocal |
Do not run the job on the local node (example: master). |
-show |
Show what mpirun would do, but don't actually do it. Useful for troubleshooting. |
For more information, please read man mpirun
. Also note that some options have no effect on execution because they don't apply to the cluster's configuration.