From 4c973838831fbfc14675fd437af1e8b060cb8a3a Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sat, 17 Aug 2019 22:24:44 +0200 Subject: [PATCH] Have SMPI fail on MPI_ERR_* in MC mode The standard says that upon error, implementations should call the current MPI error handler, which is MPI_ERRORS_ARE_FATAL by default but could be changed to MPI_ERRORS_RETURN on need. Since we don't implement MPI_Comm_set_errhandler() to switch between modes, the simulation mode of SMPI is only issuing a warning on errors (which is similar to MPI_ERRORS_RETURN). This commit adds a MC_assert() stating that every MPI call succeed. This will lead to a property failure (visible only in MC mode) when a MPI_ERR_* is issued by the implementation (which is somehow similar to MPI_ERRORS_ARE_FATAL). --- ChangeLog | 2 ++ src/smpi/bindings/smpi_mpi.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0198945fde..4614f28ffa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,8 @@ SMPI: Model-Checker: - Option model-checker/hash was removed. This is always activated now. + - MPI calls now MC_assert() that no MPI_ERR_* code is returned. + This is useful to check for MPI compliance. XBT: - xbt_mutex_t and xbt_cond_t are now marked as deprecated, a new C interface diff --git a/src/smpi/bindings/smpi_mpi.cpp b/src/smpi/bindings/smpi_mpi.cpp index 357e4f6c2a..09b5a5d0ae 100644 --- a/src/smpi/bindings/smpi_mpi.cpp +++ b/src/smpi/bindings/smpi_mpi.cpp @@ -4,6 +4,7 @@ * under the terms of the license ,(GNU LGPL) which comes with this package. */ #include "private.hpp" +#include "simgrid/modelchecker.h" #include "simgrid/sg_config.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_mpi, smpi, "Logging specific to SMPI ,(mpi)"); @@ -36,6 +37,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_mpi, smpi, "Logging specific to SMPI ,(mpi) int error_size; \ PMPI_Error_string(ret, error_string, &error_size); \ XBT_WARN("%s - returned %.*s instead of MPI_SUCCESS", __func__, error_size, error_string); \ + MC_assert(not MC_is_active()); /* Only fail in MC mode */ \ } \ XBT_VERB("SMPI - Leaving %s", __func__); \ return ret; \ -- 2.20.1