PPT Slide
MPI is a set of precompiled library routines that the user links with their code. The code must include information to indicate what arguments each function takes and values each function returns. Thus, every file in a C program that
uses MPI must contain the preprocessor directive: #include "mpi.h". This file, mpi.h, contains the definitions, macros and function prototypes for compiling an MPI program written in C. Similar, Fortran subroutine that uses MPI must have a preprocessor directive: include 'mpif.h' to accomplish the same task.
The function MPI_Init must be called before any MPI function is used, and it should only be called once. In a C program its arguments are pointers to the main function's parameters argc and argv. MPI_Init may extract arguments from the the parameter list. Fortran program must also call MPI_Init before using any MPI functions.
At the end of a program the function MPI_Finalize must be called. There should be no additional calls to MPI functions after the call to MPI_Finalize.