Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
New option: smpi/keep-temps to not cleanup temp files
authorMartin Quinson <martin.quinson@loria.fr>
Wed, 3 May 2017 00:10:34 +0000 (02:10 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Wed, 3 May 2017 00:10:39 +0000 (02:10 +0200)
(fix #160)

ChangeLog
doc/doxygen/options.doc
src/simgrid/sg_config.cpp
src/smpi/smpi_global.cpp
src/smpi/smpirun.in

index 0f6fda8..0fc46d7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,8 +7,9 @@ SimDag
    simulation round, s/he has to allocate and free a dynar and use it as argument 
    to this function. The former SD_simulate (double how_long) now returns void.
 
-SMPI
- - New algorithm to privatize globals: dlopen, with dynamic loading tricks
+ SMPI
+  - New algorithm to privatize globals: dlopen, with dynamic loading tricks
+  - New option: smpi/keep-temps to not cleanup temp files
 
  XBT/Replay:
   - New function xbt_replay_action_get():
index 65087f9..d75d27e 100644 (file)
@@ -850,6 +850,16 @@ to 1, \c smpirun will display this information when the simulation ends. \verbat
 Simulation time: 1e3 seconds.
 \endverbatim
 
+\subsection options_smpi_temps smpi/keep-temps: not cleaning up after simulation
+
+\b Default: 0 (false)
+
+Under some conditions, SMPI generates a lot of temporary files.  They
+usually get cleaned, but you may use this option to not erase these
+files. This is for example useful when debugging or profiling
+executions using the dlopen privatization schema, as missing binary
+files tend to fool the debuggers.
+
 \subsection options_model_smpi_lat_factor smpi/lat-factor: Latency factors
 
 The motivation and syntax for this option is identical to the motivation/syntax
@@ -1254,6 +1264,7 @@ It can be done by using XBT. Go to \ref XBT_log for more details.
 - \c smpi/iprobe: \ref options_model_smpi_iprobe
 - \c smpi/iprobe-cpu-usage: \ref options_model_smpi_iprobe_cpu_usage
 - \c smpi/init: \ref options_model_smpi_init
+- \c smpi/keep-temps: \ref options_smpi_temps
 - \c smpi/lat-factor: \ref options_model_smpi_lat_factor
 - \c smpi/ois: \ref options_model_smpi_ois
 - \c smpi/or: \ref options_model_smpi_or
index ede4743..9b99689 100644 (file)
@@ -472,6 +472,8 @@ void sg_config_init(int *argc, char **argv)
     xbt_cfg_register_alias("smpi/host-speed","smpi/running_power");
     xbt_cfg_register_alias("smpi/host-speed","smpi/running-power");
 
+    xbt_cfg_register_boolean("smpi/keep-temps", "no", nullptr, "Whether we should keep the generated temporary files.");
+
     xbt_cfg_register_boolean("smpi/display-timing", "no", nullptr, "Whether we should display the timing after simulation.");
     xbt_cfg_register_alias("smpi/display-timing", "smpi/display_timing");
 
index 0ae9822..7f62db8 100644 (file)
@@ -606,7 +606,8 @@ int smpi_main(const char* executable, int argc, char *argv[])
 
         // Load the copy and resolve the entry point:
         void* handle = dlopen(target_executable.c_str(), RTLD_LAZY | RTLD_LOCAL | RTLD_DEEPBIND);
-        unlink(target_executable.c_str());
+        if (xbt_cfg_get_boolean("smpi/keep-temps") == false)
+          unlink(target_executable.c_str());
         if (handle == nullptr)
           xbt_die("dlopen failed: %s (errno: %d -- %s)", dlerror(), errno, strerror(errno));
         smpi_entry_point_type entry_point = smpi_resolve_function(handle);
index 7c83e0f..5d962e4 100755 (executable)
@@ -206,6 +206,7 @@ while true; do
             ;;
         "-keep-temps")
            KEEP="true"
+           SIMOPTS="$SIMOPTS --cfg=smpi/keep-temps:yes"
             shift 1
             ;;
         "-wrapper")