Go to the first, previous, next, last section, table of contents.


Initialization and termination functions

The following are Fortran and C prototypes of the primary functions used to initialize and complete an MPI program.

Fortran subroutine: MPI_INIT (IERROR)
INTEGER IERROR
C function: int MPI_Init (int *argc, char ***argv)
This function must be called before any other MPI routine is called. It initializes the MPI environment. The C version of the function requires the argc and argv arguments provided to main(). Both the C and Fortran versions modify the command line arguments by removing the -np and -key arguments. All nodes synchronize on this call.

The function also initializes the FM system, which makes it possible for FM error messages to result from calling this function.

Fortran subroutine: MPI_FINALIZE (IERROR)
INTEGER IERROR
C function: int MPI_Finalize (void)
This routine shuts down the MPI environment. All MPI processes must call MPI_Finalize(), and it must be the last MPI call they make. This call will also shutdown the FM system.

Fortran subroutine: MPI_COMM_SIZE (COMM, SIZE, IERROR)
INTEGER COMM, SIZE, IERROR
C function: int MPI_Comm_size (MPI_Comm comm, int *size)
This function stores in size the number of processes in the communicator group comm.

Fortran subroutine: MPI_COMM_RANK (COMM, RANK, IERROR)
INTEGER COMM, RANK, IERROR

C function: int MPI_Comm_rank (MPI_Comm comm, int *rank)
This function stores in rank the unique id of calling processes relative to the communicator group comm.


Go to the first, previous, next, last section, table of contents.