From 675b495a009609a8a6b092a72631ea65f7c3349d Mon Sep 17 00:00:00 2001 From: Bertan Dogancay <111835151+BertanDogancay@users.noreply.github.com> Date: Sat, 21 Jun 2025 22:18:20 -0400 Subject: [PATCH] [NPKit] Create dump dir regardless of default or user provided path (#1757) --- src/init.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/init.cc b/src/init.cc index e96a325d9c..23169987f7 100644 --- a/src/init.cc +++ b/src/init.cc @@ -2576,12 +2576,11 @@ static ncclResult_t commCleanup(ncclComm_t comm) { if (npkitDumpDir == nullptr) { npkitDumpDir = "./npkit_dump"; INFO(NCCL_INIT, "NPKIT_DUMP_DIR is not set, using default directory: %s", npkitDumpDir); - - struct stat st; - if (stat(npkitDumpDir, &st) != 0) { - if (mkdir(npkitDumpDir, 0755) != 0) { - WARN("Failed to create NPKIT_DUMP_DIR directory: %s", npkitDumpDir); - } + } + struct stat st; + if (stat(npkitDumpDir, &st) != 0) { + if (mkdir(npkitDumpDir, 0755) != 0) { + WARN("Failed to create NPKIT_DUMP_DIR directory: %s", npkitDumpDir); } } NCCLCHECK(NpKit::Dump(npkitDumpDir));