From 83c5eb73780eb0aa4cf466758495b87725aa3260 Mon Sep 17 00:00:00 2001 From: Ziyue Yang Date: Mon, 16 Dec 2024 23:41:17 +0800 Subject: [PATCH] Fix MSCCL algorithm loading order (#1460) --- src/misc/msccl/msccl_lifecycle.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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) {