Skip to content

Commit

Permalink
More robust msccl shared directory location discovery (#869)
Browse files Browse the repository at this point in the history
  • Loading branch information
gilbertlee-amd committed Aug 29, 2023
1 parent 26490f4 commit 6dca2cf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/misc/msccl/msccl_lifecycle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ static const char* mscclAlgoDirEnv = "MSCCL_ALGO_DIR";
static const char* mscclAlgoDefaultDir = "msccl-algorithms";
extern "C" bool mscclUnitTestMode() __attribute__((__weak__));
static const char* mscclUnitTestAlgoDefaultDir = "msccl-unit-test-algorithms";
static const char* mscclAlgoShareDirPath = "share/rccl/msccl-algorithms";
static const char* mscclUnitTestAlgoShareDirPath = "share/rccl/msccl-unit-test-algorithms";
static const char* mscclAlgoShareDirPath = "../share/rccl/msccl-algorithms";
static const char* mscclUnitTestAlgoShareDirPath = "../share/rccl/msccl-unit-test-algorithms";

static ncclResult_t mscclInternalSchedulerInit() {
mscclStatus& status = mscclGetStatus();
Expand All @@ -94,7 +94,7 @@ static ncclResult_t mscclInternalSchedulerInit() {
mscclAlgoDirStr += (mscclUnitTestMode && mscclUnitTestMode()) ? mscclUnitTestAlgoDefaultDir : mscclAlgoDefaultDir;
mscclAlgoDir = mscclAlgoDirStr.c_str();
// Get share Directory Paths
mscclAlgoShareDirStr = selfLibPath.substr(0, selfLibPath.rfind("lib"));
mscclAlgoShareDirStr = selfLibPath.substr(0, selfLibPath.find_last_of("/\\") + 1);
mscclAlgoShareDirStr += (mscclUnitTestMode && mscclUnitTestMode()) ? mscclUnitTestAlgoShareDirPath : mscclAlgoShareDirPath;
mscclAlgoShareDir = mscclAlgoShareDirStr.c_str();
}
Expand All @@ -112,6 +112,7 @@ static ncclResult_t mscclInternalSchedulerInit() {
} else {
fullDirPath = mscclAlgoDir;
}
INFO(NCCL_INIT, "Using MSCCL files from %s", fullDirPath);
while ((entry = readdir(dp))) {
if (entry->d_type != DT_LNK && entry->d_type != DT_REG) {
continue;
Expand Down

0 comments on commit 6dca2cf

Please sign in to comment.