Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 8 additions & 3 deletions src/xccl/ProcessGroupXCCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,11 @@ const std::string& ProcessGroupXCCL::logPrefix() const {
return logPrefix_;
}

const int& ProcessGroupXCCL::globalRank() const {
static int globalRank = rank_;
return globalRank;
}

ProcessGroupXCCL::ProcessGroupXCCL(
const c10::intrusive_ptr<Store>& store,
int rank,
Expand Down Expand Up @@ -377,7 +382,7 @@ ProcessGroupXCCL::ProcessGroupXCCL(
std::string torch_distributed_debug =
getCvarString({"TORCH_DISTRIBUTED_DEBUG"}, OFF.c_str());
LOG(INFO) << logPrefix() << "ProcessGroupXCCL initialization options: "
<< "size: " << size << ", global rank: " << rank_;
<< "size: " << size << ", global rank: " << globalRank();

LOG(INFO) << logPrefix() << "ProcessGroupXCCL environments: "
<< "XCCL version: " << XcclVersion
Expand Down Expand Up @@ -405,7 +410,7 @@ bool ProcessGroupXCCL::dumpDebuggingInfo(bool includeStackTrace /*=true*/) {
if (traceBufferSize_ > 0) {
// TODO: dump_xccl_trace
auto xcclTrace = dump_xccl_trace(true, includeStackTrace, false);
DebugInfoWriter& writer = DebugInfoWriter::getWriter(rank_);
DebugInfoWriter& writer = DebugInfoWriter::getWriter(globalRank());
LOG(INFO) << logPrefix() << "ProcessGroupXCCL dumping xccl trace to "
<< writer.getWriterTarget();
writer.write(xcclTrace);
Expand Down Expand Up @@ -2020,7 +2025,7 @@ c10::DeviceIndex ProcessGroupXCCL::guessDeviceId() const {
return *usedDeviceIdxs_.begin();
}
int devIdx =
static_cast<int16_t>(rank_ % at::detail::getXPUHooks().getNumGPUs());
static_cast<int16_t>(globalRank() % at::detail::getXPUHooks().getNumGPUs());
LOG(WARNING)
<< logPrefix()
<< c10::str(
Expand Down
1 change: 1 addition & 0 deletions src/xccl/ProcessGroupXCCL.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ class TORCH_API ProcessGroupXCCL : public Backend {
c10::DeviceIndex guessDeviceId() const;

const std::vector<uint64_t>& groupRanks() const;
const int& globalRank() const;
void setEnqueuedPgStatus(c10::intrusive_ptr<ProcessGroupXCCL::WorkXCCL> work);
void setCompletedPgStatus(
c10::intrusive_ptr<ProcessGroupXCCL::WorkXCCL> work);
Expand Down
Loading