For complete information about using MPI see the MPI standard.
A number of good MPI tutorials and reference materials on the web are linked from the introductory page on parallel computing. If you are unfamiliar with MPI, you should start with one of these tutorials.
ATS gives classes in MPI programming every quarter. The dates of the classes are announced on the News and Announcements page and in the class schedule.
To use MPI, you need to include the following header file in your program:
- Fortran Programs:
- include 'mpif.h'
- C Programs:
- #include <mpif.h>
- C++ Programs:
- #include <mpi.h>
To use MPI, you need to include the following header file in your program:
- Fortran:
- MPI_INIT(ierror)
Where:
- integer ierror
- C:
- int MPI_Init(int *argc, char ***argv);
- C++:
- int MPI::Init(int *argc, char ***argv);
- Fortran:
- MPI_COMM_SIZE(comm, size, ierror)
Where:
- integer comm, rank, ierror
- C:
- int MPI_Comm_size (MPI_Comm comm, int *size);
- C++:
- int MPI::COMM_WORLD.Get_size( );
- Fortran:
- MPI_COMM_RANK(comm, rank, ierror)
Where:
- integer comm, rank, ierror
- C:
- int MPI_Comm_rank(MPI_Comm comm, int *rank);
- C++:
- int MPI::COMM_WORLD.Get_rank( );
- Fortran:
- MPI_ABORT(comm, errorcode, ierror)
Where:
- integer comm, errorcode, ierror
- C:
- int MPI_Abort(MPI_Comm comm int errorcode );
- C++:
- void MPI::COMM_WORLD.Abort( int errorcode );
- Fortran:
- double precision MPI_WTIME()
- C:
- double MPI_Wtime( );
- C++:
- double MPI::Wtime( );
- Fortran:
- MPI_FINALIZE(ierror)
Where:
- integer ierror
- C:
- int MPI_Finalize();
- C++:
- MPI::Finalize( );
Data Types for C
C data type
MPI data type
char MPI_CHAR short int MPI_SHORT int MPI_INT long int MPI_LONG float MPI_FLOAT double MPI_DOUBLE long double MPI_LONG_DOUBLE
Data Types for Fortran
Fortran data type
MPI data type
INTEGER MPI_INTEGER REAL MPI_REAL REAL*8 MPI_REAL8 DOUBLE PRECISION MPI_DOUBLE_PRECISION COMPLEX MPI_COMPLEX LOGICAL MPI_LOGICAL CHARACTER MPI_CHARACTER