Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Avoid multiple initializations for active_processes.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sun, 8 Apr 2018 16:58:13 +0000 (18:58 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sun, 8 Apr 2018 21:26:08 +0000 (23:26 +0200)
Fixes a memory leak seen with smpi-replay-multiple
(smpi_free_replay_tmp_buffers() was not called).

examples/smpi/replay_multiple/replay_multiple.tesh
src/smpi/internals/smpi_replay.cpp

index abdf3cc..9ca0587 100644 (file)
@@ -10,4 +10,5 @@ $ ./replay_multiple description_file ${srcdir:=.}/../../platforms/small_platform
 > [0.000000] [smpi_kernel/INFO] You did not set the power of the host running the simulation.  The timings will certainly not be accurate.  Use the option "--cfg=smpi/host-speed:<flops>" to set its value.Check http://simgrid.org/simgrid/latest/doc/options.html#options_smpi_bench for more information.
 > [0.000000] [msg_test/INFO] Initializing instance 1 of size 32
 > [0.000000] [msg_test/INFO] Initializing instance 2 of size 32
+> [Ginette:2:(34) 37298.251477] [smpi_replay/INFO] Simulation time 10442.494756
 > [37298.251477] [msg_test/INFO] Simulation time 37298.3
index 40f5cdb..1aca704 100644 (file)
@@ -22,7 +22,6 @@ using simgrid::s4u::Actor;
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_replay,smpi,"Trace Replay with SMPI");
 
-static int active_processes  = 0;
 static std::unordered_map<int, std::vector<MPI_Request>*> reqq;
 
 static MPI_Datatype MPI_DEFAULT_TYPE;
@@ -566,9 +565,6 @@ public:
 
     /* start a simulated timer */
     smpi_process()->simulated_start();
-    /*initialize the number of active processes */
-    active_processes = smpi_process_count();
-
     set_reqq_self(new std::vector<MPI_Request>);
   }
 };
@@ -860,6 +856,8 @@ void smpi_replay_init(int* argc, char*** argv)
 /** @brief actually run the replay after initialization */
 void smpi_replay_main(int* argc, char*** argv)
 {
+  static int active_processes = 0;
+  active_processes++;
   simgrid::xbt::replay_runner(*argc, *argv);
 
   /* and now, finalize everything */