Miscellaneous

C | Fortran-2008 | Fortran-90

MPI_Abort

Definition

MPI_Abort terminates the processes that belong to the communicator passed. When the communicator passed is MPI_COMM_WORLD, it is equivalent to shutting down the entire MPI application. (If the communicator passed is a subset of MPI_COMM_WORLD, it may not be possible for an MPI implementation to terminate only the processes belonging to this communicator. In which case, all processes are terminated instead.) The MPI standard stipulates no directive with regard to how the error code passed should be handled. In a UNIX or POSIX environment however, the error code given "should" become the value returned by the main program.

Copy

Feedback

int MPI_Abort(MPI_Comm communicator,
              int error_code);

Parameters

communicator

The communicator concerned.

error_code

The error value to give other MPI processes when informing them of abortion.

Return value

The error code returned during the abortion. Do not confuse the returned error code, which indicates if calling the routine was successful, and the error code that is passed to other MPI process during abortion.

Example

Copy

Feedback

#include <stdio.h>
#include <stdlib.h>
#include <mpi.h>

/**
 * @brief Illustrates how to abort all processes in the MPI_COMM_WORLD
 * communicator.
 **/
int main(int argc, char* argv[])
{
    MPI_Init(&argc, &argv);

    MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE);

    MPI_Finalize();

    return EXIT_SUCCESS;
}