Rookie HPC

About

Docs

Tools

Tests

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 comm,
              int error_code);

Parameters

comm
The communicator concerned.
error_code
The error code to propagate.

Returned value

MPI_SUCCESS
The routine successfully completed.

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;
}