From 16101e654fa3faf5710ccacd08ff93bef74d0b7c Mon Sep 17 00:00:00 2001 From: gilbertlee-amd <44450918+gilbertlee-amd@users.noreply.github.com> Date: Fri, 27 Jun 2025 09:12:59 -0600 Subject: [PATCH] Fixing HelloRccl include path to RCCL, fixing some warnings (#1778) --- tools/HelloRccl/HelloRccl.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) 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));