Skip to content

Commit c6dbdb0

Browse files
committed
Make sure proxy threads inherit the CPU affinity.
1 parent de49a77 commit c6dbdb0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/init.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -798,12 +798,6 @@ static ncclResult_t initTransportsRank(struct ncclComm* comm, ncclUniqueId* comm
798798
// Compute nChannels per peer for p2p
799799
NCCLCHECK(ncclTopoComputeP2pChannels(comm));
800800

801-
// We should have allocated all buffers, collective fifos, ... we can
802-
// restore the affinity.
803-
affinity_restore:
804-
sched_setaffinity(0, sizeof(cpu_set_t), &affinitySave);
805-
if (ret != ncclSuccess) return ret;
806-
807801
// Compute intra ranks (using AllGather1 data)
808802
int intraRank0 = -1, intraRank = -1, intraRanks = 0;
809803
for (int i = 0; i < nranks; i++) {
@@ -828,6 +822,12 @@ static ncclResult_t initTransportsRank(struct ncclComm* comm, ncclUniqueId* comm
828822

829823
if (comm->nNodes) NCCLCHECK(ncclProxyCreate(comm));
830824

825+
// We should have allocated all buffers, collective fifos, ... we can
826+
// restore the affinity.
827+
affinity_restore:
828+
sched_setaffinity(0, sizeof(cpu_set_t), &affinitySave);
829+
if (ret != ncclSuccess) return ret;
830+
831831
TRACE(NCCL_INIT, "rank %d nranks %d - DONE", rank, nranks);
832832
return ncclSuccess;
833833
}

0 commit comments

Comments
 (0)