Rail optimization for rings (#1140)

- Modifies the ring creation algorithm to be friendlier to rail-optimized topologies (should not affect classic fabric topologies)
This commit is contained in:
gilbertlee-amd
2024-04-15 12:03:57 -06:00
committed by GitHub
parent 3caad91f32
commit 4cb62f999a
11 changed files with 296 additions and 69 deletions
+22
View File
@@ -1060,6 +1060,7 @@ static ncclResult_t initTransportsRank(struct ncclComm* comm, struct ncclComm* p
goto fail;
}
}
// AllGather1 - end
do {
@@ -1159,6 +1160,27 @@ static ncclResult_t initTransportsRank(struct ncclComm* comm, struct ncclComm* p
// Determine local Nvls support
NCCLCHECK(ncclNvlsInit(comm));
// [RCCL] Compute hostIdx (based on hostHash)
{
comm->topo->nHosts = 0;
for (int r = 0; r < nranks; r++) {
int isNewHost = 1;
// Check if this is the first time this hostname has been used
for (int i = 0; i < r && isNewHost; i++) {
if (comm->peerInfo[i].hostHash == comm->peerInfo[r].hostHash) {
isNewHost = 0;
}
}
if (isNewHost)
{
// Check if this is the same hostname associated with this rank
if (comm->peerInfo[r].hostHash == comm->peerInfo[rank].hostHash)
comm->topo->hostIdx = comm->topo->nHosts;
comm->topo->nHosts++;
}
}
}
// Get rings and trees
memset(&ringGraph, 0, sizeof(struct ncclTopoGraph));
ringGraph.id = 0;