About HPC Systems Software User Guides Education Partners

  / gears / hpc / software / parlib / mpich


Bioinformatics

Compilers and Programming Tools

Computational Chemistry

File System

Finite Element Solvers

Graphics and Imaging

Mathematics

Numerical Libraries

Optimization

Parallel Programming Libraries and Tools

Queuing and Scheduling Systems

Solid Modeling

Statistics

MPICH

Overview

MPICH is a freely avaliable, portable implementation of MPI, the standard for message-passing libraries. MPICH runs over fast-ethernet on the machines that it is installed on. It is recommended that if you have code that is communication-intensive that you use one of the MPIs that use a high-speed network.

Setup

By default, most systems use a MPI implementation that is customized for a high-speed interconnect rather than using straight MPICH. If you would like to use MPICH instead, add /usr/global/mpich/bin to the beginning of your PATH. Note that MPICH will not use the high-speed interconnect and could adversly impact the performace of your job runs.

Usage

There are two things to take into account in using MPICH. The first is how to compile an MPI program against it. The second is how to run the resulting executable.

To compile against MPICH you should use one of the compilation wrappers included with it. These wrappers automatically add any necessary compilation arguments to your compiler command to include the required MPICH headers and libraries. Their syntax is as follows:

    mpif77 -fc=f77_compiler -config=f77_compiler ...
    • for Fortran77 code
    mpif90 -f90=f90_compiler -config=f90_compiler ...
    • for Fortran90 code
    mpicc -cc=C_compiler -config=C_compiler ...
    • for C code

where f77_compiler, f90_compiler, and C_compiler are the names of any of the installed Fortran77, Fortran90, and C compilers respectively. The "..." is the rest of the normal compilation line, such as in:

mpif77 -fc=ifort -config=ifort foo.f -o foo

A list of available compilers can be found in the 'Compilers and Programming Tools' section of the HPC software pages. Examples of the above commands can be found in the Examples section of this page.

To run code that was compiled against the MPICH you need to use the command /usr/global/bin/mpirun in your PBS job submission script. Its syntax is:

    /usr/global/bin/mpirun executable_name

where executable_name is the name of your MPICH executable.

An example PBS script can be found in the Examples section of this page. Information on PBS scripts can be found in the Users Guide for the system intended to be used.

Examples

For a Fortran77 MPI file foo.f that is intended to be compiled with the Portland Group Fortran77 compiler to an executable called foo, the following command would be used:

mpif77 -fc=pgf77 -config=pgf77 foo.f -o foo

For a C MPI file foo.c that is intended to be compiled with the Intel C Compiler to an executable called foo, the following command would be used:

mpicc -cc=icc -config=icc foo.c -o foo

An example PBS job submission script to run one of the above foo executables over 4 nodes that have the Myrinet interconnect using 2 processors per node for a maximum of 2 hours would look like this:

#PBS -l nodes=4:ppn=2
#PBS -l walltime=2:00:00
#PBS -j oe

# change the current working directory to the directory where
# the executable file 'foo' can be found
cd /home/user/mpi

# run the executable file 'foo' using the qmpirun script
/usr/global/bin/mpirun ./foo

Further information on PBS scripts and submitting jobs can be found in Users Guide for the system that the job is intended to be run on.

Documentation

N/A


Please send questions or suggestions about this web page to beatnic@aset.psu.edu

ASET | ITS | Penn State