Skip to content

Commit

Permalink
Correct issues with C++98 compilers
Browse files Browse the repository at this point in the history
  • Loading branch information
robertmaynard committed Nov 1, 2023
1 parent 4060a68 commit a389f2b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
25 changes: 13 additions & 12 deletions rapids-cmake/test/detail/generate_resource_spec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,17 @@
#include <vector>

struct version {
int major = 1;
int minor = 0;
version() : major(1), minor(0) {}
int major;
int minor;
};

struct gpu {
gpu(int i) : id{i} {};
gpu(int i, size_t mem) : id{i}, memory{mem}, slots{100} {}
int id = 0;
size_t memory = 0;
int slots = 0;
gpu(int i) : id(i), memory(0), slots(0){};
gpu(int i, size_t mem) : id(i), memory(mem), slots(100) {}
int id;
size_t memory;
int slots;
};

// A hard-coded JSON printer that generates a ctest resource-specification file:
Expand All @@ -54,19 +55,19 @@ int main()
#ifdef HAVE_CUDA
cudaGetDeviceCount(&nDevices);
if (nDevices == 0) {
gpus.emplace_back(0);
gpus.push_back(gpu(0));
} else {
for (int i = 0; i < nDevices; ++i) {
cudaDeviceProp prop;
cudaGetDeviceProperties(&prop, i);
gpus.emplace_back(i, prop.totalGlobalMem);
gpus.push_back(gpu(i, prop.totalGlobalMem));
}
}
#else
gpus.emplace_back(0);
#endif()
gpus.push_back(gpu(0));
#endif

version v{1, 0};
version v;
std::cout << "{\n";
to_json(std::cout, v);
std::cout << ",\n";
Expand Down
2 changes: 1 addition & 1 deletion rapids-cmake/test/generate_resource_spec.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function(rapids_test_generate_resource_spec DESTINATION filepath)
set(error_file ${PROJECT_BINARY_DIR}/rapids-cmake/detect_gpus.stderr.log)

if(NOT EXISTS "${eval_exe}")
find_package(CUDAToolkit)
find_package(CUDAToolkit QUIET)
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/rapids-cmake/")

if(CUDAToolkit_FOUND)
Expand Down

0 comments on commit a389f2b

Please sign in to comment.