diff --git a/apps/nccl/src/nccl.cu b/apps/nccl/src/nccl.cu index e9749cd07..9093f9868 100644 --- a/apps/nccl/src/nccl.cu +++ b/apps/nccl/src/nccl.cu @@ -192,7 +192,7 @@ static std::vector setupSmChannels(ncclComm_t comm, return channels; } -static std::pair loadExecutionPlan(const char* filename) { +static std::pair loadExecutionPlan(const std::string& filename) { std::shared_ptr plan = std::make_shared(filename); std::string collective = plan->collective(); planKey key{plan->minMessageSize(), plan->maxMessageSize(), plan->isInPlace()}; @@ -401,10 +401,13 @@ NCCL_API ncclResult_t ncclCommInitRank(ncclComm_t* comm, int nranks, ncclUniqueI if (getenv("MSCCLPP_EXECUTION_PLAN_DIR")) { std::string collectiveDir = getenv("MSCCLPP_EXECUTION_PLAN_DIR"); + if (!std::filesystem::is_directory(collectiveDir)) { + return ncclInvalidArgument; + } for (const auto& entry : std::filesystem::directory_iterator(collectiveDir)) { if (entry.is_regular_file()) { std::string filename = entry.path().filename().string(); - auto plan = loadExecutionPlan(entry.path().c_str()); + auto plan = loadExecutionPlan(entry.path()); commPtr->executionPlans[plan.first].push_back(plan.second); } } diff --git a/src/include/execution_plan.hpp b/src/include/execution_plan.hpp index 00a0c5e76..8d291f45f 100644 --- a/src/include/execution_plan.hpp +++ b/src/include/execution_plan.hpp @@ -62,7 +62,6 @@ struct ChannelInfo { struct ExecutionPlan::Impl { public: - Impl(const std::string name, const std::string planPath); Impl(const std::string planPath); ~Impl() = default;