X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/107321af5c208ff3b158c584c5a8fa0551e47580..272ccad1b68b6d9c17069f3c934886925bb15b5d:/src/instr/instr_smpi.c diff --git a/src/instr/instr_smpi.c b/src/instr/instr_smpi.c index 7cdf66f0f1..060f0a98c2 100644 --- a/src/instr/instr_smpi.c +++ b/src/instr/instr_smpi.c @@ -82,11 +82,11 @@ static char *TRACE_smpi_put_key(int src, int dst, char *key, int n) xbt_dynar_t d = xbt_dict_get_or_null(keys, aux); if (d == NULL) { d = xbt_dynar_new(sizeof(char *), &xbt_free_ref); - xbt_dict_set(keys, aux, d, xbt_free); + xbt_dict_set(keys, aux, d, NULL); } //generate the key static unsigned long long counter = 0; - snprintf(key, n, "%d%d%lld", src, dst, counter++); + snprintf(key, n, "%d%d%llu", src, dst, counter++); //push it char *a = (char*)xbt_strdup(key); @@ -101,7 +101,7 @@ static char *TRACE_smpi_get_key(int src, int dst, char *key, int n) snprintf(aux, INSTR_DEFAULT_STR_SIZE, "%d#%d", src, dst); xbt_dynar_t d = xbt_dict_get_or_null(keys, aux); - xbt_assert(xbt_dynar_length(d)!=0, + xbt_assert(!xbt_dynar_is_empty(d), "Trying to get a link key (for message reception) that has no corresponding send (%s).", __FUNCTION__); char *s = xbt_dynar_get_as (d, 0, char *); snprintf (key, n, "%s", s); @@ -123,7 +123,7 @@ void TRACE_internal_smpi_set_category (const char *category) if (xbt_dict_get_or_null (process_category, processid)) xbt_dict_remove (process_category, processid); if (category != NULL) - xbt_dict_set (process_category, processid, xbt_strdup(category), xbt_free); + xbt_dict_set (process_category, processid, xbt_strdup(category), NULL); } const char *TRACE_internal_smpi_get_category (void) @@ -137,21 +137,14 @@ const char *TRACE_internal_smpi_get_category (void) void TRACE_smpi_alloc() { - keys = xbt_dict_new(); - process_category = xbt_dict_new(); -} - -void TRACE_smpi_start(void) -{ - TRACE_start(); + keys = xbt_dict_new_homogeneous(xbt_free); + process_category = xbt_dict_new_homogeneous(xbt_free); } void TRACE_smpi_release(void) { - if (!TRACE_smpi_is_enabled()) return; - - TRACE_surf_release(); - TRACE_end(); + xbt_dict_free(&keys); + xbt_dict_free(&process_category); } void TRACE_smpi_init(int rank) @@ -163,13 +156,13 @@ void TRACE_smpi_init(int rank) container_t father; if (TRACE_smpi_is_grouped()){ - father = getContainer (SIMIX_host_self_get_name()); + father = PJ_container_get (SIMIX_host_self_get_name()); }else{ - father = getRootContainer (); + father = PJ_container_get_root (); } xbt_assert(father!=NULL, "Could not find a parent for mpi rank %s at function %s", str, __FUNCTION__); - newContainer(str, INSTR_SMPI, father); + PJ_container_new(str, INSTR_SMPI, father); } void TRACE_smpi_finalize(int rank) @@ -177,8 +170,9 @@ void TRACE_smpi_finalize(int rank) if (!TRACE_smpi_is_enabled()) return; char str[INSTR_DEFAULT_STR_SIZE]; - smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE); - destroyContainer(getContainer (str)); + container_t container = PJ_container_get(smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE)); + PJ_container_remove_from_parent (container); + PJ_container_free (container); } void TRACE_smpi_collective_in(int rank, int root, const char *operation) @@ -187,11 +181,10 @@ void TRACE_smpi_collective_in(int rank, int root, const char *operation) char str[INSTR_DEFAULT_STR_SIZE]; smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE); - container_t container = getContainer (str); - type_t type = getType ("MPI_STATE", container->type); + container_t container = PJ_container_get (str); + type_t type = PJ_type_get ("MPI_STATE", container->type); const char *color = instr_find_color (operation); - val_t value = getValue (operation, color, type); - + val_t value = PJ_value_get_or_new (operation, color, type); new_pajePushState (SIMIX_get_clock(), container, type, value); } @@ -201,8 +194,8 @@ void TRACE_smpi_collective_out(int rank, int root, const char *operation) char str[INSTR_DEFAULT_STR_SIZE]; smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE); - container_t container = getContainer (str); - type_t type = getType ("MPI_STATE", container->type); + container_t container = PJ_container_get (str); + type_t type = PJ_type_get ("MPI_STATE", container->type); new_pajePopState (SIMIX_get_clock(), container, type); } @@ -214,11 +207,10 @@ void TRACE_smpi_ptp_in(int rank, int src, int dst, const char *operation) char str[INSTR_DEFAULT_STR_SIZE]; smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE); - container_t container = getContainer (str); - type_t type = getType ("MPI_STATE", container->type); + container_t container = PJ_container_get (str); + type_t type = PJ_type_get ("MPI_STATE", container->type); const char *color = instr_find_color (operation); - val_t value = getValue (operation, color, type); - + val_t value = PJ_value_get_or_new (operation, color, type); new_pajePushState (SIMIX_get_clock(), container, type, value); } @@ -228,8 +220,8 @@ void TRACE_smpi_ptp_out(int rank, int src, int dst, const char *operation) char str[INSTR_DEFAULT_STR_SIZE]; smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE); - container_t container = getContainer (str); - type_t type = getType ("MPI_STATE", container->type); + container_t container = PJ_container_get (str); + type_t type = PJ_type_get ("MPI_STATE", container->type); new_pajePopState (SIMIX_get_clock(), container, type); } @@ -243,10 +235,10 @@ void TRACE_smpi_send(int rank, int src, int dst) char str[INSTR_DEFAULT_STR_SIZE]; smpi_container(src, str, INSTR_DEFAULT_STR_SIZE); - container_t container = getContainer (str); - type_t type = getType ("MPI_LINK", getRootType()); + container_t container = PJ_container_get (str); + type_t type = PJ_type_get ("MPI_LINK", PJ_type_get_root()); - new_pajeStartLink (SIMIX_get_clock(), getRootContainer(), type, container, "PTP", key); + new_pajeStartLink (SIMIX_get_clock(), PJ_container_get_root(), type, container, "PTP", key); } void TRACE_smpi_recv(int rank, int src, int dst) @@ -258,9 +250,9 @@ void TRACE_smpi_recv(int rank, int src, int dst) char str[INSTR_DEFAULT_STR_SIZE]; smpi_container(dst, str, INSTR_DEFAULT_STR_SIZE); - container_t container = getContainer (str); - type_t type = getType ("MPI_LINK", getRootType()); + container_t container = PJ_container_get (str); + type_t type = PJ_type_get ("MPI_LINK", PJ_type_get_root()); - new_pajeEndLink (SIMIX_get_clock(), getRootContainer(), type, container, "PTP", key); + new_pajeEndLink (SIMIX_get_clock(), PJ_container_get_root(), type, container, "PTP", key); } #endif /* HAVE_TRACING */