Rookie HPC

Miscellaneous

C | FORTRAN-legacy | FORTRAN-2008

MPI_Finalize

Definition

MPI_Finalize shuts down the MPI library. It must be called by each process at the end of the MPI program.

Copy

Feedback

int MPI_Finalize();

Returned value

The error code returned from the finalisation.

MPI_SUCCESS
The routine successfully completed.

Example

Copy

Feedback

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

/**
 * @brief Illustrate how to finalise the MPI environment.
 **/
int main(int argc, char* argv[])
{
    MPI_Init(&argc, &argv);

    // Tell MPI to shut down and that we no longer need it.
    MPI_Finalize();

    return EXIT_SUCCESS;
}