Vuori User's Guide > Program development > Using MPI
Tehdyt toimenpiteet

Using MPI

This section contains basic information on using the MPI message passing library on Vuori.

Message passing interface (MPI) is a flexible parallel programming paradigm, and it is the dominant method of parallelizing codes in scientific computing. MPI is suitable for both distributed memory computers and shared memory architectures. In MPI, each task has an address space in memory that other tasks cannot directly access. When exchange of data is needed between tasks, the tasks send 'messages' each other.

Vuori features the MPICH2 and OpenMPI libraries.

Compiling and linking MPI programs on Vuori

There are compiler wrappers mpif90, mpicc and mpiCC for compiling Fortran, C and C++ MPI programs, respectively. These wrappers take care of compiler and linker directives for compiling MPI programs. Users do not need to specify include file locations, MPI libraries or their locations.

For example, a MPI program written with the C language ('my_mpi_prog.c') is compiled as

mpicc my_mpi_prog.c -o my_mpi_prog

The -show option displays the actual compilation/linking command generated by the wrapper. For example, try

mpif90 -show

Include files

In Fortran programs use

include 'mpif.h'
and in C/C++, use
#include <mpi.h>