Hide or fix all build warnings (#1331)
* Changing C-strings to be const. * Changed variable-length arrays to std::vector to avoid warnings. VLA is a compiler extension. * Changed `#define` inside functions into `constexpr int` to preserve scoping and avoid macro redefinition warnings. * Disabled warnings for modifying `CMAKE_CXX_FLAGS` caused by `check_symbol_exists`, which temporarily modifies the flag to do a compile check. * Fixed VLA in rccl UT.
Bu işleme şunda yer alıyor:
işlemeyi yapan:
GitHub
ebeveyn
6178556853
işleme
1c45962273
@@ -116,7 +116,7 @@ namespace RcclUnitTesting
|
||||
std::vector<bool> const inPlaceList = {false};
|
||||
std::vector<bool> const managedMemList = {false};
|
||||
std::vector<bool> const useHipGraphList = {false, true};
|
||||
std::vector<char *> const channelList = {"84", "112"};
|
||||
std::vector<const char *> const channelList = {"84", "112"};
|
||||
bool const enableSweep = false;
|
||||
for (auto channel : channelList) {
|
||||
setenv("NCCL_MIN_NCHANNELS", channel, 1);
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace RcclUnitTesting
|
||||
std::vector<bool> const inPlaceList = {false};
|
||||
std::vector<bool> const managedMemList = {false};
|
||||
std::vector<bool> const useHipGraphList = {false, true};
|
||||
std::vector<char *> const channelList = {"112"};
|
||||
std::vector<const char *> const channelList = {"112"};
|
||||
bool const enableSweep = false;
|
||||
for (auto channel : channelList) {
|
||||
setenv("NCCL_MIN_NCHANNELS", channel, 1);
|
||||
|
||||
@@ -171,8 +171,11 @@ namespace RcclUnitTesting
|
||||
hipDeviceProp_t devProp;
|
||||
HIPCALL(hipGetDeviceProperties(&devProp, 0));
|
||||
// Initialize RCCL
|
||||
int numRanks = 2;
|
||||
constexpr int numRanks = 2;
|
||||
std::vector<ncclComm_t> comms(numRanks);
|
||||
std::vector<int*> gpuInput(numRanks);
|
||||
std::vector<int*> gpuOutput(numRanks);
|
||||
std::vector<hipStream_t> stream(numRanks);
|
||||
|
||||
char *proto = std::getenv("NCCL_PROTO");
|
||||
const char* protocolList[3] = {"LL", "LL128", "Simple"};
|
||||
@@ -198,10 +201,6 @@ namespace RcclUnitTesting
|
||||
}
|
||||
|
||||
// Prepare GPU data arrays
|
||||
int* gpuInput[numRanks];
|
||||
int* gpuOutput[numRanks];
|
||||
hipStream_t stream[numRanks];
|
||||
|
||||
for (int rank = 0; rank < numRanks; rank++) {
|
||||
HIPCALL(hipSetDevice(rank));
|
||||
HIPCALL(hipStreamCreate(&stream[rank]));
|
||||
@@ -218,7 +217,7 @@ namespace RcclUnitTesting
|
||||
HIPCALL(hipSetDevice(rank));
|
||||
HIPCALL(hipMemset(gpuOutput[rank], 0, N * sizeof(int)));
|
||||
HIPCALL(hipDeviceSynchronize());
|
||||
}
|
||||
}
|
||||
|
||||
// Initiate the allreduce
|
||||
NCCLCHECK(ncclGroupStart());
|
||||
@@ -233,7 +232,7 @@ namespace RcclUnitTesting
|
||||
HIPCALL(hipStreamSynchronize(stream[rank]));
|
||||
}
|
||||
|
||||
if (iter >= 0)
|
||||
if (iter >= 0)
|
||||
usElapsed += duration_cast<microseconds>(Clock::now() - start).count();
|
||||
|
||||
// Check results
|
||||
|
||||
Yeni konuda referans
Bir kullanıcı engelle