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

TL/UCP: fix dbt to build with hpcsdk #885

Merged
merged 1 commit into from
Dec 7, 2023
Merged
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
26 changes: 16 additions & 10 deletions src/coll_patterns/double_binary_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static inline ucc_rank_t get_left_child(ucc_rank_t rank, int height)
ucc_rank_t sub_height;

if (height == 0) {
return -1;
return UCC_RANK_INVALID;
}

sub_height = 1 << (height - 1);
Expand All @@ -65,7 +65,7 @@ static inline ucc_rank_t get_right_child(ucc_rank_t size, ucc_rank_t rank,
ucc_rank_t sub_right_root, sub_height;

if (rank == size - 1 || height == 0) {
return -1;
return UCC_RANK_INVALID;
}

sub_right_root = get_root(size - rank - 1) + 1;
Expand All @@ -86,10 +86,10 @@ static inline void get_children(ucc_rank_t size, ucc_rank_t rank, int height,
*r_c = get_right_child(size, rank, height, root);
}

static inline int get_parent(int vsize, int vrank, int height, int troot)
static inline ucc_rank_t get_parent(int vsize, int vrank, int height, int troot)
{
if (vrank == troot) {
return -1;
return UCC_RANK_INVALID;
} else if (height == 0) {
return ((((vrank/2) % 2 == 0) && (vrank + 1 != vsize))) ? vrank + 1
: vrank - 1;
Expand All @@ -113,10 +113,13 @@ static inline void ucc_dbt_build_t2_mirror(ucc_dbt_single_tree_t t1,
t.height = t1.height;
t.rank = size - 1 - t1.rank;
t.root = size - 1 - t1.root;
t.parent = (t1.parent == -1) ? -1 : size - 1 - t1.parent;
t.children[LEFT_CHILD] = (t1.children[RIGHT_CHILD] == -1) ? -1 :
t.parent = (t1.parent == UCC_RANK_INVALID) ?
UCC_RANK_INVALID : size - 1 - t1.parent;
t.children[LEFT_CHILD] = (t1.children[RIGHT_CHILD] == UCC_RANK_INVALID) ?
UCC_RANK_INVALID :
size - 1 - t1.children[RIGHT_CHILD];
t.children[RIGHT_CHILD] = (t1.children[LEFT_CHILD] == -1) ? -1 :
t.children[RIGHT_CHILD] = (t1.children[LEFT_CHILD] == UCC_RANK_INVALID) ?
UCC_RANK_INVALID :
size - 1 - t1.children[LEFT_CHILD];
t.recv = 0;

Expand All @@ -133,10 +136,13 @@ static inline void ucc_dbt_build_t2_shift(ucc_dbt_single_tree_t t1,
t.height = t1.height;
t.rank = (t1.rank + 1) % size;
t.root = (t1.root + 1) % size;
t.parent = (t1.parent == -1) ? -1 : (t1.parent + 1) % size;
t.children[LEFT_CHILD] = (t1.children[LEFT_CHILD] == -1) ? -1 :
t.parent = (t1.parent == UCC_RANK_INVALID) ?
UCC_RANK_INVALID : (t1.parent + 1) % size;
t.children[LEFT_CHILD] = (t1.children[LEFT_CHILD] == UCC_RANK_INVALID) ?
UCC_RANK_INVALID :
(t1.children[LEFT_CHILD] + 1) % size;
t.children[RIGHT_CHILD] = (t1.children[RIGHT_CHILD] == -1) ? -1 :
t.children[RIGHT_CHILD] = (t1.children[RIGHT_CHILD] == UCC_RANK_INVALID) ?
UCC_RANK_INVALID :
(t1.children[RIGHT_CHILD] + 1) % size;
t.recv = 0;

Expand Down
6 changes: 4 additions & 2 deletions src/components/tl/ucp/bcast/bcast_dbt.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ void ucc_tl_ucp_bcast_dbt_progress(ucc_coll_task_t *coll_task)
SEND_T1:
if ((coll_root == rank) || (task->bcast_dbt.t1.recv > 0)) {
for (i = 0; i < 2; i++) {
if (t1.children[i] != -1 && t1.children[i] != coll_root) {
if ((t1.children[i] != UCC_RANK_INVALID) &&
(t1.children[i] != coll_root)) {
UCPCHECK_GOTO(ucc_tl_ucp_send_nb(buffer, data_size_t1, mtype,
t1.children[i], team, task),
task, out);
Expand All @@ -123,7 +124,8 @@ void ucc_tl_ucp_bcast_dbt_progress(ucc_coll_task_t *coll_task)
SEND_T2:
if ((coll_root == rank) || (task->bcast_dbt.t2.recv > 0)) {
for (i = 0; i < 2; i++) {
if (t2.children[i] != -1 && t2.children[i] != coll_root) {
if ((t2.children[i] != UCC_RANK_INVALID) &&
(t2.children[i] != coll_root)) {
UCPCHECK_GOTO(ucc_tl_ucp_send_nb(PTR_OFFSET(buffer,
data_size_t1),
data_size_t2, mtype,
Expand Down
Loading