Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
moved XBT_LOG_CONNECT calls into smpi_global so that they will only be called
[simgrid.git] / src / smpi / smpi_global.c
index 4f8fed0..a6c1f6f 100644 (file)
@@ -2,7 +2,9 @@
 
 #include "private.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi, XBT_LOG_ROOT_CAT, "All SMPI categories");
+XBT_LOG_NEW_CATEGORY(smpi, "All SMPI categories");
+
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_kernel, smpi, "Logging specific to SMPI (kernel)");
 
 smpi_global_t     smpi_global     = NULL;
 
@@ -122,8 +124,19 @@ void smpi_global_init()
 
        int size = SIMIX_host_get_number();
 
-       smpi_global                                      = xbt_new(s_smpi_global_t, 1);
+       /* Connect our log channels: that must be done manually under windows */
+        /* (should be done only once, not for each process) */
+       #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);
        // config variable
        smpi_global->reference_speed                     = SMPI_DEFAULT_SPEED;
 
@@ -166,10 +179,6 @@ void smpi_global_init()
        smpi_global->timer_mutex                         = SIMIX_mutex_init();
        smpi_global->timer_cond                          = SIMIX_cond_init();
 
-       smpi_global->execute_mutex                       = SIMIX_mutex_init();
-       smpi_global->execute_cond                        = SIMIX_cond_init();
-       smpi_global->execute_count                       = 0;
-
        smpi_global->do_once_duration_nodes              = NULL;
        smpi_global->do_once_duration                    = NULL;
        smpi_global->do_once_mutex                       = SIMIX_mutex_init();
@@ -211,8 +220,6 @@ 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->execute_mutex);
-       SIMIX_cond_destroy(smpi_global->execute_cond);
 
        for(curr = smpi_global->do_once_duration_nodes; NULL != curr; curr = next) {
                next = curr->next;
@@ -247,10 +254,23 @@ int smpi_host_index()
 {
        smx_host_t host = SIMIX_host_self();
        smpi_host_data_t hdata = (smpi_host_data_t)SIMIX_host_get_data(host);
-
        return hdata->index;
 }
 
+smx_mutex_t smpi_host_mutex()
+{
+       smx_host_t host = SIMIX_host_self();
+       smpi_host_data_t hdata = (smpi_host_data_t)SIMIX_host_get_data(host);
+       return hdata->mutex;
+}
+
+smx_cond_t smpi_host_cond()
+{
+       smx_host_t host = SIMIX_host_self();
+       smpi_host_data_t hdata = (smpi_host_data_t)SIMIX_host_get_data(host);
+       return hdata->cond;
+}
+
 int smpi_run_simulation(int *argc, char **argv)
 {
        smx_cond_t   cond           = NULL;