|
Initialization and Termination
All processes must initialize MPI by calling the MPI_Init function and must finalize MPI processing by calling MPI_Finalize. These calls use no [IN] arguments and return an int error number (0 = no error). The calling syntax for these functions is:
ierr= MPI_Init() ierr= MPI_Finalize() |
|
| Parameter | Description | Status |
|---|---|---|
ierr (int)
|
MPI error number (0 = no error) | [OUT] |
The following example program illustrates MPI initialization and termination. Each processor prints "Hello world.".
#include <stdio.h>
#include <mpi.h>
main(int argc, char **argv){
  MPI_Init(&argc, &argv);
  printf(" Hello World.\n");
  MPI_Finalize();
}
OUTPUT (4 PEs): Hello World. Hello World. Hello World. Hello World.



