Skip to content
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
8 changes: 8 additions & 0 deletions flagcx/adaptor/ccl/pccl_adaptor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,14 @@ flagcxResult_t pcclAdaptorAllReduce(const void *sendbuff, void *recvbuff,
size_t count, flagcxDataType_t datatype,
flagcxRedOp_t op, flagcxInnerComm_t comm,
flagcxStream_t stream) {
// FlagCX bypasses PyTorch; ensure the comm's device is active.
if (comm != nullptr && comm->base != nullptr) {
int comm_dev = -1;
if (pcclCommCuDevice(comm->base, &comm_dev) == pcclSuccess &&
comm_dev >= 0) {
tangSetDevice(comm_dev);
}
}
return (flagcxResult_t)p2f_ret_map[pcclAllReduce(
sendbuff, recvbuff, count, f2p_datatype_map[datatype],
f2p_reduceop_map[op], comm->base, stream->base)];
Expand Down
1 change: 1 addition & 0 deletions plugin/torch/_build_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ def get_device_config(adaptor_flag):
]
library_dirs += [
torch_ptpu_dir,
os.path.join(tang_toolkit_dir, "lib"),
os.path.join(tang_toolkit_dir, "lib", "linux-x86_64"),
]
libs += [f":{c_so_basename}", "tangrt_shared"]
Expand Down
Loading