Skip to content

Commit

Permalink
CORE: fix colltrace print with trace log level (openucx#935)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergei-Lebedev authored Mar 4, 2024
1 parent 9ceb057 commit 2ee7e4a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 18 deletions.
16 changes: 9 additions & 7 deletions src/coll_score/ucc_coll_score_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,22 @@ void ucc_coll_score_free_map(ucc_score_map_t *map)
ucc_free(map);
}

static
ucc_status_t ucc_coll_score_map_lookup(ucc_score_map_t *map,
ucc_base_coll_args_t *bargs,
ucc_msg_range_t **range)
static ucc_status_t ucc_coll_score_map_lookup(ucc_score_map_t *map,
ucc_base_coll_args_t *bargs,
ucc_msg_range_t **range)
{
ucc_memory_type_t mt = ucc_coll_args_mem_type(&bargs->args,
map->team_rank);
unsigned ct = ucc_ilog2(bargs->args.coll_type);
size_t msgsize = ucc_coll_args_msgsize(&bargs->args,
map->team_rank,
map->team_size);
ucc_list_link_t *list;
ucc_msg_range_t *r;
ucc_list_link_t *list;
ucc_msg_range_t *r;

if (mt == UCC_MEMORY_TYPE_ASYMMETRIC) {
/* TODO */
ucc_debug("asymmetric memory type is not supported");
return UCC_ERR_NOT_SUPPORTED;
} else if (mt == UCC_MEMORY_TYPE_NOT_APPLY) {
/* Temporary solution: for Barrier, Fanin, Fanout - use
Expand Down Expand Up @@ -122,7 +122,9 @@ ucc_status_t ucc_coll_init(ucc_score_map_t *map,
ucc_status_t status;

status = ucc_coll_score_map_lookup(map, bargs, &r);
if (UCC_OK != status) {
if (ucc_unlikely(UCC_OK != status)) {
ucc_debug("coll_score_map lookup failed %d (%s)",
status, ucc_status_string(status));
return status;
}

Expand Down
9 changes: 4 additions & 5 deletions src/core/ucc_coll.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,20 +280,19 @@ UCC_CORE_PROFILE_FUNC(ucc_status_t, ucc_collective_init,

print_trace:
*request = &task->super;
if (ucc_global_config.coll_trace.log_level >= UCC_LOG_LEVEL_DIAG) {
if (ucc_unlikely(ucc_global_config.coll_trace.log_level >=
UCC_LOG_LEVEL_DIAG)) {
char coll_str[256];
ucc_coll_str(task, coll_str, sizeof(coll_str),
ucc_global_config.coll_trace.log_level);
if (ucc_global_config.coll_trace.log_level <= UCC_LOG_LEVEL_DEBUG) {
if (ucc_global_config.coll_trace.log_level <= UCC_LOG_LEVEL_INFO) {
if (team->rank == 0) {
ucc_log_component_collective_trace(
ucc_global_config.coll_trace.log_level, "coll_init: %s",
coll_str);
}
} else {
ucc_log_component_collective_trace(
ucc_global_config.coll_trace.log_level, "coll_init: %s",
coll_str);
ucc_coll_trace_debug("coll_init: %s", coll_str);
}
}

Expand Down
9 changes: 5 additions & 4 deletions src/utils/ucc_coll_utils.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
* See file LICENSE for terms.
*/
Expand Down Expand Up @@ -56,7 +56,8 @@ static inline int
ucc_coll_args_is_mem_symmetric(const ucc_coll_args_t *args,
ucc_rank_t rank)
{
ucc_rank_t root = args->root;
ucc_rank_t root = args->root;

if (UCC_IS_INPLACE(*args)) {
return 1;
}
Expand Down Expand Up @@ -93,7 +94,7 @@ ucc_coll_args_is_mem_symmetric(const ucc_coll_args_t *args,
return 0;
}

int ucc_coll_args_is_predefined_dt(ucc_coll_args_t *args, ucc_rank_t rank)
int ucc_coll_args_is_predefined_dt(const ucc_coll_args_t *args, ucc_rank_t rank)
{
switch (args->coll_type) {
case UCC_COLL_TYPE_BARRIER:
Expand Down Expand Up @@ -160,7 +161,7 @@ int ucc_coll_args_is_predefined_dt(ucc_coll_args_t *args, ucc_rank_t rank)
ucc_memory_type_t ucc_coll_args_mem_type(const ucc_coll_args_t *args,
ucc_rank_t rank)
{
ucc_rank_t root = args->root;
ucc_rank_t root = args->root;

if (!ucc_coll_args_is_mem_symmetric(args, rank)) {
return UCC_MEMORY_TYPE_ASYMMETRIC;
Expand Down
4 changes: 2 additions & 2 deletions src/utils/ucc_coll_utils.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
* See file LICENSE for terms.
*/
Expand Down Expand Up @@ -332,6 +332,6 @@ static inline size_t ucc_buffer_block_offset_aligned(size_t total_count,
@param [in] args pointer to the collective args.
@param [in] rank rank to check, used only for rooted collective
operations. */
int ucc_coll_args_is_predefined_dt(ucc_coll_args_t *args, ucc_rank_t rank);
int ucc_coll_args_is_predefined_dt(const ucc_coll_args_t *args, ucc_rank_t rank);

#endif

0 comments on commit 2ee7e4a

Please sign in to comment.