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

Add `fmpi_mpi_world_rank()`

parent f6755f6a
No related branches found
No related tags found
No related merge requests found
...@@ -160,6 +160,13 @@ _Bool fmpi_mpi_check_error( ...@@ -160,6 +160,13 @@ _Bool fmpi_mpi_check_error(
* } * }
*/ */
void fmpi_mpi_ctx_print(const struct fmpi_mpi_ctx * ctx); void fmpi_mpi_ctx_print(const struct fmpi_mpi_ctx * ctx);
/*------------------------------------------------------------------------------
fmpi_mpi_world_rank()
------------------------------------------------------------------------------*/
/**
* TODO
*/
int fmpi_mpi_world_rank(const struct fmpi_mpi_ctx * ctx);
/*============================================================================== /*==============================================================================
GUARD GUARD
==============================================================================*/ ==============================================================================*/
......
...@@ -139,3 +139,16 @@ void fmpi_mpi_ctx_print(const struct fmpi_mpi_ctx * const ctx) ...@@ -139,3 +139,16 @@ void fmpi_mpi_ctx_print(const struct fmpi_mpi_ctx * const ctx)
printf("MPI futhark error class: %d\n", ctx->futhark_err_class); printf("MPI futhark error class: %d\n", ctx->futhark_err_class);
printf("MPI futhark error code: %d\n", ctx->futhark_err_code); printf("MPI futhark error code: %d\n", ctx->futhark_err_code);
} }
/*------------------------------------------------------------------------------
fmpi_mpi_world_rank()
------------------------------------------------------------------------------*/
int fmpi_mpi_world_rank(const struct fmpi_mpi_ctx * const ctx)
{
assert(ctx != NULL);
int rank = -1;
int err_id = MPI_Comm_rank(MPI_COMM_WORLD, &rank);
if(fmpi_mpi_check_error(ctx, err_id, "MPI_Comm_rank") == true) {
return -1;
}
return rank;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment