Skip to content

Commit

Permalink
remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
nsarkauskas committed Nov 27, 2024
1 parent 142070a commit d366d52
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 34 deletions.
41 changes: 9 additions & 32 deletions src/components/cl/hier/allgatherv/allgatherv.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,6 @@ static ucc_status_t ucc_cl_hier_allgatherv_finalize(ucc_coll_task_t *task)
ucc_derived_of(task, ucc_cl_hier_schedule_t);
ucc_status_t status;

/*
// manual validation
ucc_cl_hier_team_t *cl_team = ucc_derived_of(task->team, ucc_cl_hier_team_t);
ucc_rank_t team_size = UCC_CL_TEAM_SIZE(cl_team);
ucc_rank_t rank = UCC_CL_TEAM_RANK(cl_team);
size_t buf_size = ucc_coll_args_get_v_buffer_size(&task->bargs.args,
task->bargs.args.dst.info_v.counts,
task->bargs.args.dst.info_v.displacements,
team_size);
printf("rank %d dst buf: ", rank);
for (int i = 0; i < buf_size; i++) {
printf("%d ", ((char*)task->bargs.args.dst.info_v.buffer)[i]);
}
printf("\n");
// end manual validation
*/


ucc_mc_free(cl_schedule->scratch);

UCC_CL_HIER_PROFILE_REQUEST_EVENT(task, "cl_hier_allgatherv_finalize",
Expand All @@ -75,6 +55,7 @@ static inline int is_leader(ucc_base_team_t *team, ucc_rank_t rank)
return 0;
}

/* TODO: is there a better way to do this? */
static inline ucc_rank_t find_leader_rank(ucc_base_team_t *team, ucc_rank_t team_rank)
{
ucc_cl_hier_team_t *cl_team = ucc_derived_of(team, ucc_cl_hier_team_t);
Expand Down Expand Up @@ -188,28 +169,26 @@ UCC_CL_HIER_PROFILE_FUNC(ucc_status_t, ucc_cl_hier_allgatherv_init,
ucc_assert(cl_team->top_sbgp == UCC_HIER_SBGP_NODE_LEADERS);
size_t disp_counter = 0;

// Sum up the counts on each node to get the count for each node leader
/* Sum up the counts on each node to get the count for each node leader */
for (i = 0; i < team_size; i++) {
ucc_rank_t leader_team_rank = find_leader_rank(team, i);
//printf("team rank %d mapping to leader %d\n", i, leader_team_rank);
size_t leader_old_count = ucc_coll_args_get_count(&args.args, leader_counts, ucc_ep_map_local_rank(SBGP_MAP(cl_team, NODE_LEADERS), leader_team_rank));
size_t add_count = ucc_coll_args_get_count(&args.args, args.args.dst.info_v.counts, i);
size_t new_count = add_count + leader_old_count;
ucc_coll_args_set_count(&args.args, leader_counts, ucc_ep_map_local_rank(SBGP_MAP(cl_team, NODE_LEADERS), leader_team_rank), new_count);
//printf("set leader count (ptr=%p) for leader %d (team rank %d) to %ld. leader sbgp size=%d\n",
// leader_counts, leader_team_rank, i, new_count, leader_sbgp_size);
}

// Need to order leader displacements by their team rank, not their leader sbgp rank
// The reason is leaders are not always in the same order as they are in the team
// e.g., 2n2ppn
// team ranks = 0 1 2 3 with 0 and 2 as leaders
// leader sbgp ranks can be 2 0 wrt their team ranks
/*
Need to order leader displacements by their team rank, not their leader sbgp rank.
The reason is leaders are not always in the same order as they are in the team
e.g., 2n2ppn
team ranks = 0 1 2 3 with 0 and 2 as leaders
leader sbgp ranks can be 2 0 wrt their team ranks
*/
for (i = 0; i < team_size; i++) {
if (is_leader(team, i)) {
ucc_rank_t leader_sgbp_rank = ucc_ep_map_local_rank(SBGP_MAP(cl_team, NODE_LEADERS), i);
ucc_coll_args_set_displacement(&args.args, leader_disps, leader_sgbp_rank, disp_counter);
//printf("set disp for leader %d to %ld\n", i, disp_counter);
disp_counter += ucc_coll_args_get_count(&args.args, leader_counts, leader_sgbp_rank);
}
}
Expand All @@ -222,7 +201,6 @@ UCC_CL_HIER_PROFILE_FUNC(ucc_status_t, ucc_cl_hier_allgatherv_init,
args.args.dst.info_v.displacements = leader_disps;
args.args.dst.info_v.counts = leader_counts;
args.args.dst.info_v.buffer = args_old.args.dst.info_v.buffer;
//printf("nick: rank %d doing node leader allgatherv. node sbgp preserves_order=%d. node rank=%d, leader rank=%d\n", rank, cl_team->sbgps[UCC_HIER_SBGP_NODE].sbgp->preserves_order, SBGP_RANK(cl_team, NODE), SBGP_RANK(cl_team, NODE_LEADERS));
UCC_CHECK_GOTO(ucc_coll_init(SCORE_MAP(cl_team, NODE_LEADERS), &args,
&tasks[n_tasks]),
out, status);
Expand All @@ -240,7 +218,6 @@ UCC_CL_HIER_PROFILE_FUNC(ucc_status_t, ucc_cl_hier_allgatherv_init,
args.args.src.info.count = total_count;
args.args.src.info.datatype = args_old.args.dst.info_v.datatype;
args.args.src.info.mem_type = args_old.args.dst.info_v.mem_type;
//printf("rank %d doing bcast, buffer = %p, buffer[0]=%d. node-level root of 0 is team rank %d. count=%ld\n", rank, args.args.dst.info.buffer, ((char*)args.args.dst.info.buffer)[0], ucc_ep_map_eval(SBGP_MAP(cl_team, NODE), 0), total_count);
UCC_CHECK_GOTO(
ucc_coll_init(SCORE_MAP(cl_team, NODE), &args, &tasks[n_tasks]),
out, status);
Expand Down
2 changes: 0 additions & 2 deletions src/components/cl/hier/allgatherv/unpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ ucc_status_t ucc_cl_hier_allgatherv_unpack_start(ucc_coll_task_t *task)
ucc_cl_hier_team_t *cl_team = ucc_derived_of(task->team, ucc_cl_hier_team_t);
ucc_rank_t team_size = UCC_CL_TEAM_SIZE(cl_team);
ucc_coll_args_t *args = &task->bargs.args;
//ucc_rank_t rank = UCC_CL_TEAM_RANK(cl_team);
ucc_ee_executor_task_args_t eargs = {0};
ucc_cl_hier_schedule_t *cl_schedule = ucc_derived_of(schedule, ucc_cl_hier_schedule_t);
ucc_ee_executor_task_t **tasks = cl_schedule->scratch->addr;
Expand Down Expand Up @@ -93,7 +92,6 @@ ucc_status_t ucc_cl_hier_allgatherv_unpack_init(ucc_base_coll_args_t *coll_args,
{
ucc_cl_hier_team_t *cl_team = ucc_derived_of(team, ucc_cl_hier_team_t);
ucc_rank_t team_size = UCC_CL_TEAM_SIZE(cl_team);
//ucc_rank_t rank = UCC_CL_TEAM_RANK(cl_team);
ucc_status_t status;
ucc_schedule_t *schedule;
ucc_cl_hier_schedule_t *cl_schedule;
Expand Down

0 comments on commit d366d52

Please sign in to comment.