Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cleaning up and refactoring some of the code to create execution actions.
[simgrid.git] / src / smpi / smpi_global.c
index a0786cd..08d693c 100644 (file)
@@ -166,7 +166,13 @@ void smpi_global_init()
        smpi_global->timer_mutex                         = SIMIX_mutex_init();
        smpi_global->timer_cond                          = SIMIX_cond_init();
 
-       for(i = 0; i < size; i++) {
+       smpi_global->times_max                           = 0;
+       smpi_global->times_mutex                         = SIMIX_mutex_init();
+
+       smpi_global->execute_mutex                       = SIMIX_mutex_init();
+       smpi_global->execute_cond                        = SIMIX_cond_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();
@@ -175,6 +181,10 @@ void smpi_global_init()
                smpi_global->received_message_queues_mutexes[i]     = SIMIX_mutex_init();
        }
 
+       for (i = 0; i < SMPI_MAX_TIMES; i++) {
+               smpi_global->times[i] = -1.0;
+       }
+
 }
 
 void smpi_global_destroy()
@@ -201,6 +211,9 @@ void smpi_global_destroy()
        xbt_os_timer_free(smpi_global->timer);
        SIMIX_mutex_destroy(smpi_global->timer_mutex);
        SIMIX_cond_destroy(smpi_global->timer_cond);
+       SIMIX_mutex_destroy(smpi_global->times_mutex);
+       SIMIX_mutex_destroy(smpi_global->execute_mutex);
+       SIMIX_cond_destroy(smpi_global->execute_cond);
 
        for(i = 0; i < size; i++) {
                xbt_fifo_free(smpi_global->pending_send_request_queues[i]);
@@ -231,7 +244,7 @@ int smpi_host_index()
        return hdata->index;
 }
 
-int smpi_run_simulation(int argc, char **argv)
+int smpi_run_simulation(int *argc, char **argv)
 {
        xbt_fifo_item_t cond_item   = NULL;
        smx_cond_t   cond           = NULL;
@@ -243,7 +256,7 @@ int smpi_run_simulation(int argc, char **argv)
 
        srand(SMPI_RAND_SEED);
 
-       SIMIX_global_init(&argc, argv);
+       SIMIX_global_init(argc, argv);
 
        SIMIX_function_register("smpi_simulated_main", smpi_simulated_main);
        SIMIX_function_register("smpi_sender",         smpi_sender);