Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[SMPI] Die more peacefully when a process calls exit or stop, either before or after...
authordegomme <augustin.degomme@unibas.ch>
Tue, 14 Jun 2016 00:23:24 +0000 (02:23 +0200)
committerdegomme <augustin.degomme@unibas.ch>
Tue, 14 Jun 2016 00:23:24 +0000 (02:23 +0200)
src/simix/smx_global.cpp

index e242207..7643bdd 100644 (file)
@@ -264,6 +264,18 @@ int smx_cleaned = 0;
 void SIMIX_clean(void)
 {
   if (smx_cleaned) return; // to avoid double cleaning by java and C
 void SIMIX_clean(void)
 {
   if (smx_cleaned) return; // to avoid double cleaning by java and C
+
+#if HAVE_SMPI
+  if (SIMIX_process_count()>0){
+    if(smpi_process_initialized()){
+      xbt_die("Process exited without calling MPI_Finalize - Killing simulation");
+    }else{
+      XBT_WARN("Process called exit when leaving - Skipping cleanups");
+      return;
+    }
+  }
+#endif
+
   smx_cleaned = 1;
   XBT_DEBUG("SIMIX_clean called. Simulation's over.");
   if (!xbt_dynar_is_empty(simix_global->process_to_run) && SIMIX_get_clock() == 0.0) {
   smx_cleaned = 1;
   XBT_DEBUG("SIMIX_clean called. Simulation's over.");
   if (!xbt_dynar_is_empty(simix_global->process_to_run) && SIMIX_get_clock() == 0.0) {