Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git] / src / smpi / smpi_global.cpp
index 3933638..8d2f646 100644 (file)
@@ -133,7 +133,7 @@ void smpi_process_init(int *argc, char ***argv)
     data->instance_id = instance_id;
     data->replaying   = false;
 
-    static_cast<MsgActorExt*>(proc->data)->data = data;
+    static_cast<simgrid::MsgActorExt*>(proc->data)->data = data;
 
     if (*argc > 3) {
       memmove(&(*argv)[0], &(*argv)[2], sizeof(char *) * (*argc - 2));
@@ -226,7 +226,7 @@ int smpi_global_size()
 
 smpi_process_data_t smpi_process_data()
 {
-  MsgActorExt* msgExt = static_cast<MsgActorExt*>(SIMIX_process_self()->data);
+  simgrid::MsgActorExt* msgExt = static_cast<simgrid::MsgActorExt*>(SIMIX_process_self()->data);
   return static_cast<smpi_process_data_t>(msgExt->data);
 }
 
@@ -400,7 +400,7 @@ void smpi_comm_copy_buffer_callback(smx_activity_t synchro, void *buff, size_t b
        XBT_DEBUG("Privatization : We are copying from a zone inside global memory... Saving data to temp buffer !");
 
        smpi_switch_data_segment(
-           (static_cast<smpi_process_data_t>((static_cast<MsgActorExt*>(comm->src_proc->data)->data))->index));
+           (static_cast<smpi_process_data_t>((static_cast<simgrid::MsgActorExt*>(comm->src_proc->data)->data))->index));
        tmpbuff = static_cast<void*>(xbt_malloc(buff_size));
        memcpy(tmpbuff, buff, buff_size);
   }
@@ -409,7 +409,7 @@ void smpi_comm_copy_buffer_callback(smx_activity_t synchro, void *buff, size_t b
       && ((char*)comm->dst_buff < smpi_start_data_exe + smpi_size_data_exe )){
        XBT_DEBUG("Privatization : We are copying to a zone inside global memory - Switch data segment");
        smpi_switch_data_segment(
-           (static_cast<smpi_process_data_t>((static_cast<MsgActorExt*>(comm->dst_proc->data)->data))->index));
+           (static_cast<smpi_process_data_t>((static_cast<simgrid::MsgActorExt*>(comm->dst_proc->data)->data))->index));
   }
 
   memcpy(comm->dst_buff, tmpbuff, buff_size);
@@ -770,7 +770,18 @@ static void smpi_init_options(){
     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");
+
+    char* val = xbt_cfg_get_string("smpi/shared-malloc");
+    if (!strcasecmp(val, "yes") || !strcmp(val, "1") || !strcasecmp(val, "on") || !strcasecmp(val, "global")) {
+      smpi_cfg_shared_malloc = shmalloc_global;
+    } else if (!strcasecmp(val, "local")) {
+      smpi_cfg_shared_malloc = shmalloc_local;
+    } else if (!strcasecmp(val, "no") || !strcmp(val, "0") || !strcasecmp(val, "off")) {
+      smpi_cfg_shared_malloc = shmalloc_none;
+    } else {
+      xbt_die("Invalid value '%s' for option smpi/shared-malloc. Possible values: 'on' or 'global', 'local', 'off'",
+              val);
+    }
 }
 
 int smpi_main(int (*realmain) (int argc, char *argv[]), int argc, char *argv[])