diff --git a/src/misc/msccl/msccl_lifecycle.cc b/src/misc/msccl/msccl_lifecycle.cc index a4c49bc750..532171bf0a 100644 --- a/src/misc/msccl/msccl_lifecycle.cc +++ b/src/misc/msccl/msccl_lifecycle.cc @@ -174,14 +174,18 @@ static ncclResult_t mscclInternalSchedulerInit(ncclComm_t comm, int* numChannels fullDirPath = mscclAlgoDir; } INFO(NCCL_INIT, "Using MSCCL files from %s", fullDirPath); + std::set sortedFullPaths; while ((entry = readdir(dp))) { if (entry->d_type != DT_LNK && entry->d_type != DT_REG) { continue; } - status.algoMetas.emplace_back(); std::string fullPath = fullDirPath; fullPath += "/"; fullPath += entry->d_name; + sortedFullPaths.insert(fullPath); + } + for (auto& fullPath : sortedFullPaths) { + status.algoMetas.emplace_back(); NCCLCHECK(mscclGetAlgoMetaFromXmlFile(fullPath.c_str(), &(status.algoMetas.back()))); if (status.algoMetas.back().nRanks == comm->nRanks) { if(status.algoMetas.back().nChannels <= maxNchannels) {