Startup


Up: MPI Environmental Management Next: Profiling Interface Previous: Timers

One goal of MPI is to achieve source code portability. By this we mean that a program written using MPI and complying with the relevant language standards is portable as written, and must not require any source code changes when moved from one system to another. This explicitly does not say anything about how an MPI program is started or launched from the command line, nor what the user must do to set up the environment in which an MPI program will run. However, an implementation may require some setup to be performed before other MPI routines may be called. To provide for this, MPI includes an initialization routine MPI_INIT.

MPI_INIT()

int MPI_Init(int *argc, char ***argv)

MPI_INIT(IERROR)
INTEGER IERROR

This routine must be called before any other MPI routine. It must be called at most once; subsequent calls are erroneous (see MPI_INITIALIZED).

All MPI programs must contain a call to MPI_init; this routine must be called before any other MPI routine (apart from MPI_INITIALIZED) is called. The version for ANSI C accepts the argc and argv that are provided by the arguments to main:

 
 
MPI_init( argc, argv ); 
The Fortran version takes only IERROR.

MPI_FINALIZE()

int MPI_Finalize(void)

MPI_FINALIZE(IERROR)
INTEGER IERROR

This routines cleans up all MPI state. Once this routine is called, no MPI routine (even MPI_INIT) may be called. The user must ensure that all pending communications involving a process complete before the process calls MPI_FINALIZE.

MPI_INITIALIZED( flag )
[ OUT flag] FlagFlag is true if MPI_INIT has been called and false otherwise.

int MPI_Initialized(int *flag)

MPI_INITIALIZED(FLAG, IERROR)
LOGICAL FLAG
INTEGER IERROR

This routine may be used to determine whether MPI_INIT has been called. It is the only routine that may be called before MPI_INIT is called.

MPI_ABORT( comm, errorcode )
[ IN comm] communicator of tasks to abort
[ IN errorcode] error code to return to invoking environment

int MPI_Abort(MPI_Comm comm, int errorcode)

MPI_ABORT(COMM, ERRORCODE, IERROR)
INTEGER COMM, ERRORCODE, IERROR

This routine makes a ``best attempt'' to abort all tasks in the group of comm. This function does not require that the invoking environment take any action with the error code. However, a Unix or POSIX environment should handle this as a return errorcode from the main program or an abort(errorcode).

MPI implementations are required to define the behavior of MPI_ABORT at least for a comm of MPI_COMM_WORLD. MPI implementations may ignore the comm argument and act as if the comm was MPI_COMM_WORLD.



Up: MPI Environmental Management Next: Profiling Interface Previous: Timers


Return to MPI Standard Index
Return to MPI home page