From: Martin Quinson Date: Wed, 3 May 2017 00:10:34 +0000 (+0200) Subject: New option: smpi/keep-temps to not cleanup temp files X-Git-Tag: v3.16~288 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/5193d31089b0e9d2a564d425f61fdbc27e01af60 New option: smpi/keep-temps to not cleanup temp files (fix #160) --- diff --git a/ChangeLog b/ChangeLog index 0f6fda80d4..0fc46d7f3d 100644 --- 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(): diff --git a/doc/doxygen/options.doc b/doc/doxygen/options.doc index 65087f93a4..d75d27e153 100644 --- a/doc/doxygen/options.doc +++ b/doc/doxygen/options.doc @@ -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 diff --git a/src/simgrid/sg_config.cpp b/src/simgrid/sg_config.cpp index ede4743c4b..9b99689e4d 100644 --- a/src/simgrid/sg_config.cpp +++ b/src/simgrid/sg_config.cpp @@ -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"); diff --git a/src/smpi/smpi_global.cpp b/src/smpi/smpi_global.cpp index 0ae9822500..7f62db8e9e 100644 --- a/src/smpi/smpi_global.cpp +++ b/src/smpi/smpi_global.cpp @@ -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); diff --git a/src/smpi/smpirun.in b/src/smpi/smpirun.in index 7c83e0f301..5d962e4e4a 100755 --- a/src/smpi/smpirun.in +++ b/src/smpi/smpirun.in @@ -206,6 +206,7 @@ while true; do ;; "-keep-temps") KEEP="true" + SIMOPTS="$SIMOPTS --cfg=smpi/keep-temps:yes" shift 1 ;; "-wrapper")