Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Intercept exit() to avoid killing simulations too early, as the first process exits.
authorAugustin Degomme <adegomme@users.noreply.github.com>
Sun, 26 Sep 2021 22:24:00 +0000 (00:24 +0200)
committerAugustin Degomme <adegomme@users.noreply.github.com>
Sun, 26 Sep 2021 22:24:00 +0000 (00:24 +0200)
This should render previous warning pointless, let's see it it's still needed.

ChangeLog
include/smpi/smpi_helpers.h
include/smpi/smpi_helpers_internal.h
src/smpi/internals/smpi_global.cpp
teshsuite/smpi/pt2pt-dsend/pt2pt-dsend.tesh

index 13e0736..5b77831 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -28,6 +28,9 @@ SMPI:
    - scan/excan can now be replayed
    - wait action now uses ranks and not pid, as the other ones.
    - smpi/init and smpi/finalization-barrier are now valid for replays.
    - scan/excan can now be replayed
    - wait action now uses ranks and not pid, as the other ones.
    - smpi/init and smpi/finalization-barrier are now valid for replays.
+ - exit() is now intercepted by SMPI to avoid premature shutdown of
+   simulation. First non 0 return codes is returned as simulation return
+   code.
 
 Documentation:
   * New section "Release Notes" documenting recent and current developments.
 
 Documentation:
   * New section "Release Notes" documenting recent and current developments.
index ef7492d..8ecd7f5 100644 (file)
@@ -38,4 +38,6 @@
 #define realloc(x, y) smpi_shared_realloc_intercept((x), (y), __FILE__, __LINE__)
 #define free(x) smpi_shared_free(x)
 #endif
 #define realloc(x, y) smpi_shared_realloc_intercept((x), (y), __FILE__, __LINE__)
 #define free(x) smpi_shared_free(x)
 #endif
+
+#define exit(x) smpi_exit(x)
 #endif
 #endif
index 25a4f70..929d22e 100644 (file)
@@ -38,6 +38,7 @@ void* smpi_shared_malloc_intercept(size_t size, const char* file, int line);
 void* smpi_shared_calloc_intercept(size_t num_elm, size_t elem_size, const char* file, int line);
 void* smpi_shared_realloc_intercept(void* data, size_t size, const char* file, int line);
 void smpi_shared_free(void* data);
 void* smpi_shared_calloc_intercept(size_t num_elm, size_t elem_size, const char* file, int line);
 void* smpi_shared_realloc_intercept(void* data, size_t size, const char* file, int line);
 void smpi_shared_free(void* data);
+void smpi_exit(int status);
 #ifdef __cplusplus
 } // extern "C"
 #endif
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 674cfed..13c6a3b 100644 (file)
@@ -635,3 +635,9 @@ void SMPI_thread_create() {
   TRACE_smpi_init(simgrid::s4u::this_actor::get_pid(), __func__);
   smpi_process()->mark_as_initialized();
 }
   TRACE_smpi_init(simgrid::s4u::this_actor::get_pid(), __func__);
   smpi_process()->mark_as_initialized();
 }
+
+void smpi_exit(int x){
+  if(x!=0)
+    smpi_exit_status = x;
+  return;
+}
index 713e541..11476da 100644 (file)
@@ -3,7 +3,6 @@ p Test dsend
 $ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ${bindir:=.}/../hostfile -platform ${platfdir}/small_platform.xml -np 2 --log=no_loc ${bindir:=.}/pt2pt-dsend -s --long --log=smpi_config.thres:warning --log=xbt_cfg.thres:warning --cfg=smpi/simulate-computation:no --cfg=smpi/finalization-barrier:on
 > [Jupiter:1:(2) 0.000000] [dsend/INFO] rank 1: data exchanged
 > [Tremblay:0:(1) 0.005896] [dsend/INFO] rank 0: data exchanged
 $ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ${bindir:=.}/../hostfile -platform ${platfdir}/small_platform.xml -np 2 --log=no_loc ${bindir:=.}/pt2pt-dsend -s --long --log=smpi_config.thres:warning --log=xbt_cfg.thres:warning --cfg=smpi/simulate-computation:no --cfg=smpi/finalization-barrier:on
 > [Jupiter:1:(2) 0.000000] [dsend/INFO] rank 1: data exchanged
 > [Tremblay:0:(1) 0.005896] [dsend/INFO] rank 0: data exchanged
-> [Tremblay:0:(1) 0.008843] [ker_engine/WARNING] Process called exit when leaving - Skipping cleanups
 > [0.000000] [smpi/INFO] [rank 0] -> Tremblay
 > [0.000000] [smpi/INFO] [rank 1] -> Jupiter
 
 > [0.000000] [smpi/INFO] [rank 0] -> Tremblay
 > [0.000000] [smpi/INFO] [rank 1] -> Jupiter
 
@@ -14,7 +13,6 @@ p process 2 will finish at 0.5+2*4 (time before first send) + 2*(1+0.5*4) (recv+
 ! output sort
 $ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ${bindir:=.}/../hostfile -platform ${platfdir}/small_platform.xml -np 2 --log=no_loc ${bindir:=.}/pt2pt-dsend -s --long --log=smpi_config.thres:warning --cfg=smpi/or:0:1:0.5 --cfg=smpi/os:0:0.5:2 --cfg=smpi/ois:0:1:0.1 --cfg=smpi/simulate-computation:no --cfg=smpi/finalization-barrier:on --log=xbt_cfg.thres:warning
 > [Jupiter:1:(2) 9.900000] [dsend/INFO] rank 1: data exchanged
 ! output sort
 $ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ${bindir:=.}/../hostfile -platform ${platfdir}/small_platform.xml -np 2 --log=no_loc ${bindir:=.}/pt2pt-dsend -s --long --log=smpi_config.thres:warning --cfg=smpi/or:0:1:0.5 --cfg=smpi/os:0:0.5:2 --cfg=smpi/ois:0:1:0.1 --cfg=smpi/simulate-computation:no --cfg=smpi/finalization-barrier:on --log=xbt_cfg.thres:warning
 > [Jupiter:1:(2) 9.900000] [dsend/INFO] rank 1: data exchanged
-> [Tremblay:0:(1) 16.508843] [ker_engine/WARNING] Process called exit when leaving - Skipping cleanups
 > [Tremblay:0:(1) 14.505896] [dsend/INFO] rank 0: data exchanged
 > [0.000000] [smpi/INFO] [rank 0] -> Tremblay
 > [0.000000] [smpi/INFO] [rank 1] -> Jupiter
 > [Tremblay:0:(1) 14.505896] [dsend/INFO] rank 0: data exchanged
 > [0.000000] [smpi/INFO] [rank 0] -> Tremblay
 > [0.000000] [smpi/INFO] [rank 1] -> Jupiter