also disable this behavior for MPI_Iprobe.
-\subsection options_model_smpi_use_shared_malloc smpi/use-shared-malloc: Factorize malloc()s
+\subsection options_model_smpi_shared_malloc smpi/shared-malloc: Factorize malloc()s
-\b Default: 1
+\b Default: yes
+
+If your simulation consumes too much memory, you may want to modify
+your code so that the working areas are shared by all MPI ranks. For
+example, in a bloc-cyclic matrix multiplication, you will only
+allocate one set of blocs, and every processes will share them.
+Naturally, this will lead to very wrong results, but this will save a
+lot of memory so this is still desirable for some studies. For more on
+the motivation for that feature, please refer to the
+<a href="https://simgrid.github.io/SMPI_CourseWare/topic_understanding_performance/matrixmultiplication/">relevant
+section</a> of the SMPI CourseWare (see Activity #2.2 of the pointed
+assignment).
SMPI can use shared memory by calling shm_* functions; this might speed up the simulation.
This opens or creates a new POSIX shared memory object, kept in RAM, in /dev/shm.
-If you want to disable this behavior, set the value to 0.
+If you want to disable this behavior (for example for debugging
+purposes), set its value to "no" or "0".
+
\subsection options_model_smpi_wtime smpi/wtime: Inject constant times for calls to MPI_Wtime
- \c smpi/papi-events: \ref options_smpi_papi_events
- \c smpi/privatize-global-variables: \ref options_smpi_global
- \c smpi/send-is-detached-thresh: \ref options_model_smpi_detached
+- \c smpi/shared-malloc: \ref options_model_smpi_shared_malloc
- \c smpi/simulate-computation: \ref options_smpi_bench
- \c smpi/test: \ref options_model_smpi_test
-- \c smpi/use-shared-malloc: \ref options_model_smpi_use_shared_malloc
- \c smpi/wtime: \ref options_model_smpi_wtime
- \c <b>Tracing configuration options can be found in Section \ref tracing_tracing_options</b>.
xbt_cfg_register_boolean("smpi/simulate-computation", "yes", nullptr, "Whether the computational part of the simulated application should be simulated.");
xbt_cfg_register_alias("smpi/simulate-computation","smpi/simulate_computation");
- xbt_cfg_register_boolean("smpi/use-shared-malloc", "yes", nullptr, "Whether SMPI_SHARED_MALLOC is enabled. Disable it for debugging purposes.");
- xbt_cfg_register_alias("smpi/use-shared-malloc", "smpi/use_shared_malloc");
+ xbt_cfg_register_boolean("smpi/shared-malloc", "yes", nullptr,
+ "Whether SMPI_SHARED_MALLOC is enabled. Disable it for debugging purposes.");
+ xbt_cfg_register_alias("smpi/shared-malloc", "smpi/use-shared-malloc");
+ xbt_cfg_register_alias("smpi/shared-malloc", "smpi/use_shared_malloc");
xbt_cfg_register_double("smpi/cpu-threshold", 1e-6, nullptr, "Minimal computation time (in seconds) not discarded, or -1 for infinity.");
xbt_cfg_register_alias("smpi/cpu-threshold", "smpi/cpu_threshold");
extern XBT_PRIVATE bool smpi_privatize_global_variables;
extern XBT_PRIVATE char* smpi_start_data_exe; //start of the data+bss segment of the executable
extern XBT_PRIVATE int smpi_size_data_exe; //size of the data+bss segment of the executable
+extern XBT_PRIVATE bool smpi_cfg_shared_malloc; // Whether to activate shared malloc
XBT_PRIVATE void smpi_switch_data_segment(int dest);
XBT_PRIVATE void smpi_really_switch_data_segment(int dest);
char* smpi_start_data_exe = nullptr;
int smpi_size_data_exe = 0;
bool smpi_privatize_global_variables;
+bool smpi_cfg_shared_malloc = true;
double smpi_total_benched_time = 0;
smpi_privatisation_region_t smpi_privatisation_regions;
void *smpi_shared_malloc(size_t size, const char *file, int line)
{
void* mem;
- if (size > 0 && xbt_cfg_get_boolean("smpi/use-shared-malloc")){
+ if (size > 0 && smpi_cfg_shared_malloc) {
int fd;
smpi_source_location loc(file, line);
auto res = allocs.insert(std::make_pair(loc, shared_data_t()));
{
char loc[PTR_STRLEN];
- if (xbt_cfg_get_boolean("smpi/use-shared-malloc")){
+ if (smpi_cfg_shared_malloc) {
snprintf(loc, PTR_STRLEN, "%p", ptr);
auto meta = allocs_metadata.find(ptr);
if (meta == allocs_metadata.end()) {
smpi_privatize_global_variables = xbt_cfg_get_boolean("smpi/privatize-global-variables");
if (smpi_cpu_threshold < 0)
smpi_cpu_threshold = DBL_MAX;
+ smpi_cfg_shared_malloc = xbt_cfg_get_boolean("smpi/shared-malloc");
}
int smpi_main(int (*realmain) (int argc, char *argv[]), int argc, char *argv[])