From f2f4e84d1201b1b9be277b5000fd6f46e39cb101 Mon Sep 17 00:00:00 2001 From: "raphael.bach" <raphael.bach@etu.hesge.ch> Date: Mon, 13 Jun 2022 11:19:08 +0200 Subject: [PATCH] Add `fmpi_mpi_abort()` --- include/internal/fmpi_mpi.h | 16 ++++++++++++++++ src/fmpi_mpi.c | 9 +++++++++ 2 files changed, 25 insertions(+) diff --git a/include/internal/fmpi_mpi.h b/include/internal/fmpi_mpi.h index 1b5f1d9..e2909d5 100644 --- a/include/internal/fmpi_mpi.h +++ b/include/internal/fmpi_mpi.h @@ -184,6 +184,22 @@ int fmpi_mpi_world_rank(const struct fmpi_mpi_ctx * ctx); * } */ _Bool fmpi_mpi_finalized(const struct fmpi_mpi_ctx * ctx); +/*------------------------------------------------------------------------------ + fmpi_mpi_abort() +------------------------------------------------------------------------------*/ +/** + * Terminates MPI execution environment. + * + * @param[in] ctx : A pointer to a fmpi_mpi_ctx. + * + * @warning + * - \b [UB] \p{ctx} must not be `NULL`. + * + * @example{ + * TODO + * } + */ +void fmpi_mpi_abort(const struct fmpi_mpi_ctx * ctx); /*============================================================================== GUARD ==============================================================================*/ diff --git a/src/fmpi_mpi.c b/src/fmpi_mpi.c index 67983d6..4f10ef6 100644 --- a/src/fmpi_mpi.c +++ b/src/fmpi_mpi.c @@ -162,3 +162,12 @@ _Bool fmpi_mpi_finalized(const struct fmpi_mpi_ctx * const ctx) } return finalized; } +/*------------------------------------------------------------------------------ + fmpi_mpi_abort() +------------------------------------------------------------------------------*/ +void fmpi_mpi_abort(const struct fmpi_mpi_ctx * const ctx) +{ + assert(ctx != NULL); + int err_id = MPI_Abort(MPI_COMM_WORLD, 1); + fmpi_mpi_check_error(ctx, err_id, "MPI_Abort"); +} -- GitLab