Skip to content

Ucx process bootstrap#598

Open
kaiyingshan wants to merge 9 commits into
mainfrom
ucx-process-bootstrap
Open

Ucx process bootstrap#598
kaiyingshan wants to merge 9 commits into
mainfrom
ucx-process-bootstrap

Conversation

@kaiyingshan
Copy link
Copy Markdown
Collaborator

@kaiyingshan kaiyingshan force-pushed the ucx-process-bootstrap branch from 55ec34e to 6cefdcc Compare August 29, 2022 02:53
@kaiyingshan kaiyingshan marked this pull request as ready for review August 29, 2022 02:54
@nirandaperera
Copy link
Copy Markdown
Collaborator

@kaiyingshan can you send this commit 19d17b7 as a separate PR to the main branch?

redis->lpush("ucc_helper" + std::to_string(num_comm) + ":" + std::to_string(rank),
"0");

for (int i = 0; i < world_size; i++) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we might need a barrier like mechanism here to guarantee that all processes have completed pushing data.

void *coll_info, void **req) {
int world_size = ((UCXUCCCommunicator*) coll_info)->GetWorldSize();
int rank = ((UCXUCCCommunicator*) coll_info)->GetRank();
int num_comm = ((UCXUCCCommunicator *)coll_info)->num_oob_allgather;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this num_comm?

Comment on lines +255 to +256
this->displacements_ = new std::vector<std::vector<int>>(num_buffers);
this->all_recv_counts_ = new std::vector<std::vector<int>>(num_buffers);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think you need to malloc for a vector object. You can simply do this,

this->displacements_ = std::vector<std::vector<int>>(num_buffers);
this->all_recv_counts_ = std::vector<std::vector<int>>(num_buffers);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I think I understand why you did this. This is because of the const in GatherBufferSizes method, right?


args.mask = 0;
args.coll_type = UCC_COLL_TYPE_GATHER;
args.coll_type = UCC_COLL_TYPE_ALLGATHER;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put a TODO and refer to the github issue.
Add a comment explaining why we are using allgather

Comment on lines +337 to +341
int sum = 0;
auto& recv_counts_ = (*all_recv_counts_)[buf_idx];
for(auto count: recv_counts_) {
sum += count;
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use std::accumulate

for (int32_t i = 0; i < num_buffers; ++i) {
(*all_recv_counts_)[i] = cylon::net::receiveCounts(all_buffer_sizes, i,
num_buffers, world_size);
(*displacements_)[i] = std::move(cylon::net::displacementsPerBuffer(all_buffer_sizes, i,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't think you need the move here.

Comment on lines 275 to 286
if(rank == gather_root) {
args.dst.info.buffer = rcv_data;
args.dst.info.count = num_buffers * world_size;
args.dst.info.count = total_sz;
args.dst.info.datatype = UCC_DT_INT32;
args.dst.info.mem_type = UCC_MEMORY_TYPE_HOST;
} else {
all_buffer_sizes.resize(total_sz);
args.dst.info.buffer = all_buffer_sizes.data();
args.dst.info.count = total_sz;
args.dst.info.datatype = UCC_DT_INT32;
args.dst.info.mem_type = UCC_MEMORY_TYPE_HOST;
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we do this?

  if(rank == gather_root) {
    args.dst.info.buffer = rcv_data;
  } else {
    all_buffer_sizes.resize(total_sz);
    args.dst.info.buffer = all_buffer_sizes.data();
  }
args.dst.info.count = total_sz;
args.dst.info.datatype = UCC_DT_INT32;
args.dst.info.mem_type = UCC_MEMORY_TYPE_HOST;

Comment on lines +345 to +348
args.dst.info_v.counts = (ucc_count_t *)(*all_recv_counts_)[buf_idx].data();
args.dst.info_v.displacements = (ucc_aint_t *)(*displacements_)[buf_idx].data();
args.dst.info_v.datatype = UCC_DT_UINT8;
args.dst.info_v.mem_type = UCC_MEMORY_TYPE_HOST;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually think we dont need these! we just need to pass recv_data_placeholder buffer and make sure everyone (other than the root) copies data to this dummy buffer. So you might not even need to track all_recv_counts_ and displacements_.

Comment on lines +74 to +75
std::vector<std::vector<int>>* displacements_;
std::vector<std::vector<int>>* all_recv_counts_;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a feeling that you might not even need these. I've explained it in a previous comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants