Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORE: Add fn name to score print #1078

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/coll_score/ucc_coll_score.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ ucc_status_t ucc_coll_score_dup(const ucc_coll_score_t *in,
void ucc_coll_score_set(ucc_coll_score_t *score,
ucc_score_t value);

void ucc_coll_score_map_print_info(const ucc_score_map_t *score);
void ucc_coll_score_map_print_info(const ucc_score_map_t *score, int verbosity);

ucc_status_t ucc_coll_score_update(ucc_coll_score_t *score,
ucc_coll_score_t *update,
Expand Down
32 changes: 27 additions & 5 deletions src/coll_score/ucc_coll_score_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include "utils/ucc_string.h"
#include "schedule/ucc_schedule.h"

#include <dlfcn.h>

typedef struct ucc_score_map {
ucc_coll_score_t *score;
/* Size, rank of the process in the base_team associated with that
Expand Down Expand Up @@ -157,7 +159,19 @@ ucc_status_t ucc_coll_init(ucc_score_map_t *map,
} \
}

void ucc_coll_score_map_print_info(const ucc_score_map_t *map)
static const char *get_fn_name(ucc_base_coll_init_fn_t init_fn)
{
int status;
Dl_info info;
const char *fn_ptr_str = "?";
status = dladdr(init_fn, &info);
if (status && info.dli_sname != NULL) {
fn_ptr_str = info.dli_sname;
}
return fn_ptr_str;
}

void ucc_coll_score_map_print_info(const ucc_score_map_t *map, int verbosity)
{
size_t left;
ucc_msg_range_t *range;
Expand Down Expand Up @@ -193,10 +207,18 @@ void ucc_coll_score_map_print_info(const ucc_score_map_t *map)
sizeof(range_str));
ucc_score_to_str(range->super.score, score_str,
sizeof(score_str));
STR_APPEND(coll_str, left, 256, "{%s}:%s:%s ",
range_str,
range->super.team->context->lib->log_component.name,
score_str);
if (verbosity >= UCC_LOG_LEVEL_DEBUG) {
// Get the name of the init function through dladdr
STR_APPEND(coll_str, left, 256, "{%s}:%s:%s=%s ",
range_str,
range->super.team->context->lib->log_component.name,
score_str, get_fn_name(range->super.init));
} else {
STR_APPEND(coll_str, left, 256, "{%s}:%s:%s ",
range_str,
range->super.team->context->lib->log_component.name,
score_str);
}
}
STR_APPEND(coll_str, left, 4, "\n");
}
Expand Down
3 changes: 2 additions & 1 deletion src/core/ucc_team.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,8 @@ ucc_status_t ucc_team_create_test_single(ucc_context_t *context,
team->rank == 0) {
ucc_info("===== COLL_SCORE_MAP (team_id %d, size %u) =====",
team->id, team->size);
ucc_coll_score_map_print_info(team->score_map);
ucc_coll_score_map_print_info(team->score_map,
ucc_global_config.log_component.log_level);
ucc_info("================================================");
}
/* TODO: add team/coll selection and check if some teams are never
Expand Down
Loading