+ int i;
+
+ /* Connect our log channels: that must be done manually under windows */
+#ifdef XBT_LOG_CONNECT
+ XBT_LOG_CONNECT(smpi_base, smpi);
+ XBT_LOG_CONNECT(smpi_bench, smpi);
+ XBT_LOG_CONNECT(smpi_kernel, smpi);
+ XBT_LOG_CONNECT(smpi_mpi, smpi);
+ XBT_LOG_CONNECT(smpi_receiver, smpi);
+ XBT_LOG_CONNECT(smpi_sender, smpi);
+ XBT_LOG_CONNECT(smpi_util, smpi);
+#endif
+
+ smpi_global = xbt_new(s_smpi_global_t, 1);
+
+ // mallocators
+ smpi_global->request_mallocator =
+ xbt_mallocator_new(SMPI_REQUEST_MALLOCATOR_SIZE, smpi_request_new,
+ smpi_request_free, smpi_request_reset);
+ smpi_global->message_mallocator =
+ xbt_mallocator_new(SMPI_MESSAGE_MALLOCATOR_SIZE, smpi_message_new,
+ smpi_message_free, smpi_message_reset);
+
+ smpi_global->process_count = SIMIX_process_count();
+ DEBUG1("There is %d processes",smpi_global->process_count);
+
+ // sender/receiver processes
+ smpi_global->main_processes = xbt_new(smx_process_t, smpi_global->process_count);
+
+ // timers
+ smpi_global->timer = xbt_os_timer_new();
+ smpi_global->timer_mutex = SIMIX_mutex_init();
+ smpi_global->timer_cond = SIMIX_cond_init();
+
+ smpi_global->do_once_duration_nodes = NULL;
+ smpi_global->do_once_duration = NULL;
+ smpi_global->do_once_mutex = SIMIX_mutex_init();
+
+
+ smpi_mpi_global = xbt_new(s_smpi_mpi_global_t, 1);
+
+ // global communicator
+ smpi_mpi_global->mpi_comm_world = xbt_new(s_smpi_mpi_communicator_t, 1);
+ smpi_mpi_global->mpi_comm_world->size = smpi_global->process_count;
+ smpi_mpi_global->mpi_comm_world->barrier_count = 0;
+ smpi_mpi_global->mpi_comm_world->barrier_mutex = SIMIX_mutex_init();
+ smpi_mpi_global->mpi_comm_world->barrier_cond = SIMIX_cond_init();
+ smpi_mpi_global->mpi_comm_world->rank_to_index_map =
+ xbt_new(int, smpi_global->process_count);
+ smpi_mpi_global->mpi_comm_world->index_to_rank_map =
+ xbt_new(int, smpi_global->process_count);
+ for (i = 0; i < smpi_global->process_count; i++) {
+ smpi_mpi_global->mpi_comm_world->rank_to_index_map[i] = i;
+ smpi_mpi_global->mpi_comm_world->index_to_rank_map[i] = i;
+ }
+
+ // mpi datatypes
+ smpi_mpi_global->mpi_byte = xbt_new(s_smpi_mpi_datatype_t, 1);
+ smpi_mpi_global->mpi_byte->size = (size_t) 1;
+ smpi_mpi_global->mpi_int = xbt_new(s_smpi_mpi_datatype_t, 1);
+ smpi_mpi_global->mpi_int->size = sizeof(int);
+ smpi_mpi_global->mpi_float = xbt_new(s_smpi_mpi_datatype_t, 1);
+ smpi_mpi_global->mpi_float->size = sizeof(float);
+ smpi_mpi_global->mpi_double = xbt_new(s_smpi_mpi_datatype_t, 1);
+ smpi_mpi_global->mpi_double->size = sizeof(double);
+
+ // mpi operations
+ smpi_mpi_global->mpi_land = xbt_new(s_smpi_mpi_op_t, 1);
+ smpi_mpi_global->mpi_land->func = smpi_mpi_land_func;
+ smpi_mpi_global->mpi_sum = xbt_new(s_smpi_mpi_op_t, 1);
+ smpi_mpi_global->mpi_sum->func = smpi_mpi_sum_func;
+ smpi_mpi_global->mpi_min = xbt_new(s_smpi_mpi_op_t, 1);
+ smpi_mpi_global->mpi_min->func = smpi_mpi_min_func;
+ smpi_mpi_global->mpi_max = xbt_new(s_smpi_mpi_op_t, 1);
+ smpi_mpi_global->mpi_min->func = smpi_mpi_max_func;