Skip to content
Snippets Groups Projects
Verified Commit e6f39a0c authored by raphael.bach's avatar raphael.bach
Browse files

Add `fmpi_mpi_finalized()`

parent bafe246c
No related branches found
No related tags found
No related merge requests found
...@@ -167,6 +167,23 @@ void fmpi_mpi_ctx_print(const struct fmpi_mpi_ctx * ctx); ...@@ -167,6 +167,23 @@ void fmpi_mpi_ctx_print(const struct fmpi_mpi_ctx * ctx);
* TODO * TODO
*/ */
int fmpi_mpi_world_rank(const struct fmpi_mpi_ctx * ctx); int fmpi_mpi_world_rank(const struct fmpi_mpi_ctx * ctx);
/*------------------------------------------------------------------------------
fmpi_mpi_finalized()
------------------------------------------------------------------------------*/
/**
* Checks if `MPI_Finalize()` has been called.
*
* @param[in] ctx : A pointer to a fmpi_mpi_ctx.
*
* @return
* - `true` if `MPI_Finalize()` has been called.
* - `false` if `MPI_Finalize()` has not been called.
*
* @example{
* TODO
* }
*/
_Bool fmpi_mpi_finalized(const struct fmpi_mpi_ctx * ctx);
/*============================================================================== /*==============================================================================
GUARD GUARD
==============================================================================*/ ==============================================================================*/
......
...@@ -93,7 +93,7 @@ int fmpi_mpi_exit(struct fmpi_mpi_ctx ** const ctx) ...@@ -93,7 +93,7 @@ int fmpi_mpi_exit(struct fmpi_mpi_ctx ** const ctx)
if(fmpi_mpi_check_error(*ctx, err_id, "MPI_Finalize") == true) { if(fmpi_mpi_check_error(*ctx, err_id, "MPI_Finalize") == true) {
err_id = -1; err_id = -1;
} }
free(*ctx); *ctx = NULL; //free(*ctx); *ctx = NULL;
return err_id; return err_id;
} }
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
...@@ -150,3 +150,15 @@ int fmpi_mpi_world_rank(const struct fmpi_mpi_ctx * const ctx) ...@@ -150,3 +150,15 @@ int fmpi_mpi_world_rank(const struct fmpi_mpi_ctx * const ctx)
} }
return rank; return rank;
} }
/*------------------------------------------------------------------------------
fmpi_mpi_finalized()
------------------------------------------------------------------------------*/
_Bool fmpi_mpi_finalized(const struct fmpi_mpi_ctx * const ctx)
{
int finalized = 0;
int err_id = MPI_Finalized(&finalized);
if(ctx != NULL) {
fmpi_mpi_check_error(ctx, err_id, "MPI_Finalized");
}
return finalized;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment