diff --git a/tools/HelloRccl/HelloRccl.cpp b/tools/HelloRccl/HelloRccl.cpp index 4eb72b6a52..17d501e4c7 100644 --- a/tools/HelloRccl/HelloRccl.cpp +++ b/tools/HelloRccl/HelloRccl.cpp @@ -27,8 +27,9 @@ THE SOFTWARE. #include #include #include +#include #include -#include +#include #include "HelloRccl.hpp" @@ -62,11 +63,11 @@ int main(int argc, char **argv) int nranks = atoi(argv[1]); // Initialize communicators for each rank - ncclComm_t comm[nranks]; - NCCL_CALL(ncclCommInitAll(comm, nranks, NULL)); + std::vector comm(nranks); + NCCL_CALL(ncclCommInitAll(comm.data(), nranks, NULL)); // Run the test - ExecuteTest(nranks, 0, nranks, comm); + ExecuteTest(nranks, 0, nranks, comm.data()); } else { @@ -85,9 +86,9 @@ void ExecuteTest(int numIntraRank, int intraRankStartId, int numTotalRanks, nccl int numIterations = 10; // Number of timed iterations // Allocate GPU resources for this process - hipStream_t stream[numIntraRank]; - hipEvent_t startEvent[numIntraRank]; - hipEvent_t stopEvent[numIntraRank]; + std::vector stream(numIntraRank); + std::vector startEvent(numIntraRank); + std::vector stopEvent(numIntraRank); for (int i = 0; i < numIntraRank; i++) { HIP_CALL(hipSetDevice(intraRankStartId + i)); @@ -108,7 +109,8 @@ void ExecuteTest(int numIntraRank, int intraRankStartId, int numTotalRanks, nccl int N = 1 << power; // Allocate GPU memory - float *iputGpu[numIntraRank], *oputGpu[numIntraRank]; + std::vectoriputGpu(numIntraRank); + std::vectoroputGpu(numIntraRank); for (int r = 0; r < numIntraRank; r++) { HIP_CALL(hipSetDevice(intraRankStartId + r));