diff --git a/include/internal/fmpi_mpi.h b/include/internal/fmpi_mpi.h index 5519e3b346eb066d10ad5b4d7e11dc882626265a..91fbf91f3e160a4bcb4bf0e67cc4512fc504ba6b 100644 --- a/include/internal/fmpi_mpi.h +++ b/include/internal/fmpi_mpi.h @@ -216,6 +216,13 @@ int fmpi_mpi_gather_in_place( const struct fmpi_mpi_ctx * ctx, void * buf, MPI_Datatype type, size_t send_cnt, size_t recv_cnt, int root, MPI_Comm comm ); +/*------------------------------------------------------------------------------ + fmpi_mpi_world_gather_in_place() +------------------------------------------------------------------------------*/ +int fmpi_mpi_world_gather_in_place( + const struct fmpi_mpi_ctx * ctx, void * buf, MPI_Datatype type, + size_t send_cnt, size_t recv_cnt +); /*============================================================================== GUARD ==============================================================================*/ diff --git a/src/fmpi_mpi.c b/src/fmpi_mpi.c index 8229836f797a5411bc07842223c845dce4ee1bb3..959b0549c5c403d1148ebe09173b37e62d572283 100644 --- a/src/fmpi_mpi.c +++ b/src/fmpi_mpi.c @@ -239,7 +239,7 @@ int fmpi_mpi_gather_in_place( if(ctx->rank == root) { err = MPI_Gather( MPI_IN_PLACE, (int)send_cnt, type, - buf , (int)recv_cnt, type, + buf , (int)recv_cnt, type, root, comm ); } else { @@ -251,3 +251,26 @@ int fmpi_mpi_gather_in_place( } return fmpi_mpi_check_error(ctx, err, "MPI_Gather"); } +/*------------------------------------------------------------------------------ + fmpi_mpi_world_gather_in_place() +------------------------------------------------------------------------------*/ +int fmpi_mpi_world_gather_in_place( + const struct fmpi_mpi_ctx * const ctx, void * const buf, MPI_Datatype type, + const size_t send_cnt, const size_t recv_cnt +){ + assert(ctx != NULL); + assert(buf != NULL); + assert(send_cnt <= INT_MAX); + assert(recv_cnt <= INT_MAX); + assert(send_cnt <= recv_cnt); + + const int err = fmpi_mpi_gather_in_place( + ctx, buf, type, send_cnt, recv_cnt, ctx->root, ctx->world + ); + if(err != FMPI_SUCCESS) { + FMPI_RAISE_ERROR(ctx->err_handler, "FMPI", + "fmpi_mpi_gather_in_place() failed!" + ); + } + return err; +}