diff --git a/include/fmpi_core.h b/include/fmpi_core.h index 9654644f603534a0c68fb5bd2eef2fb065a3c008..8604f17f8744c6c50f25986431f743b4d6d78b26 100644 --- a/include/fmpi_core.h +++ b/include/fmpi_core.h @@ -134,6 +134,10 @@ int fmpi_run_task(const struct fmpi_ctx * ctx, struct fmpi_task * task); fmpi_sync() ------------------------------------------------------------------------------*/ int fmpi_sync(const struct fmpi_ctx * ctx); +/*------------------------------------------------------------------------------ + fmpi_world_size() +------------------------------------------------------------------------------*/ +int fmpi_world_size(const struct fmpi_ctx * ctx); /*============================================================================== MACRO ==============================================================================*/ diff --git a/src/fmpi_core.c b/src/fmpi_core.c index 8989b49e72bd71a24894f723a90026e6d6e0586c..3898044ed83242ae38ea0b0ba6e7c954b477af12 100644 --- a/src/fmpi_core.c +++ b/src/fmpi_core.c @@ -137,3 +137,15 @@ int fmpi_sync(const struct fmpi_ctx * const ctx) } return err; } +/*------------------------------------------------------------------------------ + fmpi_world_size() +------------------------------------------------------------------------------*/ +int fmpi_world_size(const struct fmpi_ctx * const ctx) +{ + assert(ctx != NULL); + const int size = fmpi_mpi_world_size(ctx->mpi); + if(size < FMPI_SUCCESS) { + FMPI_RAISE_ERROR(ctx->err_handler, "FMPI", "fmpi_mpi_world_size() failed!"); + } + return size; +}