Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines for 2023.
[simgrid.git] / src / smpi / internals / smpi_global.cpp
index 3ff42f8..61c4baa 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2022. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2023. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -13,6 +13,7 @@
 #include "smpi_host.hpp"
 #include "src/kernel/EngineImpl.hpp"
 #include "src/kernel/activity/CommImpl.hpp"
+#include "src/mc/mc_replay.hpp"
 #include "src/smpi/include/smpi_actor.hpp"
 #include "xbt/config.hpp"
 #include "xbt/file.hpp"
@@ -213,10 +214,6 @@ void smpi_comm_null_copy_buffer_callback(simgrid::kernel::activity::CommImpl*, v
   /* nothing done in this version */
 }
 
-int smpi_enabled() {
-  return MPI_COMM_WORLD != MPI_COMM_UNINITIALIZED;
-}
-
 static void smpi_init_papi()
 {
 #if HAVE_PAPI
@@ -583,11 +580,11 @@ int smpi_main(const char* executable, int argc, char* argv[])
   return smpi_exit_status;
 }
 
-static bool smpi_inited = false;
 int SMPI_is_inited()
 {
-  return smpi_inited;
+  return MPI_COMM_WORLD != MPI_COMM_UNINITIALIZED;
 }
+
 // Called either directly from the user code, or from the code called by smpirun
 void SMPI_init(){
   smpi_init_options_internal(false);
@@ -606,7 +603,6 @@ void SMPI_init(){
   }
   smpi_init_papi();
   smpi_check_options();
-  smpi_inited = true;
 }
 
 void SMPI_finalize()
@@ -635,7 +631,7 @@ void smpi_mpi_init() {
   smpi_init_fortran_types();
   if(_smpi_init_sleep > 0)
     simgrid::s4u::this_actor::sleep_for(_smpi_init_sleep);
-  if (not MC_is_active()) {
+  if (not MC_is_active() && not MC_record_replay_is_active()) {
     smpi_deployment_startup_barrier(smpi_process()->get_instance_id());
   }
 }