Add Feature - Add NPKit Support in RCCL (#564)
* apply npkit * fix bug * add npkit in readme
This commit is contained in:
+21
@@ -17,6 +17,9 @@
|
||||
#include "enqueue.h"
|
||||
#include "graph.h"
|
||||
#include "argcheck.h"
|
||||
#if defined(ENABLE_NPKIT)
|
||||
#include "npkit/npkit.h"
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <hip/hip_runtime.h>
|
||||
@@ -501,6 +504,13 @@ static ncclResult_t devCommSetup(ncclComm_t comm) {
|
||||
NCCLCHECK(ncclCudaMemcpy(comm->channels[r].ring.devUserRanks, comm->channels[r].ring.userRanks, comm->nRanks));
|
||||
}
|
||||
|
||||
#if defined(ENABLE_NPKIT)
|
||||
// Init NPKit
|
||||
NCCLCHECK(NpKit::Init(comm->rank));
|
||||
comm->hostDevComm.npKitEventCollectContexts = NpKit::GetGpuEventCollectContexts();
|
||||
comm->hostDevComm.cpuTimestamp = NpKit::GetCpuTimestamp();
|
||||
#endif
|
||||
|
||||
// Duplicate the dev comm on the device
|
||||
NCCLCHECK(ncclCudaMemcpy(comm->devComm, &comm->hostDevComm, 1));
|
||||
return ncclSuccess;
|
||||
@@ -1399,6 +1409,17 @@ static ncclResult_t commDestroy(ncclComm_t comm) {
|
||||
if (savedDevice != commDevice)
|
||||
CUDACHECK(hipSetDevice(savedDevice));
|
||||
|
||||
#if defined(ENABLE_NPKIT)
|
||||
// Dump NPKit events and shutdown
|
||||
const char* npkitDumpDir = getenv("NPKIT_DUMP_DIR");
|
||||
if (npkitDumpDir == nullptr) {
|
||||
WARN("NPKIT_DUMP_DIR is empty");
|
||||
} else {
|
||||
NCCLCHECK(NpKit::Dump(npkitDumpDir));
|
||||
}
|
||||
NCCLCHECK(NpKit::Shutdown());
|
||||
#endif
|
||||
|
||||
return ncclSuccess;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user