Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 31 Mar 2018 17:27:07 +0000 (19:27 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 31 Mar 2018 17:27:07 +0000 (19:27 +0200)
17 files changed:
examples/smpi/replay/replay.tesh
src/mc/Session.cpp
src/mc/remote/Client.cpp
src/simix/smx_global.cpp
src/smpi/include/private.hpp
src/smpi/internals/smpi_bench.cpp
src/smpi/internals/smpi_global.cpp
src/smpi/internals/smpi_memory.cpp
src/smpi/internals/smpi_process.cpp
src/smpi/mpi/smpi_comm.cpp
src/smpi/mpi/smpi_datatype.cpp
src/smpi/mpi/smpi_op.cpp
src/smpi/mpi/smpi_request.cpp
src/smpi/smpif90.in
src/smpi/smpiff.in
src/smpi/smpirun.in
teshsuite/smpi/pt2pt-pingpong/TI_output.tesh

index 4b70705..51050cd 100644 (file)
@@ -8,7 +8,7 @@ p Test of trace replay with SMPI (one trace for all processes)
 $ mkfile replay/one_trace
 ! timeout 60
 
-$ ../../smpi_script/bin/smpirun -ext smpi_replay --log=replay.thresh:critical --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/simulate-computation:no -np 3 -platform ${srcdir:=.}/../platforms/small_platform.xml -hostfile ${srcdir:=.}/hostfile ./replay/smpi_replay replay/one_trace --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ../../smpi_script/bin/smpirun -no-privatize -ext smpi_replay --log=replay.thresh:critical --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/simulate-computation:no -np 3 -platform ${srcdir:=.}/../platforms/small_platform.xml -hostfile ${srcdir:=.}/hostfile ./replay/smpi_replay replay/one_trace --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
 > [Tremblay:0:(1) 0.000000] [smpi_replay/VERBOSE] 0 bcast 5e4 0.000000
 > [Jupiter:1:(2) 0.015036] [smpi_replay/VERBOSE] 1 bcast 5e4 0.015036
 > [Fafard:2:(3) 0.015676] [smpi_replay/VERBOSE] 2 bcast 5e4 0.015676
@@ -33,7 +33,7 @@ p The same with tracing activated
 < replay/actions_bcast.txt
 $ mkfile replay/one_trace
 
-$ ../../smpi_script/bin/smpirun -ext smpi_replay --log=replay.thresh:critical --log=no_loc  --cfg=tracing:yes --cfg=tracing/smpi:yes --cfg=tracing/smpi/computing:yes --cfg=smpi/simulate-computation:no -np 3 -platform ${srcdir:=.}/../platforms/small_platform.xml -hostfile ${srcdir:=.}/hostfile ./replay/smpi_replay replay/one_trace --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ../../smpi_script/bin/smpirun -no-privatize -ext smpi_replay --log=replay.thresh:critical --log=no_loc  --cfg=tracing:yes --cfg=tracing/smpi:yes --cfg=tracing/smpi/computing:yes --cfg=smpi/simulate-computation:no -np 3 -platform ${srcdir:=.}/../platforms/small_platform.xml -hostfile ${srcdir:=.}/hostfile ./replay/smpi_replay replay/one_trace --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
 > [Fafard:2:(3) 19.691622] [smpi_replay/INFO] Simulation time 19.691622
 
 $ rm -f replay/one_trace
@@ -212,7 +212,7 @@ p Another test of trace replay with SMPI (one trace per process)
 < replay/actions1.txt
 $ mkfile ./split_traces_tesh
 
-$ ../../smpi_script/bin/smpirun -ext smpi_replay --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/simulate-computation:no -np 2 -platform ${srcdir:=.}/../platforms/small_platform.xml -hostfile ${srcdir:=.}/hostfile ./replay/smpi_replay ./split_traces_tesh --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ../../smpi_script/bin/smpirun -no-privatize -ext smpi_replay --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/simulate-computation:no -np 2 -platform ${srcdir:=.}/../platforms/small_platform.xml -hostfile ${srcdir:=.}/hostfile ./replay/smpi_replay ./split_traces_tesh --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
 > [Tremblay:0:(1) 0.167158] [smpi_replay/VERBOSE] 0 send 1 1e6 0.167158
 > [Jupiter:1:(2) 0.167158] [smpi_replay/VERBOSE] 1 recv 0 1e6 0.167158
 > [Jupiter:1:(2) 13.274005] [smpi_replay/VERBOSE] 1 compute 1e9 13.106847
@@ -230,7 +230,7 @@ p Test of barrier replay with SMPI (one trace for all processes)
 < replay/actions_barrier.txt
 $ mkfile replay/one_trace
 
-$ ../../smpi_script/bin/smpirun -ext smpi_replay --log=replay.thresh:critical --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/simulate-computation:no -np 3 -platform ${srcdir:=.}/../platforms/small_platform.xml -hostfile ${srcdir:=.}/hostfile ./replay/smpi_replay replay/one_trace --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ../../smpi_script/bin/smpirun -no-privatize -ext smpi_replay --log=replay.thresh:critical --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/simulate-computation:no -np 3 -platform ${srcdir:=.}/../platforms/small_platform.xml -hostfile ${srcdir:=.}/hostfile ./replay/smpi_replay replay/one_trace --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
 > [Tremblay:0:(1) 1.518421] [smpi_replay/VERBOSE] 0 send 1 1e7 1.518421
 > [Jupiter:1:(2) 1.518421] [smpi_replay/VERBOSE] 1 recv 0 1e7 1.518421
 > [Tremblay:0:(1) 1.520397] [smpi_replay/VERBOSE] 0 barrier 0.001976
@@ -248,7 +248,7 @@ p Test of Isend replay with SMPI (one trace for all processes)
 < replay/actions_with_isend.txt
 $ mkfile replay/one_trace
 
-$ ../../smpi_script/bin/smpirun -ext smpi_replay --log=replay.thresh:critical --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/simulate-computation:no -np 3 -platform ${srcdir:=.}/../platforms/small_platform.xml -hostfile ${srcdir:=.}/hostfile ./replay/smpi_replay replay/one_trace --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ../../smpi_script/bin/smpirun -no-privatize -ext smpi_replay --log=replay.thresh:critical --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/simulate-computation:no -np 3 -platform ${srcdir:=.}/../platforms/small_platform.xml -hostfile ${srcdir:=.}/hostfile ./replay/smpi_replay replay/one_trace --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
 > [Jupiter:1:(2) 0.000000] [smpi_replay/VERBOSE] 1 Irecv 0 1e6 0.000000
 > [Jupiter:1:(2) 6.553424] [smpi_replay/VERBOSE] 1 compute 5e8 6.553424
 > [Jupiter:1:(2) 6.553524] [smpi_replay/VERBOSE] 1 test 0.000100
@@ -276,7 +276,7 @@ p Test of AllReduce replay with SMPI (one trace for all processes)
 < replay/actions_allReduce.txt
 $ mkfile replay/one_trace
 
-$ ../../smpi_script/bin/smpirun -ext smpi_replay --log=replay.thresh:critical --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/simulate-computation:no -np 3 -platform ${srcdir:=.}/../platforms/small_platform.xml -hostfile ${srcdir:=.}/hostfile ./replay/smpi_replay replay/one_trace --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ../../smpi_script/bin/smpirun -no-privatize -ext smpi_replay --log=replay.thresh:critical --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/simulate-computation:no -np 3 -platform ${srcdir:=.}/../platforms/small_platform.xml -hostfile ${srcdir:=.}/hostfile ./replay/smpi_replay replay/one_trace --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
 > [Tremblay:0:(1) 5.112775] [smpi_replay/VERBOSE] 0 allReduce 5e4 5e8 5.112775
 > [Jupiter:1:(2) 6.584135] [smpi_replay/VERBOSE] 1 allReduce 5e4 5e8 6.584135
 > [Fafard:2:(3) 6.584775] [smpi_replay/VERBOSE] 2 allReduce 5e4 5e8 6.584775
@@ -292,7 +292,7 @@ p Test of AllToAll replay with SMPI (one trace for all processes)
 < replay/actions_alltoall.txt
 $ mkfile replay/one_trace
 
-$ ../../smpi_script/bin/smpirun -ext smpi_replay --log=replay.thresh:critical --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/simulate-computation:no -np 3 -platform ${srcdir:=.}/../platforms/small_platform.xml -hostfile ${srcdir:=.}/hostfile ./replay/smpi_replay replay/one_trace --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ../../smpi_script/bin/smpirun -no-privatize -ext smpi_replay --log=replay.thresh:critical --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/simulate-computation:no -np 3 -platform ${srcdir:=.}/../platforms/small_platform.xml -hostfile ${srcdir:=.}/hostfile ./replay/smpi_replay replay/one_trace --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
 > [Tremblay:0:(1) 0.004041] [smpi_replay/VERBOSE] 0 allToAll 500 500 0.004041
 > [Fafard:2:(3) 0.006920] [smpi_replay/VERBOSE] 2 allToAll 500 500 0.006920
 > [Jupiter:1:(2) 0.006920] [smpi_replay/VERBOSE] 1 allToAll 500 500 0.006920
@@ -307,7 +307,7 @@ p Test of AllToAllv replay with SMPI (one trace for all processes)
 < replay/actions_alltoallv.txt
 $ mkfile replay/one_trace
 
-$ ../../smpi_script/bin/smpirun -ext smpi_replay --log=replay.thresh:critical --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/simulate-computation:no -np 3 -platform ${srcdir:=.}/../platforms/small_platform.xml -hostfile ${srcdir:=.}/hostfile ./replay/smpi_replay replay/one_trace --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ../../smpi_script/bin/smpirun -no-privatize -ext smpi_replay --log=replay.thresh:critical --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/simulate-computation:no -np 3 -platform ${srcdir:=.}/../platforms/small_platform.xml -hostfile ${srcdir:=.}/hostfile ./replay/smpi_replay replay/one_trace --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
 > [Tremblay:0:(1) 0.004000] [smpi_replay/VERBOSE] 0 allToAllV 100 1 40 30 1000 1 80 100 0.004000
 > [Jupiter:1:(2) 0.006935] [smpi_replay/VERBOSE] 1 allToAllV 1000 80 1 40 1000 40 1 30 0.006935
 > [Fafard:2:(3) 0.006936] [smpi_replay/VERBOSE] 2 allToAllV 1000 100 30 1 1000 30 40 1 0.006936
@@ -320,7 +320,7 @@ p Test of AllGatherv replay with SMPI (one trace for all processes)
 < replay/actions_allgatherv.txt
 $ mkfile replay/one_trace
 
-$ ../../smpi_script/bin/smpirun -ext smpi_replay --log=replay.thresh:critical --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/simulate-computation:no -np 4 -platform ${srcdir:=.}/../platforms/small_platform.xml -hostfile ${srcdir:=.}/hostfile ./replay/smpi_replay replay/one_trace --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ../../smpi_script/bin/smpirun -no-privatize -ext smpi_replay --log=replay.thresh:critical --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/simulate-computation:no -np 4 -platform ${srcdir:=.}/../platforms/small_platform.xml -hostfile ${srcdir:=.}/hostfile ./replay/smpi_replay replay/one_trace --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
 > [Tremblay:0:(1) 1.397261] [smpi_replay/VERBOSE] 0 allGatherV 275427 275427 275427 275427 204020 0 0 1.397261
 > [Ginette:3:(4) 1.760421] [smpi_replay/VERBOSE] 3 allGatherV 204020 275427 275427 275427 204020 0 0 1.760421
 > [Fafard:2:(3) 1.941986] [smpi_replay/VERBOSE] 2 allGatherV 275427 275427 275427 275427 204020 0 0 1.941986
@@ -335,7 +335,7 @@ p Test of waitall replay with SMPI (one trace for all processes)
 $ mkfile replay/one_trace
 
 ! output sort 19
-$ ../../smpi_script/bin/smpirun -ext smpi_replay --log=replay.thresh:critical --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/simulate-computation:no -np 3 -platform ${srcdir:=.}/../platforms/small_platform.xml -hostfile ${srcdir:=.}/hostfile ./replay/smpi_replay replay/one_trace --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ../../smpi_script/bin/smpirun -no-privatize -ext smpi_replay --log=replay.thresh:critical --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/simulate-computation:no -np 3 -platform ${srcdir:=.}/../platforms/small_platform.xml -hostfile ${srcdir:=.}/hostfile ./replay/smpi_replay replay/one_trace --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
 > [Fafard:2:(3) 0.000000] [smpi_replay/VERBOSE] 2 Irecv 1 3000 0.000000
 > [Fafard:2:(3) 0.000000] [smpi_replay/VERBOSE] 2 Isend 0 3000 0.000000
 > [Jupiter:1:(2) 0.000000] [smpi_replay/VERBOSE] 1 Isend 0 2000 0.000000
index 97834f1..dcff662 100644 (file)
@@ -88,7 +88,7 @@ Session::Session(pid_t pid, int socket)
 {
   std::unique_ptr<simgrid::mc::RemoteClient> process(new simgrid::mc::RemoteClient(pid, socket));
   // TODO, automatic detection of the config from the process
-  process->privatized(smpi_privatize_global_variables != SMPI_PRIVATIZE_NONE);
+  process->privatized(smpi_privatize_global_variables != SmpiPrivStrategies::None);
   modelChecker_ = std::unique_ptr<ModelChecker>(
     new simgrid::mc::ModelChecker(std::move(process)));
   xbt_assert(mc_model_checker == nullptr);
index f515ae4..9c741c4 100644 (file)
@@ -258,7 +258,7 @@ void Client::declareStack(void* stack, size_t size, smx_actor_t process, ucontex
   region.size    = size;
   region.block   = ((char*)stack - (char*)heap->heapbase) / BLOCKSIZE + 1;
 #if HAVE_SMPI
-  if (smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP && process)
+  if (smpi_privatize_global_variables == SmpiPrivStrategies::Mmap && process)
     region.process_index = process->pid - 1;
   else
 #endif
index be1826f..6664cfa 100644 (file)
@@ -103,7 +103,7 @@ static void segvhandler(int signum, siginfo_t* siginfo, void* /*context*/)
   } else  if (siginfo->si_signo == SIGSEGV) {
     fprintf(stderr, "Segmentation fault.\n");
 #if HAVE_SMPI
-    if (smpi_enabled() && smpi_privatize_global_variables == SMPI_PRIVATIZE_NONE) {
+    if (smpi_enabled() && smpi_privatize_global_variables == SmpiPrivStrategies::None) {
 #if HAVE_PRIVATIZATION
       fprintf(stderr, "Try to enable SMPI variable privatization with --cfg=smpi/privatization:yes.\n");
 #else
index 5173964..5bb015b 100644 (file)
@@ -436,13 +436,8 @@ extern "C" {
 XBT_PUBLIC smpi_trace_call_location_t* smpi_trace_get_call_location();
 }
 
-enum smpi_priv_strategies {
-  SMPI_PRIVATIZE_NONE    = 0,
-  SMPI_PRIVATIZE_MMAP    = 1,
-  SMPI_PRIVATIZE_DLOPEN  = 2,
-  SMPI_PRIVATIZE_DEFAULT = SMPI_PRIVATIZE_DLOPEN
-};
+enum class SmpiPrivStrategies { None = 0, Mmap = 1, Dlopen = 2, Default = Dlopen };
 
-extern XBT_PRIVATE int smpi_privatize_global_variables;
+extern XBT_PRIVATE SmpiPrivStrategies smpi_privatize_global_variables;
 
 #endif
index 52ae841..423fe6e 100644 (file)
@@ -81,7 +81,7 @@ void smpi_execute_benched(double duration)
 
 void smpi_bench_begin()
 {
-  if (smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP) {
+  if (smpi_privatize_global_variables == SmpiPrivStrategies::Mmap) {
     smpi_switch_data_segment(simgrid::s4u::Actor::self());
   }
 
index b52f69a..81cadf5 100644 (file)
@@ -189,7 +189,8 @@ void smpi_comm_copy_buffer_callback(smx_activity_t synchro, void *buff, size_t b
   auto private_blocks = merge_private_blocks(src_private_blocks, dst_private_blocks);
   check_blocks(private_blocks, buff_size);
   void* tmpbuff=buff;
-  if ((smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP) && (static_cast<char*>(buff) >= smpi_data_exe_start) &&
+  if ((smpi_privatize_global_variables == SmpiPrivStrategies::Mmap) &&
+      (static_cast<char*>(buff) >= smpi_data_exe_start) &&
       (static_cast<char*>(buff) < smpi_data_exe_start + smpi_data_exe_size)) {
     XBT_DEBUG("Privatization : We are copying from a zone inside global memory... Saving data to temp buffer !");
     smpi_switch_data_segment(comm->src_proc->iface());
@@ -197,7 +198,7 @@ void smpi_comm_copy_buffer_callback(smx_activity_t synchro, void *buff, size_t b
     memcpy_private(tmpbuff, buff, private_blocks);
   }
 
-  if ((smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP) && ((char*)comm->dst_buff >= smpi_data_exe_start) &&
+  if ((smpi_privatize_global_variables == SmpiPrivStrategies::Mmap) && ((char*)comm->dst_buff >= smpi_data_exe_start) &&
       ((char*)comm->dst_buff < smpi_data_exe_start + smpi_data_exe_size)) {
     XBT_DEBUG("Privatization : We are copying to a zone inside global memory - Switch data segment");
     smpi_switch_data_segment(comm->dst_proc->iface());
@@ -355,7 +356,7 @@ void smpi_global_destroy()
     xbt_os_timer_free(global_timer);
   }
 
-  if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP)
+  if (smpi_privatize_global_variables == SmpiPrivStrategies::Mmap)
     smpi_destroy_global_memory_segments();
   smpi_free_static();
 }
@@ -371,21 +372,25 @@ static void smpi_init_options(){
   xbt_assert(smpi_host_speed >= 0, "You're trying to set the host_speed to a negative value (%f)", smpi_host_speed);
   std::string smpi_privatize_option                = xbt_cfg_get_string("smpi/privatization");
   if (smpi_privatize_option == "no" || smpi_privatize_option == "0")
-    smpi_privatize_global_variables = SMPI_PRIVATIZE_NONE;
+    smpi_privatize_global_variables = SmpiPrivStrategies::None;
   else if (smpi_privatize_option == "yes" || smpi_privatize_option == "1")
-    smpi_privatize_global_variables = SMPI_PRIVATIZE_DEFAULT;
+    smpi_privatize_global_variables = SmpiPrivStrategies::Default;
   else if (smpi_privatize_option == "mmap")
-    smpi_privatize_global_variables = SMPI_PRIVATIZE_MMAP;
+    smpi_privatize_global_variables = SmpiPrivStrategies::Mmap;
   else if (smpi_privatize_option == "dlopen")
-    smpi_privatize_global_variables = SMPI_PRIVATIZE_DLOPEN;
+    smpi_privatize_global_variables = SmpiPrivStrategies::Dlopen;
   else
     xbt_die("Invalid value for smpi/privatization: '%s'", smpi_privatize_option.c_str());
 
+  if (not SMPI_switch_data_segment) {
+    XBT_DEBUG("Running without smpi_main(); disable smpi/privatization.");
+    smpi_privatize_global_variables = SmpiPrivStrategies::None;
+  }
 #if defined(__FreeBSD__)
-    if (smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP) {
-      XBT_INFO("mmap privatization is broken on FreeBSD, switching to dlopen privatization instead.");
-      smpi_privatize_global_variables = SMPI_PRIVATIZE_DLOPEN;
-    }
+  if (smpi_privatize_global_variables == SmpiPrivStrategies::Mmap) {
+    XBT_INFO("mmap privatization is broken on FreeBSD, switching to dlopen privatization instead.");
+    smpi_privatize_global_variables = SmpiPrivStrategies::Dlopen;
+  }
 #endif
 
     if (smpi_cpu_threshold < 0)
@@ -475,7 +480,7 @@ int smpi_main(const char* executable, int argc, char *argv[])
   SIMIX_comm_set_copy_data_callback(smpi_comm_copy_buffer_callback);
 
   smpi_init_options();
-  if (smpi_privatize_global_variables == SMPI_PRIVATIZE_DLOPEN) {
+  if (smpi_privatize_global_variables == SmpiPrivStrategies::Dlopen) {
 
     std::string executable_copy = executable;
 
@@ -499,13 +504,13 @@ int smpi_main(const char* executable, int argc, char *argv[])
         int fdout = open(target_executable.c_str(), O_CREAT | O_RDWR, S_IRWXU);
         xbt_assert(fdout >= 0, "Cannot write into %s", target_executable.c_str());
 
+        XBT_DEBUG("Copy %ld bytes into %s", static_cast<long>(fdin_size), target_executable.c_str());
 #if HAVE_SENDFILE
         ssize_t sent_size = sendfile(fdout, fdin, NULL, fdin_size);
         xbt_assert(sent_size == fdin_size,
                    "Error while copying %s: only %zd bytes copied instead of %ld (errno: %d -- %s)",
                    target_executable.c_str(), sent_size, fdin_size, errno, strerror(errno));
 #else
-        XBT_VERB("Copy %d bytes into %s", static_cast<int>(fdin_size), target_executable.c_str());
         const int bufsize = 1024 * 1024 * 4;
         char buf[bufsize];
         while (int got = read(fdin, buf, bufsize)) {
@@ -619,7 +624,7 @@ void SMPI_init(){
   smpi_check_options();
   TRACE_smpi_alloc();
   simgrid::s4u::onSimulationEnd.connect(TRACE_smpi_release);
-  if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP)
+  if (smpi_privatize_global_variables == SmpiPrivStrategies::Mmap)
     smpi_backup_global_memory_segment();
 }
 
index e704823..a6ea8dd 100644 (file)
@@ -30,7 +30,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_memory, smpi, "Memory layout support for SM
 int smpi_loaded_page      = -1;
 char* smpi_data_exe_start = nullptr;
 int smpi_data_exe_size    = 0;
-int smpi_privatize_global_variables;
+SmpiPrivStrategies smpi_privatize_global_variables;
 static void* smpi_data_exe_copy;
 
 // We keep a copy of all the privatization regions: We can then delete everything easily by iterating over this
@@ -148,7 +148,7 @@ void smpi_backup_global_memory_segment()
   XBT_DEBUG("bss+data segment found : size %d starting at %p", smpi_data_exe_size, smpi_data_exe_start);
 
   if (smpi_data_exe_size == 0) { // no need to do anything as global variables don't exist
-    smpi_privatize_global_variables=false;
+    smpi_privatize_global_variables = SmpiPrivStrategies::None;
     return;
   }
 
@@ -157,7 +157,7 @@ void smpi_backup_global_memory_segment()
   // of the simulation and can be used to initialize a dynamically added, new process.
   asan_safe_memcpy(smpi_data_exe_copy, TOPAGE(smpi_data_exe_start), smpi_data_exe_size);
 #else /* ! HAVE_PRIVATIZATION */
-  smpi_privatize_global_variables = false;
+  smpi_privatize_global_variables = SmpiPrivStrategies::None;
   xbt_die("You are trying to use privatization on a system that does not support it. Don't.");
   return;
 #endif
index dc1c516..b4f2dd8 100644 (file)
@@ -262,7 +262,7 @@ void Process::init(int *argc, char ***argv){
     // cheinrich: I'm not sure what the impact of the SMPI_switch_data_segment on this call is. I moved
     // this up here so that I can set the privatized region before the switch.
     Process* process = smpi_process_remote(proc);
-    if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP){
+    if (smpi_privatize_global_variables == SmpiPrivStrategies::Mmap) {
       /* Now using the segment index of this process  */
       process->set_privatized_region(smpi_init_global_memory_segment_process());
       /* Done at the process's creation */
index c256f12..1183cac 100644 (file)
@@ -56,7 +56,8 @@ void Comm::destroy(Comm* comm)
 }
 
 int Comm::dup(MPI_Comm* newcomm){
-  if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP){ //we need to switch as the called function may silently touch global variables
+  if (smpi_privatize_global_variables == SmpiPrivStrategies::Mmap) {
+    // we need to switch as the called function may silently touch global variables
     smpi_switch_data_segment(simgrid::s4u::Actor::self());
   }
   MPI_Group cp = new  Group(this->group());
@@ -299,7 +300,8 @@ void Comm::init_smp(){
     smpi_process()->set_replaying(false);
   }
 
-  if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP){ //we need to switch as the called function may silently touch global variables
+  if (smpi_privatize_global_variables == SmpiPrivStrategies::Mmap) {
+    // we need to switch as the called function may silently touch global variables
     smpi_switch_data_segment(simgrid::s4u::Actor::self());
   }
   //identify neighbours in comm
@@ -335,7 +337,8 @@ void Comm::init_smp(){
 
   Coll_allgather_mpich::allgather(&leader, 1, MPI_INT , leaders_map, 1, MPI_INT, this);
 
-  if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP){ //we need to switch as the called function may silently touch global variables
+  if (smpi_privatize_global_variables == SmpiPrivStrategies::Mmap) {
+    // we need to switch as the called function may silently touch global variables
     smpi_switch_data_segment(simgrid::s4u::Actor::self());
   }
 
@@ -407,7 +410,8 @@ void Comm::init_smp(){
   }
   Coll_bcast_mpich::bcast(&(is_uniform_),1, MPI_INT, 0, comm_intra );
 
-  if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP){ //we need to switch as the called function may silently touch global variables
+  if (smpi_privatize_global_variables == SmpiPrivStrategies::Mmap) {
+    // we need to switch as the called function may silently touch global variables
     smpi_switch_data_segment(simgrid::s4u::Actor::self());
   }
   // Are the ranks blocked ? = allocated contiguously on the SMP nodes
index de11260..a17f42e 100644 (file)
@@ -294,7 +294,7 @@ int Datatype::copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
 // FIXME Handle the case of a partial shared malloc.
 
-  if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP){
+  if (smpi_privatize_global_variables == SmpiPrivStrategies::Mmap) {
     smpi_switch_data_segment(simgrid::s4u::Actor::self());
   }
   /* First check if we really have something to do */
index 521f9b0..0cc6659 100644 (file)
@@ -240,7 +240,8 @@ void Op::set_fortran_op()
 
 void Op::apply(void *invec, void *inoutvec, int *len, MPI_Datatype datatype)
 {
-  if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP){//we need to switch as the called function may silently touch global variables
+  if (smpi_privatize_global_variables == SmpiPrivStrategies::Mmap) {
+    // we need to switch as the called function may silently touch global variables
     XBT_DEBUG("Applying operation, switch to the right data frame ");
     smpi_switch_data_segment(simgrid::s4u::Actor::self());
   }
index 30feded..c0bd4f6 100644 (file)
@@ -411,7 +411,8 @@ void Request::start()
       if (not(old_type_->flags() & DT_FLAG_DERIVED)) {
         oldbuf = buf_;
         if (not process->replaying() && oldbuf != nullptr && size_ != 0) {
-          if ((smpi_privatize_global_variables != 0) && (static_cast<char*>(buf_) >= smpi_data_exe_start) &&
+          if ((smpi_privatize_global_variables != SmpiPrivStrategies::None) &&
+              (static_cast<char*>(buf_) >= smpi_data_exe_start) &&
               (static_cast<char*>(buf_) < smpi_data_exe_start + smpi_data_exe_size)) {
             XBT_DEBUG("Privatization : We are sending from a zone inside global memory. Switch data segment ");
             smpi_switch_data_segment(simgrid::s4u::Actor::byPid(src_));
@@ -705,7 +706,7 @@ void Request::finish_wait(MPI_Request* request, MPI_Status * status)
     if (((req->flags_ & ACCUMULATE) != 0) ||
         (datatype->flags() & DT_FLAG_DERIVED)) { // && (not smpi_is_shared(req->old_buf_))){
 
-      if (not smpi_process()->replaying() && smpi_privatize_global_variables != 0 &&
+      if (not smpi_process()->replaying() && smpi_privatize_global_variables != SmpiPrivStrategies::None &&
           static_cast<char*>(req->old_buf_) >= smpi_data_exe_start &&
           static_cast<char*>(req->old_buf_) < smpi_data_exe_start + smpi_data_exe_size) {
         XBT_VERB("Privatization : We are unserializing to a zone in global memory  Switch data segment ");
index a269cd8..dbb5313 100644 (file)
@@ -33,8 +33,8 @@ trap 'cleanup' EXIT
 
 filter_and_compile() {
     list_add TMPFILES "${TMPFILE}"
-    #replace "program main_name by subroutine user\_main (and the end clause as well)"
-    sed 's/[[:space:]]*[pP][rR][oO][gG][rR][aA][mM][[:space:]][[:space:]]*\([a-zA-Z0-9\-\_]*\)/ subroutine user\_main /g' "${ARG}" > "${TMPFILE}"
+    #replace "program main_name by subroutine user_main (and the end clause as well)"
+    sed 's/[[:space:]]*[pP][rR][oO][gG][rR][aA][mM][[:space:]][[:space:]]*\([a-zA-Z0-9_]*\)/ subroutine user_main /g' "${ARG}" > "${TMPFILE}"
     SRCFILE="${TMPFILE}"
     list_add CMDLINE "${SRCFILE}"
 }
index 5fafa51..eeefe89 100644 (file)
@@ -33,23 +33,23 @@ trap 'cleanup' EXIT
 
 filter_and_compile_f77() {
     list_add TMPFILES "${TMPFILE}"
-    #replace "program main_name by subroutine user\_main (and the end clause as well)"
+    #replace "program main_name by subroutine user_main (and the end clause as well)"
     if [ $TRACE_CALL_LOCATION -gt 0 ]; then
       echo "#include \"@includedir@/smpi/smpi_extended_traces_fortran.h\"" > ${TMPFILE}
       echo "#line 1 \"${ARG}\"" >> ${TMPFILE}
     fi
-    sed 's/[[:space:]]\{6\}[[:space:]]*\([eE][nN][dD] \)\{0,1\}[pP][rR][oO][gG][rR][aA][mM][[:space:]][[:space:]]*\([a-zA-Z0-9\-\_]*\)/      \1subroutine user_main /g' "${ARG}" >> "${TMPFILE}"
+    sed 's/[[:space:]]\{6\}[[:space:]]*\([eE][nN][dD] \)\{0,1\}[pP][rR][oO][gG][rR][aA][mM][[:space:]][[:space:]]*\([a-zA-Z0-9_]*\)/      \1subroutine user_main /g' "${ARG}" >> "${TMPFILE}"
     SRCFILE="${TMPFILE}"
     list_add CMDLINE "${SRCFILE}"
 }
 filter_and_compile_f90() {
     list_add TMPFILES "${TMPFILE}"
-    #replace "program main_name by subroutine user\_main (and the end clause as well)"
+    #replace "program main_name by subroutine user_main (and the end clause as well)"
     if [ $TRACE_CALL_LOCATION -gt 0 ]; then
       echo "#include \"@includedir@/smpi/smpi_extended_traces_fortran.h\"" > ${TMPFILE}
       echo "#line 1 \"${ARG}\"" >> ${TMPFILE}
     fi
-    sed 's/[[:space:]]*[pP][rR][oO][gG][rR][aA][mM][[:space:]][[:space:]]*\([a-zA-Z0-9\-\_]*\)/ subroutine user\_main /g' "${ARG}" > "${TMPFILE}"
+    sed 's/[[:space:]]*[pP][rR][oO][gG][rR][aA][mM][[:space:]][[:space:]]*\([a-zA-Z0-9_]*\)/ subroutine user_main /g' "${ARG}" > "${TMPFILE}"
     SRCFILE="${TMPFILE}"
     list_add CMDLINE "${SRCFILE}"
 }
index a3ce858..b8daa19 100755 (executable)
@@ -158,7 +158,7 @@ while true; do
             shift 2
             ;;
        "-no-privatize")
-           PRIVATIZE=""
+           PRIVATIZE="--cfg=smpi/privatization:no"
            shift 1
            ;;
         "-map")
index 0b61a90..8bc9e2a 100644 (file)
@@ -34,7 +34,7 @@ $ ${bindir:=.}/../../../smpi_script/bin/smpirun -trace-ti --cfg=tracing/filename
 > [rank 2] -> Fafard
 > [rank 3] -> Ginette
 
-$ ${bindir:=.}/../../../smpi_script/bin/smpirun -ext smpi_replay --log=replay.:critical -trace-ti --cfg=tracing/filename:out_ti.txt --cfg=smpi/simulate-computation:no -map -hostfile ${srcdir:=.}/../hostfile -platform ${srcdir:=.}/../../../examples/platforms/small_platform.xml -np 4 ${bindir:=.}/../../../examples/smpi/replay/smpi_replay ./out_in_ti.txt --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -no-privatize -ext smpi_replay --log=replay.:critical -trace-ti --cfg=tracing/filename:out_ti.txt --cfg=smpi/simulate-computation:no -map -hostfile ${srcdir:=.}/../hostfile -platform ${srcdir:=.}/../../../examples/platforms/small_platform.xml -np 4 ${bindir:=.}/../../../examples/smpi/replay/smpi_replay ./out_in_ti.txt --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
 > [rank 0] -> Tremblay
 > [rank 1] -> Jupiter
 > [rank 2] -> Fafard
@@ -125,7 +125,7 @@ $ ${bindir:=.}/../../../smpi_script/bin/smpirun -trace-ti --cfg=tracing/filename
 > [rank 2] -> Fafard
 > [rank 3] -> Ginette
 
-$ ${bindir:=.}/../../../smpi_script/bin/smpirun -ext smpi_replay --log=replay.:critical -trace-ti --cfg=tracing/filename:out_ti.txt --cfg=tracing/smpi/format/ti-one-file:yes -map -hostfile ${srcdir:=.}/../hostfile -platform ${srcdir:=.}/../../../examples/platforms/small_platform.xml -np 4 ${bindir:=.}/../../../examples/smpi/replay/smpi_replay ./out_in_ti.txt --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -no-privatize -ext smpi_replay --log=replay.:critical -trace-ti --cfg=tracing/filename:out_ti.txt --cfg=tracing/smpi/format/ti-one-file:yes -map -hostfile ${srcdir:=.}/../hostfile -platform ${srcdir:=.}/../../../examples/platforms/small_platform.xml -np 4 ${bindir:=.}/../../../examples/smpi/replay/smpi_replay ./out_in_ti.txt --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
 > [rank 0] -> Tremblay
 > [rank 1] -> Jupiter
 > [rank 2] -> Fafard