Rookie HPC

About

Docs

Tools

Tests

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

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[])
{
    int return_code = EXIT_FAILURE;

    MPI_Init(&argc, &argv);

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

    return return_code;
}