-void smpi_global_init()
-{
- int i;
-
- int size = SIMIX_host_get_number();
-
- smpi_global = xbt_new(s_smpi_global_t, 1);
-
- // config variable
- smpi_global->reference_speed = SMPI_DEFAULT_SPEED;
-
- smpi_global->root_ready = 0;
- smpi_global->ready_process_count = 0;
-
- // start/stop
- smpi_global->start_stop_mutex = SIMIX_mutex_init();
- smpi_global->start_stop_cond = SIMIX_cond_init();
-
- // host info blank until sim starts
- // FIXME: is this okay?
- smpi_global->hosts = NULL;
- smpi_global->host_count = 0;
-
- // running hosts
- smpi_global->running_hosts_count_mutex = SIMIX_mutex_init();
- smpi_global->running_hosts_count = 0;
-
- // 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);
-
- // queues
- smpi_global->pending_send_request_queues = xbt_new(xbt_fifo_t, size);
- smpi_global->pending_send_request_queues_mutexes = xbt_new(smx_mutex_t, size);
- smpi_global->pending_recv_request_queues = xbt_new(xbt_fifo_t, size);
- smpi_global->pending_recv_request_queues_mutexes = xbt_new(smx_mutex_t, size);
- smpi_global->received_message_queues = xbt_new(xbt_fifo_t, size);
- smpi_global->received_message_queues_mutexes = xbt_new(smx_mutex_t, size);
-
- // sender/receiver processes
- smpi_global->sender_processes = xbt_new(smx_process_t, size);
- smpi_global->receiver_processes = xbt_new(smx_process_t, size);
-
- // timers
- smpi_global->timer = xbt_os_timer_new();
- smpi_global->timer_mutex = SIMIX_mutex_init();
- smpi_global->timer_cond = SIMIX_cond_init();
- smpi_global->times_max = 0;
- smpi_global->times_mutex = SIMIX_mutex_init();
-
- for (i = 0; i < size; i++) {
- smpi_global->pending_send_request_queues[i] = xbt_fifo_new();
- smpi_global->pending_send_request_queues_mutexes[i] = SIMIX_mutex_init();
- smpi_global->pending_recv_request_queues[i] = xbt_fifo_new();
- smpi_global->pending_recv_request_queues_mutexes[i] = SIMIX_mutex_init();
- smpi_global->received_message_queues[i] = xbt_fifo_new();
- smpi_global->received_message_queues_mutexes[i] = SIMIX_mutex_init();
- }
-
- for (i = 0; i < SMPI_MAX_TIMES; i++) {
- smpi_global->times[i] = -1.0;
- }