MPICH at the ITP Opteron Cluster

    MPICH
Building a MPI program
MPICH Documentation

MPICH

MPICH is a freely available, portable implementation of MPI (MPI stands for the Message Passing Interface).

Implementation

The current version of MPICH is 1.2.7p2. (out of date!)

Setting up the MPICH environment

To use the MPICH software it is helpful to add the MPI path to your PATH variable. In order to do so you can do this interactive or you place the following entry after the global definitions in your ".bashrc" file, if you want to use this module permanent after every login. Please load only one of the MPICH modules:

Compiler .bashrc entry / modulefile command
GNU Compiler
GNU 4.1.2 (gcc, gfortran)

module load mpich/1.2.7p1_gnu-4.1.2

Building a MPI program

MPI include directives

You have to add the following include file to your source files:

#include "mpi.h" (in C/C++)

include 'mpif.h' (in Fortran)

You can find these include files under:

Compiler Include path
GNU Compiler
GNU 4.1.2 (gcc, gfortran)

/opt/mpich/1.2.7p1/include

MPI compiler scripts

Simply use MPI's "wrapper" compilers to compile your MPI applications. That is, instead of using (for example) gcc to compile your program, use mpicc. MPICH provides a wrapper compiler for four languages:

Language Wrapper compiler name Compiler script
C mpicc C Compiler (gcc or icc)
C++ mpicxx or mpiCC
C++ Compiler (g++ or icpc)
F77 mpif77 Fortran 77 Compiler (f77 or ifort)
F90 mpif90 Fortran 90 Compiler (gfortran or ifort)

This is a simple compiler call that compiles the C program myprog.c .

mpicc -o myprog myprog.c

MPI libraries

If you do not use the compiler scripts you have to add the MPI libraries to your link command explicitly. Here are the paths to the libraries:

 

compiler Library path
GNU Compiler
GNU 4.1.2 (gcc, gfortran)

/opt/mpich/1.2.7p1/lib

MPICH Documentation

You can find the MPICH documentation on the following web and man pages:

  • Man Pages: mpicc(1), mpicxx(1), mpiCC(1), mpif77(1), mpif90(1), mpirun(1).
Nach oben scrollen