Skip to content
Open
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
31 changes: 31 additions & 0 deletions xllm/core/framework/parallel_state/ilu_process_group.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,37 @@ class ProcessGroupImpl : public ProcessGroup {
pg_ = std::make_unique<c10d::ProcessGroupNCCL>(
store, rank, rank_size, pg_options);
}

ProcessGroupImpl(int32_t global_rank,
int32_t local_rank,
const std::vector<int32_t>& group_ranks,
int32_t world_size,
int32_t rank_size,
int32_t port,
const std::string& host,
const std::string& group_name,
const torch::Device& device)
: ProcessGroup(global_rank, world_size, device) {
c10::intrusive_ptr<c10d::ProcessGroupNCCL::Options> pg_options =
c10d::ProcessGroupNCCL::Options::create();
#if TORCH_VERSION_MAJOR > 2 || \
(TORCH_VERSION_MAJOR == 2 && TORCH_VERSION_MINOR >= 7)
pg_options->group_name = group_name;
#endif
if (world_size != rank_size) {
std::vector<uint64_t> uint64_ranks;
uint64_ranks.reserve(group_ranks.size());
for (const int32_t rank : group_ranks) {
uint64_ranks.emplace_back(static_cast<uint64_t>(rank));
}
}
pg_options->global_ranks_in_group = std::move(uint64_ranks);
}

auto store = create_tcp_store(host, port, local_rank);
pg_ = std::make_unique<c10d::ProcessGroupNCCL>(
store, local_rank, rank_size, pg_options);
}
};

} // namespace xllm
Loading