diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 12cdda987..49a613df5 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -76,6 +76,16 @@ create_logger_macros(RMM "rmm::default_logger()" include/rmm) include(cmake/thirdparty/get_cccl.cmake) include(cmake/thirdparty/get_nvtx.cmake) +# Mark third-party includes as SYSTEM to suppress warnings from upstream headers +foreach(_dep rapids_logger spdlog) + if(TARGET ${_dep}) + get_target_property(_inc ${_dep} INTERFACE_INCLUDE_DIRECTORIES) + if(_inc) + set_target_properties(${_dep} PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_inc}") + endif() + endif() +endforeach() + # ################################################################################################## # * library targets -------------------------------------------------------------------------------- @@ -128,11 +138,20 @@ if(RMM_NVTX) target_compile_definitions(rmm PUBLIC RMM_NVTX) endif() -set(RMM_CXX_FLAGS -Wall -Werror -Wextra -Wsign-conversion -Wno-unknown-pragmas - -Wno-error=deprecated-declarations) +set(RMM_CXX_FLAGS + -Wall + -Werror + -Wextra + -Wshadow + -Wnon-virtual-dtor + -Woverloaded-virtual + + -Wsign-conversion + -Wno-unknown-pragmas + -Wno-error=deprecated-declarations) set(RMM_CUDA_FLAGS -Werror=all-warnings - -Xcompiler=-Wall,-Werror,-Wextra,-Wsign-conversion,-Wno-error=deprecated-declarations) + -Xcompiler=-Wall,-Werror,-Wextra,-Wshadow,-Wnon-virtual-dtor,-Woverloaded-virtual,-Wsign-conversion,-Wno-error=deprecated-declarations) target_compile_options(rmm PRIVATE "$<$:${RMM_CXX_FLAGS}>" "$<$:${RMM_CUDA_FLAGS}>") diff --git a/cpp/benchmarks/CMakeLists.txt b/cpp/benchmarks/CMakeLists.txt index 85948ac18..cd4d8e235 100644 --- a/cpp/benchmarks/CMakeLists.txt +++ b/cpp/benchmarks/CMakeLists.txt @@ -9,9 +9,19 @@ option(DISABLE_DEPRECATION_WARNING "Disable warnings generated from deprecated declarations." OFF) option(PER_THREAD_DEFAULT_STREAM "Build with per-thread default stream" OFF) -set(RMM_BENCHMARKS_CXX_FLAGS -Wall -Werror -Wextra -Wsign-conversion -Wno-unknown-pragmas) -set(RMM_BENCHMARKS_CUDA_FLAGS -Werror=all-warnings - -Xcompiler=-Wall,-Werror,-Wextra,-Wsign-conversion) +set(RMM_BENCHMARKS_CXX_FLAGS + -Wall + -Werror + -Wextra + -Wshadow + -Wnon-virtual-dtor + -Woverloaded-virtual + + -Wsign-conversion + -Wno-unknown-pragmas) +set(RMM_BENCHMARKS_CUDA_FLAGS + -Werror=all-warnings + -Xcompiler=-Wall,-Werror,-Wextra,-Wshadow,-Wnon-virtual-dtor,-Woverloaded-virtual,-Wsign-conversion) if(PER_THREAD_DEFAULT_STREAM) message(STATUS "RMM: Building benchmarks with per-thread default stream") diff --git a/cpp/benchmarks/random_allocations/random_allocations.cpp b/cpp/benchmarks/random_allocations/random_allocations.cpp index ff19288cf..a96b63773 100644 --- a/cpp/benchmarks/random_allocations/random_allocations.cpp +++ b/cpp/benchmarks/random_allocations/random_allocations.cpp @@ -29,7 +29,7 @@ constexpr std::size_t size_mb{1 << 20}; struct allocation { void* ptr{nullptr}; std::size_t size{0}; - allocation(void* ptr, std::size_t size) : ptr{ptr}, size{size} {} + allocation(void* p, std::size_t sz) : ptr{p}, size{sz} {} allocation() = default; }; @@ -262,13 +262,13 @@ void declare_benchmark(std::string const& name) } static void profile_random_allocations(MRFactoryFunc const& factory, - std::size_t num_allocations, - std::size_t max_size) + std::size_t alloc_count, + std::size_t max_alloc_size) { auto mr = factory(); try { - uniform_random_allocations(*mr, num_allocations, max_size, max_usage); + uniform_random_allocations(*mr, alloc_count, max_alloc_size, max_usage); } catch (std::exception const& e) { std::cout << "Error: " << e.what() << "\n"; } diff --git a/cpp/benchmarks/replay/replay.cpp b/cpp/benchmarks/replay/replay.cpp index f5a374828..0fc097698 100644 --- a/cpp/benchmarks/replay/replay.cpp +++ b/cpp/benchmarks/replay/replay.cpp @@ -89,7 +89,7 @@ using MRFactoryFunc = std::function()->default_value("false")); - auto args = options.parse(argc, argv); + auto parsed = options.parse(argc, argv); - if (args.count("file") == 0) { + if (parsed.count("file") == 0) { std::cout << options.help() << std::endl; exit(0); } - return args; + return parsed; }(); auto filename = args["file"].as(); diff --git a/cpp/benchmarks/synchronization/synchronization.cpp b/cpp/benchmarks/synchronization/synchronization.cpp index b33f514f1..460677b59 100644 --- a/cpp/benchmarks/synchronization/synchronization.cpp +++ b/cpp/benchmarks/synchronization/synchronization.cpp @@ -19,8 +19,8 @@ cuda_event_timer::cuda_event_timer(benchmark::State& state, bool flush_l2_cache, - rmm::cuda_stream_view stream) - : stream(stream), p_state(&state) + rmm::cuda_stream_view strm) + : stream(strm), p_state(&state) { // flush all of L2$ if (flush_l2_cache) { diff --git a/cpp/benchmarks/synchronization/synchronization.hpp b/cpp/benchmarks/synchronization/synchronization.hpp index 556811977..158a7c1bb 100644 --- a/cpp/benchmarks/synchronization/synchronization.hpp +++ b/cpp/benchmarks/synchronization/synchronization.hpp @@ -64,11 +64,11 @@ class cuda_event_timer { * to update. * @param[in] flush_l2_cache whether or not to flush the L2 cache before * every iteration. - * @param[in] stream The CUDA stream we are measuring time on. + * @param[in] strm The CUDA stream we are measuring time on. */ cuda_event_timer(benchmark::State& state, bool flush_l2_cache, - rmm::cuda_stream_view stream = rmm::cuda_stream_default); + rmm::cuda_stream_view strm = rmm::cuda_stream_default); // The user will HAVE to provide a benchmark::State object to set // the timer so we disable the default c'tor. diff --git a/cpp/benchmarks/utilities/log_parser.hpp b/cpp/benchmarks/utilities/log_parser.hpp index 5114b7ea0..875dd18f0 100644 --- a/cpp/benchmarks/utilities/log_parser.hpp +++ b/cpp/benchmarks/utilities/log_parser.hpp @@ -35,29 +35,28 @@ struct event { event(event&&) noexcept = default; event& operator=(event&&) noexcept = default; ~event() = default; - event(action act, std::size_t size, void const* ptr) + event(action a, std::size_t sz, void const* ptr) // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) - : act{act}, size{size}, pointer{reinterpret_cast(ptr)} + : act{a}, size{sz}, pointer{reinterpret_cast(ptr)} { } // NOLINTNEXTLINE(bugprone-easily-swappable-parameters) - event(action act, std::size_t size, uintptr_t ptr) : act{act}, size{size}, pointer{ptr} {} + event(action a, std::size_t sz, uintptr_t ptr) : act{a}, size{sz}, pointer{ptr} {} event(std::size_t tid, - action act, - std::size_t size, // NOLINT(bugprone-easily-swappable-parameters) + action a, + std::size_t sz, // NOLINT(bugprone-easily-swappable-parameters) uintptr_t ptr, - uintptr_t stream, - std::size_t index) - : act{act}, size{size}, pointer{ptr}, thread_id{tid}, stream{stream}, index{index} + uintptr_t strm, + std::size_t idx) + : act{a}, size{sz}, pointer{ptr}, thread_id{tid}, stream{strm}, index{idx} { } - event( - std::size_t tid, action act, std::size_t size, void* ptr, uintptr_t stream, std::size_t index) + event(std::size_t tid, action a, std::size_t sz, void* ptr, uintptr_t strm, std::size_t idx) // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) - : event{tid, act, size, reinterpret_cast(ptr), stream, index} + : event{tid, a, sz, reinterpret_cast(ptr), strm, idx} { } diff --git a/cpp/include/rmm/cuda_stream.hpp b/cpp/include/rmm/cuda_stream.hpp index 0a5a11110..bd6b67e9d 100644 --- a/cpp/include/rmm/cuda_stream.hpp +++ b/cpp/include/rmm/cuda_stream.hpp @@ -59,11 +59,11 @@ class cuda_stream { /** * @brief Construct a new CUDA stream object * - * @param flags Stream creation flags. + * @param stream_flags Stream creation flags. * * @throw rmm::cuda_error if stream creation fails */ - cuda_stream(cuda_stream::flags flags = cuda_stream::flags::sync_default); + cuda_stream(cuda_stream::flags stream_flags = cuda_stream::flags::sync_default); /** * @brief Returns true if the owned stream is non-null diff --git a/cpp/include/rmm/detail/logging_assert.hpp b/cpp/include/rmm/detail/logging_assert.hpp index 0fdf3903d..d5d194750 100644 --- a/cpp/include/rmm/detail/logging_assert.hpp +++ b/cpp/include/rmm/detail/logging_assert.hpp @@ -19,7 +19,7 @@ * @brief Assertion that logs a CRITICAL log message on failure. */ #ifdef NDEBUG -#define RMM_LOGGING_ASSERT(_expr) (void)0 +#define RMM_LOGGING_ASSERT(_expr) static_cast(0) #elif RMM_LOG_ACTIVE_LEVEL < RMM_LOG_LEVEL_OFF #define RMM_LOGGING_ASSERT(_expr) \ do { \ diff --git a/cpp/include/rmm/detail/runtime_capabilities.hpp b/cpp/include/rmm/detail/runtime_capabilities.hpp index c4f0b793f..825722699 100644 --- a/cpp/include/rmm/detail/runtime_capabilities.hpp +++ b/cpp/include/rmm/detail/runtime_capabilities.hpp @@ -95,12 +95,12 @@ struct hwdecompress { { #if defined(CUDA_VERSION) && CUDA_VERSION >= RMM_MIN_HWDECOMPRESS_CUDA_DRIVER_VERSION // Check if hardware decompression is supported (requires CUDA 12.8 driver or higher) - static bool is_supported = []() { + static bool supported = []() { int driver_version{}; RMM_CUDA_TRY(cudaDriverGetVersion(&driver_version)); return driver_version >= RMM_MIN_HWDECOMPRESS_CUDA_DRIVER_VERSION; }(); - return is_supported; + return supported; #else return false; #endif diff --git a/cpp/include/rmm/exec_policy.hpp b/cpp/include/rmm/exec_policy.hpp index 5a5dea319..6f9e01aa1 100644 --- a/cpp/include/rmm/exec_policy.hpp +++ b/cpp/include/rmm/exec_policy.hpp @@ -42,10 +42,10 @@ class exec_policy : public thrust_exec_policy_t { /** * @brief Construct a new execution policy object * - * @param stream The stream on which to allocate temporary memory + * @param strm The stream on which to allocate temporary memory * @param mr The resource to use for allocating temporary memory */ - explicit exec_policy(cuda_stream_view stream = cuda_stream_default, + explicit exec_policy(cuda_stream_view strm = cuda_stream_default, device_async_resource_ref mr = mr::get_current_device_resource_ref()); }; @@ -67,10 +67,10 @@ class exec_policy_nosync : public thrust_exec_policy_nosync_t { /** * @brief Construct a new execution policy object * - * @param stream The stream on which to allocate temporary memory + * @param strm The stream on which to allocate temporary memory * @param mr The resource to use for allocating temporary memory */ - explicit exec_policy_nosync(cuda_stream_view stream = cuda_stream_default, + explicit exec_policy_nosync(cuda_stream_view strm = cuda_stream_default, device_async_resource_ref mr = mr::get_current_device_resource_ref()); }; diff --git a/cpp/include/rmm/mr/arena_memory_resource.hpp b/cpp/include/rmm/mr/arena_memory_resource.hpp index abb469034..29c4d8443 100644 --- a/cpp/include/rmm/mr/arena_memory_resource.hpp +++ b/cpp/include/rmm/mr/arena_memory_resource.hpp @@ -141,18 +141,18 @@ class arena_memory_resource final : public device_memory_resource { #else bytes = rmm::align_up(bytes, rmm::CUDA_ALLOCATION_ALIGNMENT); #endif - auto& arena = get_arena(stream); + auto& stream_arena = get_arena(stream); { std::shared_lock lock(mtx_); - void* pointer = arena.allocate_sync(bytes); + void* pointer = stream_arena.allocate_sync(bytes); if (pointer != nullptr) { return pointer; } } { std::unique_lock lock(mtx_); defragment(); - void* pointer = arena.allocate_sync(bytes); + void* pointer = stream_arena.allocate_sync(bytes); if (pointer == nullptr) { if (dump_log_on_failure_) { dump_memory_log(bytes); } auto const msg = std::string("Maximum pool size exceeded (failed to allocate ") + @@ -193,12 +193,12 @@ class arena_memory_resource final : public device_memory_resource { #else bytes = rmm::align_up(bytes, rmm::CUDA_ALLOCATION_ALIGNMENT); #endif - auto& arena = get_arena(stream); + auto& dealloc_arena = get_arena(stream); { std::shared_lock lock(mtx_); // If the memory being freed does not belong to the arena, the following will return false. - if (arena.deallocate(stream, ptr, bytes)) { return; } + if (dealloc_arena.deallocate(stream, ptr, bytes)) { return; } } { diff --git a/cpp/include/rmm/mr/detail/coalescing_free_list.hpp b/cpp/include/rmm/mr/detail/coalescing_free_list.hpp index c491b4676..a40c9187d 100644 --- a/cpp/include/rmm/mr/detail/coalescing_free_list.hpp +++ b/cpp/include/rmm/mr/detail/coalescing_free_list.hpp @@ -27,10 +27,7 @@ namespace mr::detail { */ struct block : public block_base { block() = default; - block(char* ptr, std::size_t size, bool is_head) - : block_base{ptr}, size_bytes{size}, head{is_head} - { - } + block(char* p, std::size_t size, bool is_head) : block_base{p}, size_bytes{size}, head{is_head} {} /** * @brief Returns the pointer to the memory represented by this block. diff --git a/cpp/include/rmm/mr/detail/free_list.hpp b/cpp/include/rmm/mr/detail/free_list.hpp index c1916a01f..17de1f366 100644 --- a/cpp/include/rmm/mr/detail/free_list.hpp +++ b/cpp/include/rmm/mr/detail/free_list.hpp @@ -20,7 +20,7 @@ struct block_base { void* ptr{}; ///< Raw memory pointer block_base() = default; - block_base(void* ptr) : ptr{ptr} {}; + block_base(void* p) : ptr{p} {}; /// Returns the raw pointer for this block [[nodiscard]] inline void* pointer() const { return ptr; } diff --git a/cpp/include/rmm/mr/owning_wrapper.hpp b/cpp/include/rmm/mr/owning_wrapper.hpp index cb7fcc974..8accadfef 100644 --- a/cpp/include/rmm/mr/owning_wrapper.hpp +++ b/cpp/include/rmm/mr/owning_wrapper.hpp @@ -136,6 +136,8 @@ class owning_wrapper : public device_memory_resource { { } + ~owning_wrapper() override = default; + /** * @briefreturn{A constant reference to the wrapped resource} */ diff --git a/cpp/include/rmm/mr/pinned_host_memory_resource.hpp b/cpp/include/rmm/mr/pinned_host_memory_resource.hpp index 684786457..d78fa0714 100644 --- a/cpp/include/rmm/mr/pinned_host_memory_resource.hpp +++ b/cpp/include/rmm/mr/pinned_host_memory_resource.hpp @@ -92,8 +92,8 @@ class pinned_host_memory_resource final : public device_memory_resource { { // TODO: Use the alignment parameter as an argument to do_deallocate std::size_t constexpr alignment = rmm::CUDA_ALLOCATION_ALIGNMENT; - rmm::detail::aligned_host_deallocate(ptr, bytes, alignment, [](void* ptr) { - RMM_ASSERT_CUDA_SUCCESS_SAFE_SHUTDOWN(cudaFreeHost(ptr)); + rmm::detail::aligned_host_deallocate(ptr, bytes, alignment, [](void* p) { + RMM_ASSERT_CUDA_SUCCESS_SAFE_SHUTDOWN(cudaFreeHost(p)); }); } diff --git a/cpp/include/rmm/mr/system_memory_resource.hpp b/cpp/include/rmm/mr/system_memory_resource.hpp index b2c646d5f..f69c34fea 100644 --- a/cpp/include/rmm/mr/system_memory_resource.hpp +++ b/cpp/include/rmm/mr/system_memory_resource.hpp @@ -121,7 +121,7 @@ class system_memory_resource final : public device_memory_resource { stream.synchronize(); rmm::detail::aligned_host_deallocate( - ptr, bytes, CUDA_ALLOCATION_ALIGNMENT, [](void* ptr) { ::operator delete(ptr); }); + ptr, bytes, CUDA_ALLOCATION_ALIGNMENT, [](void* p) { ::operator delete(p); }); } /** diff --git a/cpp/src/cuda_stream.cpp b/cpp/src/cuda_stream.cpp index a0ff49872..e043f9c19 100644 --- a/cpp/src/cuda_stream.cpp +++ b/cpp/src/cuda_stream.cpp @@ -13,12 +13,12 @@ namespace rmm { -cuda_stream::cuda_stream(cuda_stream::flags flags) - : stream_{[flags]() { +cuda_stream::cuda_stream(cuda_stream::flags stream_flags) + : stream_{[stream_flags]() { auto* stream = new cudaStream_t; // NOLINT(cppcoreguidelines-owning-memory) // TODO: use std::to_underlying once C++23 is allowed. RMM_CUDA_TRY(cudaStreamCreateWithFlags( - stream, static_cast>(flags))); + stream, static_cast>(stream_flags))); return stream; }(), [](cudaStream_t* stream) { diff --git a/cpp/src/exec_policy.cpp b/cpp/src/exec_policy.cpp index 517e3de5d..5cb9c1cf0 100644 --- a/cpp/src/exec_policy.cpp +++ b/cpp/src/exec_policy.cpp @@ -7,15 +7,14 @@ namespace rmm { -exec_policy::exec_policy(cuda_stream_view stream, device_async_resource_ref mr) - : thrust_exec_policy_t( - thrust::cuda::par(mr::thrust_allocator(stream, mr)).on(stream.value())) +exec_policy::exec_policy(cuda_stream_view strm, device_async_resource_ref mr) + : thrust_exec_policy_t(thrust::cuda::par(mr::thrust_allocator(strm, mr)).on(strm.value())) { } -exec_policy_nosync::exec_policy_nosync(cuda_stream_view stream, device_async_resource_ref mr) +exec_policy_nosync::exec_policy_nosync(cuda_stream_view strm, device_async_resource_ref mr) : thrust_exec_policy_nosync_t( - thrust::cuda::par_nosync(mr::thrust_allocator(stream, mr)).on(stream.value())) + thrust::cuda::par_nosync(mr::thrust_allocator(strm, mr)).on(strm.value())) { } diff --git a/cpp/src/logger.cpp b/cpp/src/logger.cpp index 7984615d1..8430aab9a 100644 --- a/cpp/src/logger.cpp +++ b/cpp/src/logger.cpp @@ -25,9 +25,9 @@ std::string default_pattern() { return "[%6t][%H:%M:%S:%f][%-6l] %v"; } rapids_logger::logger& default_logger() { static rapids_logger::logger logger_ = [] { - rapids_logger::logger logger_{"RMM", {default_sink()}}; - logger_.set_pattern(default_pattern()); - return logger_; + rapids_logger::logger lgr{"RMM", {default_sink()}}; + lgr.set_pattern(default_pattern()); + return lgr; }(); return logger_; } diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index afa879127..51d415523 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -9,8 +9,19 @@ option(DISABLE_DEPRECATION_WARNING "Disable warnings generated from deprecated declarations." OFF) option(CODE_COVERAGE "Enable generating code coverage with gcov." OFF) -set(RMM_TESTS_CXX_FLAGS -Wall -Werror -Wextra -Wsign-conversion -Wno-unknown-pragmas) -set(RMM_TESTS_CUDA_FLAGS -Werror=all-warnings -Xcompiler=-Wall,-Werror,-Wextra,-Wsign-conversion) +set(RMM_TESTS_CXX_FLAGS + -Wall + -Werror + -Wextra + -Wshadow + -Wnon-virtual-dtor + -Woverloaded-virtual + + -Wsign-conversion + -Wno-unknown-pragmas) +set(RMM_TESTS_CUDA_FLAGS + -Werror=all-warnings + -Xcompiler=-Wall,-Werror,-Wextra,-Wshadow,-Wnon-virtual-dtor,-Woverloaded-virtual,-Wsign-conversion) include(rapids-test) rapids_test_init() diff --git a/cpp/tests/cuda_stream_pool_tests.cpp b/cpp/tests/cuda_stream_pool_tests.cpp index 7258ba567..0f0677753 100644 --- a/cpp/tests/cuda_stream_pool_tests.cpp +++ b/cpp/tests/cuda_stream_pool_tests.cpp @@ -19,7 +19,7 @@ struct CudaStreamPoolTest : public ::testing::Test { TEST_F(CudaStreamPoolTest, ZeroSizePoolException) { - EXPECT_THROW(rmm::cuda_stream_pool pool{0}, rmm::logic_error); + EXPECT_THROW(rmm::cuda_stream_pool local_pool{0}, rmm::logic_error); } TEST_F(CudaStreamPoolTest, Unequal) @@ -83,9 +83,9 @@ TEST_F(CudaStreamPoolTest, CreateDefault) TEST_F(CudaStreamPoolTest, CreateNonBlocking) { - rmm::cuda_stream_pool pool{2, rmm::cuda_stream::flags::non_blocking}; - for (std::size_t i = 0; i < pool.get_pool_size(); i++) { - auto stream = pool.get_stream(i); + rmm::cuda_stream_pool local_pool{2, rmm::cuda_stream::flags::non_blocking}; + for (std::size_t i = 0; i < local_pool.get_pool_size(); i++) { + auto stream = local_pool.get_stream(i); unsigned int flags; RMM_CUDA_TRY(cudaStreamGetFlags(stream.value(), &flags)); EXPECT_EQ(flags, cudaStreamNonBlocking); diff --git a/cpp/tests/device_buffer_tests.cu b/cpp/tests/device_buffer_tests.cu index 04ea1be98..c445bd6e7 100644 --- a/cpp/tests/device_buffer_tests.cu +++ b/cpp/tests/device_buffer_tests.cu @@ -300,20 +300,20 @@ TYPED_TEST(DeviceBufferTest, CopyCapacityLargerThanSizeExplicitMr) TYPED_TEST(DeviceBufferTest, MoveConstructor) { rmm::device_buffer buff(this->size, rmm::cuda_stream_default, &this->mr); - auto* ptr = buff.data(); - auto size = buff.size(); - auto capacity = buff.capacity(); - auto mr = buff.memory_resource(); - auto stream = buff.stream(); + auto* ptr = buff.data(); + auto buff_size = buff.size(); + auto capacity = buff.capacity(); + auto buff_mr = buff.memory_resource(); + auto buff_stream = buff.stream(); // New buffer should have the same contents as the original rmm::device_buffer buff_new(std::move(buff)); EXPECT_NE(nullptr, buff_new.data()); EXPECT_EQ(ptr, buff_new.data()); - EXPECT_EQ(size, buff_new.size()); + EXPECT_EQ(buff_size, buff_new.size()); EXPECT_EQ(capacity, buff_new.capacity()); - EXPECT_EQ(stream, buff_new.stream()); - EXPECT_EQ(mr, buff_new.memory_resource()); + EXPECT_EQ(buff_stream, buff_new.stream()); + EXPECT_EQ(buff_mr, buff_new.memory_resource()); // Original buffer should be empty EXPECT_EQ(nullptr, @@ -327,21 +327,21 @@ TYPED_TEST(DeviceBufferTest, MoveConstructorStream) { rmm::device_buffer buff(this->size, this->stream, &this->mr); this->stream.synchronize(); - auto* ptr = buff.data(); - auto size = buff.size(); - auto capacity = buff.capacity(); - auto mr = buff.memory_resource(); - auto stream = buff.stream(); + auto* ptr = buff.data(); + auto buff_size = buff.size(); + auto capacity = buff.capacity(); + auto buff_mr = buff.memory_resource(); + auto buff_stream = buff.stream(); // New buffer should have the same contents as the original rmm::device_buffer buff_new(std::move(buff)); this->stream.synchronize(); EXPECT_NE(nullptr, buff_new.data()); EXPECT_EQ(ptr, buff_new.data()); - EXPECT_EQ(size, buff_new.size()); + EXPECT_EQ(buff_size, buff_new.size()); EXPECT_EQ(capacity, buff_new.capacity()); - EXPECT_EQ(stream, buff_new.stream()); - EXPECT_EQ(mr, buff_new.memory_resource()); + EXPECT_EQ(buff_stream, buff_new.stream()); + EXPECT_EQ(buff_mr, buff_new.memory_resource()); // Original buffer should be empty EXPECT_EQ(nullptr, @@ -354,11 +354,11 @@ TYPED_TEST(DeviceBufferTest, MoveConstructorStream) TYPED_TEST(DeviceBufferTest, MoveAssignmentToDefault) { rmm::device_buffer src(this->size, rmm::cuda_stream_default, &this->mr); - auto* ptr = src.data(); - auto size = src.size(); - auto capacity = src.capacity(); - auto mr = src.memory_resource(); - auto stream = src.stream(); + auto* ptr = src.data(); + auto buff_size = src.size(); + auto capacity = src.capacity(); + auto buff_mr = src.memory_resource(); + auto buff_stream = src.stream(); rmm::device_buffer dest; dest = std::move(src); @@ -366,10 +366,10 @@ TYPED_TEST(DeviceBufferTest, MoveAssignmentToDefault) // contents of `from` should be in `to` EXPECT_NE(nullptr, dest.data()); EXPECT_EQ(ptr, dest.data()); - EXPECT_EQ(size, dest.size()); + EXPECT_EQ(buff_size, dest.size()); EXPECT_EQ(capacity, dest.capacity()); - EXPECT_EQ(stream, dest.stream()); - EXPECT_EQ(mr, dest.memory_resource()); + EXPECT_EQ(buff_stream, dest.stream()); + EXPECT_EQ(buff_mr, dest.memory_resource()); // `from` should be empty EXPECT_EQ(nullptr, src.data()); // NOLINT(bugprone-use-after-move,clang-analyzer-cplusplus.Move) @@ -381,11 +381,11 @@ TYPED_TEST(DeviceBufferTest, MoveAssignmentToDefault) TYPED_TEST(DeviceBufferTest, MoveAssignment) { rmm::device_buffer src(this->size, rmm::cuda_stream_default, &this->mr); - auto* ptr = src.data(); - auto size = src.size(); - auto capacity = src.capacity(); - auto mr = src.memory_resource(); - auto stream = src.stream(); + auto* ptr = src.data(); + auto buff_size = src.size(); + auto capacity = src.capacity(); + auto buff_mr = src.memory_resource(); + auto buff_stream = src.stream(); rmm::device_buffer dest(this->size - 1, rmm::cuda_stream_default, &this->mr); dest = std::move(src); @@ -393,10 +393,10 @@ TYPED_TEST(DeviceBufferTest, MoveAssignment) // contents of `from` should be in `to` EXPECT_NE(nullptr, dest.data()); EXPECT_EQ(ptr, dest.data()); - EXPECT_EQ(size, dest.size()); + EXPECT_EQ(buff_size, dest.size()); EXPECT_EQ(capacity, dest.capacity()); - EXPECT_EQ(stream, dest.stream()); - EXPECT_EQ(mr, dest.memory_resource()); + EXPECT_EQ(buff_stream, dest.stream()); + EXPECT_EQ(buff_mr, dest.memory_resource()); // `from` should be empty EXPECT_EQ(nullptr, src.data()); // NOLINT(bugprone-use-after-move,clang-analyzer-cplusplus.Move) @@ -408,11 +408,11 @@ TYPED_TEST(DeviceBufferTest, MoveAssignment) TYPED_TEST(DeviceBufferTest, SelfMoveAssignment) { rmm::device_buffer buff(this->size, rmm::cuda_stream_default, &this->mr); - auto* ptr = buff.data(); - auto size = buff.size(); - auto capacity = buff.capacity(); - auto mr = buff.memory_resource(); - auto stream = buff.stream(); + auto* ptr = buff.data(); + auto buff_size = buff.size(); + auto capacity = buff.capacity(); + auto buff_mr = buff.memory_resource(); + auto buff_stream = buff.stream(); #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wself-move" @@ -420,10 +420,10 @@ TYPED_TEST(DeviceBufferTest, SelfMoveAssignment) #pragma GCC diagnostic pop EXPECT_NE(nullptr, buff.data()); // NOLINT(bugprone-use-after-move,clang-analyzer-cplusplus.Move) EXPECT_EQ(ptr, buff.data()); - EXPECT_EQ(size, buff.size()); + EXPECT_EQ(buff_size, buff.size()); EXPECT_EQ(capacity, buff.capacity()); - EXPECT_EQ(stream, buff.stream()); - EXPECT_EQ(mr, buff.memory_resource()); + EXPECT_EQ(buff_stream, buff.stream()); + EXPECT_EQ(buff_mr, buff.memory_resource()); } TYPED_TEST(DeviceBufferTest, ResizeSmaller) diff --git a/cpp/tests/mr/aligned_mr_tests.cpp b/cpp/tests/mr/aligned_mr_tests.cpp index 14543b0b9..8b3007e0e 100644 --- a/cpp/tests/mr/aligned_mr_tests.cpp +++ b/cpp/tests/mr/aligned_mr_tests.cpp @@ -38,11 +38,11 @@ INSTANTIATE_TEST_SUITE_P(AlignedTest, allocation_size, ::testing::Values(0, 256) TEST_P(allocation_size, MultiThreaded) { - const std::size_t allocation_size = GetParam(); - auto upstream = rmm::mr::cuda_memory_resource{}; - auto delayed = delayed_memory_resource(upstream, std::chrono::milliseconds{300}); - auto mr = rmm::mr::aligned_resource_adaptor(delayed); - auto stream = rmm::cuda_stream{}; + const std::size_t alloc_size = GetParam(); + auto upstream = rmm::mr::cuda_memory_resource{}; + auto delayed = delayed_memory_resource(upstream, std::chrono::milliseconds{300}); + auto mr = rmm::mr::aligned_resource_adaptor(delayed); + auto stream = rmm::cuda_stream{}; // Provoke interleaving to test that aligned allocations are updated with correct ordering // relative to upstream deallocate. The delayed memory resource frees the pointer upstream // immediately then sleeps, simulating the window where the address is available for reuse @@ -62,14 +62,14 @@ TEST_P(allocation_size, MultiThreaded) threads.emplace_back([&, i = i]() { void* ptr{nullptr}; if (i != 0) { std::this_thread::sleep_for(std::chrono::milliseconds{100}); } - EXPECT_NO_THROW(ptr = mr.allocate(stream, allocation_size)); - if (allocation_size != 0) { + EXPECT_NO_THROW(ptr = mr.allocate(stream, alloc_size)); + if (alloc_size != 0) { EXPECT_NE(ptr, nullptr); } else { EXPECT_EQ(ptr, nullptr); } if (i == 0) { std::this_thread::sleep_for(std::chrono::milliseconds{100}); } - mr.deallocate(stream, ptr, allocation_size); + mr.deallocate(stream, ptr, alloc_size); }); } for (auto& t : threads) { diff --git a/cpp/tests/mr/arena_mr_tests.cpp b/cpp/tests/mr/arena_mr_tests.cpp index 0c288d9db..afb55e4b9 100644 --- a/cpp/tests/mr/arena_mr_tests.cpp +++ b/cpp/tests/mr/arena_mr_tests.cpp @@ -508,8 +508,8 @@ TEST_F(ArenaTest, SmallMediumLarge) // NOLINT TEST_F(ArenaTest, Defragment) // NOLINT { EXPECT_NO_THROW([]() { // NOLINT(cppcoreguidelines-avoid-goto) - auto const arena_size = superblock::minimum_size * 4; - arena_mr mr(rmm::mr::get_current_device_resource_ref(), arena_size); + auto const local_arena_size = superblock::minimum_size * 4; + arena_mr mr(rmm::mr::get_current_device_resource_ref(), local_arena_size); std::vector threads; std::size_t num_threads{4}; threads.reserve(num_threads); @@ -524,8 +524,8 @@ TEST_F(ArenaTest, Defragment) // NOLINT thread.join(); } - auto* ptr = mr.allocate_sync(arena_size); - mr.deallocate_sync(ptr, arena_size); + auto* ptr = mr.allocate_sync(local_arena_size); + mr.deallocate_sync(ptr, local_arena_size); }()); } @@ -535,8 +535,8 @@ TEST_F(ArenaTest, PerThreadToStreamDealloc) // NOLINT // it was originally allocated in a superblock that was in a thread // arena that then moved to global arena during a defragmentation // and then moved to a stream arena. - auto const arena_size = superblock::minimum_size * 2; - arena_mr mr(rmm::mr::get_current_device_resource_ref(), arena_size); + auto const local_arena_size = superblock::minimum_size * 2; + arena_mr mr(rmm::mr::get_current_device_resource_ref(), local_arena_size); // Create an allocation from a per thread arena void* thread_ptr = mr.allocate(rmm::cuda_stream_per_thread, 256); // Create an allocation in a stream arena to force global arena diff --git a/cpp/tests/mr/callback_mr_tests.cpp b/cpp/tests/mr/callback_mr_tests.cpp index 75d98cf64..9e44ea62c 100644 --- a/cpp/tests/mr/callback_mr_tests.cpp +++ b/cpp/tests/mr/callback_mr_tests.cpp @@ -31,12 +31,12 @@ TEST(CallbackTest, TestCallbacksAreInvoked) EXPECT_CALL(base_mr, do_deallocate(_, 10_MiB, cuda_stream_view{})).Times(1); auto allocate_callback = [](std::size_t size, cuda_stream_view stream, void* arg) { - auto base_mr = *static_cast(arg); - return base_mr.allocate(stream, size); + auto local_mr = *static_cast(arg); + return local_mr.allocate(stream, size); }; auto deallocate_callback = [](void* ptr, std::size_t size, cuda_stream_view stream, void* arg) { - auto base_mr = *static_cast(arg); - base_mr.deallocate(stream, ptr, size); + auto local_mr = *static_cast(arg); + local_mr.deallocate(stream, ptr, size); }; auto mr = rmm::mr::callback_memory_resource(allocate_callback, deallocate_callback, &base_ref, &base_ref); @@ -52,14 +52,14 @@ TEST(CallbackTest, LoggingTest) auto base_mr = rmm::mr::get_current_device_resource_ref(); auto allocate_callback = [](std::size_t size, cuda_stream_view stream, void* arg) { std::cout << "Allocating " << size << " bytes" << std::endl; - auto base_mr = *static_cast(arg); - return base_mr.allocate(stream, size); + auto local_mr = *static_cast(arg); + return local_mr.allocate(stream, size); }; auto deallocate_callback = [](void* ptr, std::size_t size, cuda_stream_view stream, void* arg) { std::cout << "Deallocating " << size << " bytes" << std::endl; - auto base_mr = *static_cast(arg); - base_mr.deallocate(stream, ptr, size); + auto local_mr = *static_cast(arg); + local_mr.deallocate(stream, ptr, size); }; auto mr = rmm::mr::callback_memory_resource(allocate_callback, deallocate_callback, &base_mr, &base_mr); diff --git a/cpp/tests/mr/host_mr_ref_tests.cpp b/cpp/tests/mr/host_mr_ref_tests.cpp index 73e330546..93d82cb39 100644 --- a/cpp/tests/mr/host_mr_ref_tests.cpp +++ b/cpp/tests/mr/host_mr_ref_tests.cpp @@ -52,7 +52,7 @@ constexpr std::size_t size_pb{1_PiB}; struct allocation { void* ptr{nullptr}; std::size_t size{0}; - allocation(void* ptr, std::size_t size) : ptr{ptr}, size{size} {} + allocation(void* p, std::size_t sz) : ptr{p}, size{sz} {} allocation() = default; }; } // namespace diff --git a/cpp/tests/mr/hwdecompress_tests.cpp b/cpp/tests/mr/hwdecompress_tests.cpp index 9853df1a5..391bb5142 100644 --- a/cpp/tests/mr/hwdecompress_tests.cpp +++ b/cpp/tests/mr/hwdecompress_tests.cpp @@ -18,7 +18,7 @@ namespace { class HWDecompressTest : public ::testing::Test { protected: - static void check_decompress_capable(void* ptr) + static void check_decompress_capable([[maybe_unused]] void* ptr) { #if defined(CUDA_VERSION) && CUDA_VERSION >= RMM_MIN_HWDECOMPRESS_CUDA_DRIVER_VERSION if (rmm::detail::hwdecompress::is_supported()) { diff --git a/cpp/tests/mr/mr_ref_arena_tests.cpp b/cpp/tests/mr/mr_ref_arena_tests.cpp index 3a73c78cd..8d966f435 100644 --- a/cpp/tests/mr/mr_ref_arena_tests.cpp +++ b/cpp/tests/mr/mr_ref_arena_tests.cpp @@ -13,17 +13,17 @@ namespace { INSTANTIATE_TEST_SUITE_P(ArenaResourceTests, mr_ref_test, ::testing::Values("Arena"), - [](auto const& info) { return info.param; }); + [](auto const& test_info) { return test_info.param; }); INSTANTIATE_TEST_SUITE_P(ArenaResourceAllocationTests, mr_ref_allocation_test, ::testing::Values("Arena"), - [](auto const& info) { return info.param; }); + [](auto const& test_info) { return test_info.param; }); INSTANTIATE_TEST_SUITE_P(ArenaMultiThreadResourceTests, mr_ref_test_mt, ::testing::Values("Arena"), - [](auto const& info) { return info.param; }); + [](auto const& test_info) { return test_info.param; }); } // namespace } // namespace rmm::test diff --git a/cpp/tests/mr/mr_ref_binning_tests.cpp b/cpp/tests/mr/mr_ref_binning_tests.cpp index 0c6308e05..929f0209e 100644 --- a/cpp/tests/mr/mr_ref_binning_tests.cpp +++ b/cpp/tests/mr/mr_ref_binning_tests.cpp @@ -13,17 +13,17 @@ namespace { INSTANTIATE_TEST_SUITE_P(BinningResourceTests, mr_ref_test, ::testing::Values("Binning"), - [](auto const& info) { return info.param; }); + [](auto const& test_info) { return test_info.param; }); INSTANTIATE_TEST_SUITE_P(BinningResourceAllocationTests, mr_ref_allocation_test, ::testing::Values("Binning"), - [](auto const& info) { return info.param; }); + [](auto const& test_info) { return test_info.param; }); INSTANTIATE_TEST_SUITE_P(BinningMultiThreadResourceTests, mr_ref_test_mt, ::testing::Values("Binning"), - [](auto const& info) { return info.param; }); + [](auto const& test_info) { return test_info.param; }); } // namespace } // namespace rmm::test diff --git a/cpp/tests/mr/mr_ref_cuda_async_tests.cpp b/cpp/tests/mr/mr_ref_cuda_async_tests.cpp index ce08183ba..741bd7ac4 100644 --- a/cpp/tests/mr/mr_ref_cuda_async_tests.cpp +++ b/cpp/tests/mr/mr_ref_cuda_async_tests.cpp @@ -13,17 +13,17 @@ namespace { INSTANTIATE_TEST_SUITE_P(CudaAsyncResourceTests, mr_ref_test, ::testing::Values("CUDA_Async"), - [](auto const& info) { return info.param; }); + [](auto const& test_info) { return test_info.param; }); INSTANTIATE_TEST_SUITE_P(CudaAsyncResourceAllocationTests, mr_ref_allocation_test, ::testing::Values("CUDA_Async"), - [](auto const& info) { return info.param; }); + [](auto const& test_info) { return test_info.param; }); INSTANTIATE_TEST_SUITE_P(CudaAsyncMultiThreadResourceTests, mr_ref_test_mt, ::testing::Values("CUDA_Async"), - [](auto const& info) { return info.param; }); + [](auto const& test_info) { return test_info.param; }); } // namespace } // namespace rmm::test diff --git a/cpp/tests/mr/mr_ref_cuda_tests.cpp b/cpp/tests/mr/mr_ref_cuda_tests.cpp index 5c9616998..5c0850650 100644 --- a/cpp/tests/mr/mr_ref_cuda_tests.cpp +++ b/cpp/tests/mr/mr_ref_cuda_tests.cpp @@ -13,17 +13,17 @@ namespace { INSTANTIATE_TEST_SUITE_P(CudaResourceTests, mr_ref_test, ::testing::Values("CUDA"), - [](auto const& info) { return info.param; }); + [](auto const& test_info) { return test_info.param; }); INSTANTIATE_TEST_SUITE_P(CudaResourceAllocationTests, mr_ref_allocation_test, ::testing::Values("CUDA"), - [](auto const& info) { return info.param; }); + [](auto const& test_info) { return test_info.param; }); INSTANTIATE_TEST_SUITE_P(CudaMultiThreadResourceTests, mr_ref_test_mt, ::testing::Values("CUDA"), - [](auto const& info) { return info.param; }); + [](auto const& test_info) { return test_info.param; }); } // namespace } // namespace rmm::test diff --git a/cpp/tests/mr/mr_ref_fixed_size_tests.cpp b/cpp/tests/mr/mr_ref_fixed_size_tests.cpp index 1c2e001dc..7db958174 100644 --- a/cpp/tests/mr/mr_ref_fixed_size_tests.cpp +++ b/cpp/tests/mr/mr_ref_fixed_size_tests.cpp @@ -12,7 +12,7 @@ namespace { INSTANTIATE_TEST_SUITE_P(FixedSizeResourceTests, mr_ref_test, ::testing::Values("Fixed_Size"), - [](auto const& info) { return info.param; }); + [](auto const& test_info) { return test_info.param; }); } // namespace } // namespace rmm::test diff --git a/cpp/tests/mr/mr_ref_managed_tests.cpp b/cpp/tests/mr/mr_ref_managed_tests.cpp index 5a57486e6..578009cf9 100644 --- a/cpp/tests/mr/mr_ref_managed_tests.cpp +++ b/cpp/tests/mr/mr_ref_managed_tests.cpp @@ -13,17 +13,17 @@ namespace { INSTANTIATE_TEST_SUITE_P(ManagedResourceTests, mr_ref_test, ::testing::Values("Managed"), - [](auto const& info) { return info.param; }); + [](auto const& test_info) { return test_info.param; }); INSTANTIATE_TEST_SUITE_P(ManagedResourceAllocationTests, mr_ref_allocation_test, ::testing::Values("Managed"), - [](auto const& info) { return info.param; }); + [](auto const& test_info) { return test_info.param; }); INSTANTIATE_TEST_SUITE_P(ManagedMultiThreadResourceTests, mr_ref_test_mt, ::testing::Values("Managed"), - [](auto const& info) { return info.param; }); + [](auto const& test_info) { return test_info.param; }); } // namespace } // namespace rmm::test diff --git a/cpp/tests/mr/mr_ref_pinned_pool_tests.cpp b/cpp/tests/mr/mr_ref_pinned_pool_tests.cpp index d6e1910a0..21e12a661 100644 --- a/cpp/tests/mr/mr_ref_pinned_pool_tests.cpp +++ b/cpp/tests/mr/mr_ref_pinned_pool_tests.cpp @@ -12,12 +12,12 @@ namespace { INSTANTIATE_TEST_SUITE_P(PinnedPoolResourceTests, mr_ref_test, ::testing::Values("PinnedPool"), - [](auto const& info) { return info.param; }); + [](auto const& test_info) { return test_info.param; }); INSTANTIATE_TEST_SUITE_P(PinnedPoolResourceAllocationTests, mr_ref_allocation_test, ::testing::Values("PinnedPool"), - [](auto const& info) { return info.param; }); + [](auto const& test_info) { return test_info.param; }); } // namespace } // namespace rmm::test diff --git a/cpp/tests/mr/mr_ref_pinned_tests.cpp b/cpp/tests/mr/mr_ref_pinned_tests.cpp index f073a5e9b..b24398eae 100644 --- a/cpp/tests/mr/mr_ref_pinned_tests.cpp +++ b/cpp/tests/mr/mr_ref_pinned_tests.cpp @@ -12,12 +12,12 @@ namespace { INSTANTIATE_TEST_SUITE_P(PinnedResourceTests, mr_ref_test, ::testing::Values("Pinned"), - [](auto const& info) { return info.param; }); + [](auto const& test_info) { return test_info.param; }); INSTANTIATE_TEST_SUITE_P(PinnedResourceAllocationTests, mr_ref_allocation_test, ::testing::Values("Pinned"), - [](auto const& info) { return info.param; }); + [](auto const& test_info) { return test_info.param; }); } // namespace } // namespace rmm::test diff --git a/cpp/tests/mr/mr_ref_pool_tests.cpp b/cpp/tests/mr/mr_ref_pool_tests.cpp index 176792869..fb0f3a52f 100644 --- a/cpp/tests/mr/mr_ref_pool_tests.cpp +++ b/cpp/tests/mr/mr_ref_pool_tests.cpp @@ -13,17 +13,17 @@ namespace { INSTANTIATE_TEST_SUITE_P(PoolResourceTests, mr_ref_test, ::testing::Values("Pool"), - [](auto const& info) { return info.param; }); + [](auto const& test_info) { return test_info.param; }); INSTANTIATE_TEST_SUITE_P(PoolResourceAllocationTests, mr_ref_allocation_test, ::testing::Values("Pool"), - [](auto const& info) { return info.param; }); + [](auto const& test_info) { return test_info.param; }); INSTANTIATE_TEST_SUITE_P(PoolMultiThreadResourceTests, mr_ref_test_mt, ::testing::Values("Pool"), - [](auto const& info) { return info.param; }); + [](auto const& test_info) { return test_info.param; }); } // namespace } // namespace rmm::test diff --git a/cpp/tests/mr/mr_ref_system_tests.cpp b/cpp/tests/mr/mr_ref_system_tests.cpp index ca640eb97..adfd36b9c 100644 --- a/cpp/tests/mr/mr_ref_system_tests.cpp +++ b/cpp/tests/mr/mr_ref_system_tests.cpp @@ -12,12 +12,12 @@ namespace { INSTANTIATE_TEST_SUITE_P(SystemResourceTests, mr_ref_test, ::testing::Values("System"), - [](auto const& info) { return info.param; }); + [](auto const& test_info) { return test_info.param; }); INSTANTIATE_TEST_SUITE_P(SystemResourceAllocationTests, mr_ref_allocation_test, ::testing::Values("System"), - [](auto const& info) { return info.param; }); + [](auto const& test_info) { return test_info.param; }); } // namespace } // namespace rmm::test diff --git a/cpp/tests/mr/mr_ref_test.hpp b/cpp/tests/mr/mr_ref_test.hpp index 4b4f091bf..d5818fd17 100644 --- a/cpp/tests/mr/mr_ref_test.hpp +++ b/cpp/tests/mr/mr_ref_test.hpp @@ -85,7 +85,7 @@ constexpr size_in_bytes default_max_size{5_MiB}; struct allocation { void* ptr{nullptr}; std::size_t size{0}; - allocation(void* ptr, std::size_t size) : ptr{ptr}, size{size} {} + allocation(void* p, std::size_t sz) : ptr{p}, size{sz} {} allocation() = default; }; @@ -442,8 +442,8 @@ struct mr_factory_base { /// Encapsulates a memory resource factory function and associated name template struct mr_factory : mr_factory_base { - mr_factory(std::string_view name, MRFactoryFunc factory) - : mr_factory_base{std::string{name}}, owned_mr{std::move(factory())} + mr_factory(std::string_view factory_name, MRFactoryFunc factory) + : mr_factory_base{std::string{factory_name}}, owned_mr{std::move(factory())} { if (owned_mr == nullptr) { skip_test = true; diff --git a/cpp/tests/mr/mr_ref_test_basic.hpp b/cpp/tests/mr/mr_ref_test_basic.hpp index ff38d2b91..7e6ce241f 100644 --- a/cpp/tests/mr/mr_ref_test_basic.hpp +++ b/cpp/tests/mr/mr_ref_test_basic.hpp @@ -13,8 +13,8 @@ namespace rmm::test { TEST_P(mr_ref_test, SetCurrentDeviceResourceRef) { - rmm::mr::cuda_memory_resource cuda_mr{}; - auto cuda_ref = rmm::device_async_resource_ref{cuda_mr}; + rmm::mr::cuda_memory_resource local_cuda_mr{}; + auto cuda_ref = rmm::device_async_resource_ref{local_cuda_mr}; rmm::mr::set_current_device_resource_ref(cuda_ref); auto old = rmm::mr::set_current_device_resource_ref(this->ref); diff --git a/cpp/tests/mr/pool_mr_tests.cpp b/cpp/tests/mr/pool_mr_tests.cpp index 3ff854068..58c875aec 100644 --- a/cpp/tests/mr/pool_mr_tests.cpp +++ b/cpp/tests/mr/pool_mr_tests.cpp @@ -48,9 +48,8 @@ TEST(PoolTest, ThrowMaxLessThanInitial) TEST(PoolTest, AllocateNinetyPercent) { auto allocate_ninety = []() { - auto const [free, total] = rmm::available_device_memory(); - (void)total; - auto const ninety_percent_pool = rmm::percent_of_free_device_memory(90); + [[maybe_unused]] auto const [free, total] = rmm::available_device_memory(); + auto const ninety_percent_pool = rmm::percent_of_free_device_memory(90); pool_mr mr{rmm::mr::get_current_device_resource_ref(), ninety_percent_pool}; }; EXPECT_NO_THROW(allocate_ninety()); diff --git a/cpp/tests/mr/prefetch_resource_adaptor_tests.cpp b/cpp/tests/mr/prefetch_resource_adaptor_tests.cpp index 00ed54272..acfa04a60 100644 --- a/cpp/tests/mr/prefetch_resource_adaptor_tests.cpp +++ b/cpp/tests/mr/prefetch_resource_adaptor_tests.cpp @@ -37,7 +37,7 @@ struct PrefetchAdaptorTest : public ::testing::Test { } // Test that the memory range was last prefetched to the specified device - void expect_prefetched(void const* ptr, std::size_t size, rmm::cuda_device_id device) + void expect_prefetched(void const* ptr, std::size_t num_bytes, rmm::cuda_device_id device) { if constexpr (std::is_same_v) { // Skip the test if concurrent managed access is not supported @@ -56,7 +56,7 @@ struct PrefetchAdaptorTest : public ::testing::Test { prefetch_data_size, cudaMemRangeAttribute::cudaMemRangeAttributeLastPrefetchLocation, ptr, - size)); + num_bytes)); EXPECT_EQ(prefetch_location, device.value()); } } diff --git a/cpp/tests/mr/resource_ref_conversion_tests.cpp b/cpp/tests/mr/resource_ref_conversion_tests.cpp index dac965d14..10540ae19 100644 --- a/cpp/tests/mr/resource_ref_conversion_tests.cpp +++ b/cpp/tests/mr/resource_ref_conversion_tests.cpp @@ -38,7 +38,7 @@ class new_delete_memory_resource { std::size_t alignment = rmm::CUDA_ALLOCATION_ALIGNMENT) noexcept { rmm::detail::aligned_host_deallocate( - ptr, bytes, alignment, [](void* ptr) { ::operator delete(ptr); }); + ptr, bytes, alignment, [](void* p) { ::operator delete(p); }); } void deallocate([[maybe_unused]] cuda::stream_ref stream, diff --git a/cpp/tests/mr/statistics_mr_tests.cpp b/cpp/tests/mr/statistics_mr_tests.cpp index 3e1a09255..6fba2ea8f 100644 --- a/cpp/tests/mr/statistics_mr_tests.cpp +++ b/cpp/tests/mr/statistics_mr_tests.cpp @@ -37,11 +37,11 @@ INSTANTIATE_TEST_SUITE_P(StatisticsTest, allocation_size, ::testing::Values(0, 2 TEST_P(allocation_size, MultiThreaded) { - const std::size_t allocation_size = GetParam(); - auto upstream = rmm::mr::cuda_memory_resource{}; - auto delayed = delayed_memory_resource(upstream, std::chrono::milliseconds{300}); - auto mr = rmm::mr::statistics_resource_adaptor(delayed); - auto stream = rmm::cuda_stream{}; + const std::size_t alloc_size = GetParam(); + auto upstream = rmm::mr::cuda_memory_resource{}; + auto delayed = delayed_memory_resource(upstream, std::chrono::milliseconds{300}); + auto mr = rmm::mr::statistics_resource_adaptor(delayed); + auto stream = rmm::cuda_stream{}; // Provoke interleaving to test that statistics counters are updated with correct ordering // relative to upstream deallocate. The delayed memory resource frees the pointer upstream // immediately then sleeps, simulating the window where the address is available for reuse @@ -61,14 +61,14 @@ TEST_P(allocation_size, MultiThreaded) threads.emplace_back([&, i = i]() { void* ptr{nullptr}; if (i != 0) { std::this_thread::sleep_for(std::chrono::milliseconds{100}); } - EXPECT_NO_THROW(ptr = mr.allocate(stream, allocation_size)); - if (allocation_size != 0) { + EXPECT_NO_THROW(ptr = mr.allocate(stream, alloc_size)); + if (alloc_size != 0) { EXPECT_NE(ptr, nullptr); } else { EXPECT_EQ(ptr, nullptr); } if (i == 0) { std::this_thread::sleep_for(std::chrono::milliseconds{100}); } - mr.deallocate(stream, ptr, allocation_size); + mr.deallocate(stream, ptr, alloc_size); }); } for (auto& t : threads) { @@ -77,7 +77,7 @@ TEST_P(allocation_size, MultiThreaded) EXPECT_EQ(mr.get_bytes_counter().value, 0); EXPECT_EQ(mr.get_allocations_counter().value, 0); EXPECT_EQ(mr.get_allocations_counter().total, 2); - EXPECT_EQ(mr.get_bytes_counter().total, 2 * allocation_size); + EXPECT_EQ(mr.get_bytes_counter().total, 2 * alloc_size); } TEST(StatisticsTest, ThrowOnNullUpstream) diff --git a/cpp/tests/mr/thrust_allocator_tests.cu b/cpp/tests/mr/thrust_allocator_tests.cu index d63b08317..2da8401c8 100644 --- a/cpp/tests/mr/thrust_allocator_tests.cu +++ b/cpp/tests/mr/thrust_allocator_tests.cu @@ -47,9 +47,9 @@ TEST_P(allocator_test, multi_device) { if (rmm::get_num_cuda_devices() < 2) { GTEST_SKIP() << "Needs at least two devices"; } cuda_set_device_raii with_device{rmm::get_current_cuda_device()}; - rmm::cuda_stream stream{}; + rmm::cuda_stream local_stream{}; // make allocator on device-0 - rmm::mr::thrust_allocator allocator(stream.view(), this->ref); + rmm::mr::thrust_allocator allocator(local_stream.view(), this->ref); auto const size{100}; EXPECT_NO_THROW([&]() { auto vec = rmm::device_vector(size, allocator); @@ -62,7 +62,7 @@ INSTANTIATE_TEST_SUITE_P( ThrustAllocatorTests, allocator_test, ::testing::Values("CUDA", "CUDA_Async", "Managed", "Pool", "Arena", "Binning"), - [](auto const& info) { return info.param; }); + [](auto const& test_info) { return test_info.param; }); } // namespace } // namespace rmm::test diff --git a/cpp/tests/mr/tracking_mr_tests.cpp b/cpp/tests/mr/tracking_mr_tests.cpp index 440648706..5752dcfcf 100644 --- a/cpp/tests/mr/tracking_mr_tests.cpp +++ b/cpp/tests/mr/tracking_mr_tests.cpp @@ -39,8 +39,8 @@ INSTANTIATE_TEST_SUITE_P(TrackingTest, allocation_size, ::testing::Values(0, 256 TEST_P(allocation_size, MultiThreaded) { - const std::size_t allocation_size = GetParam(); - auto upstream = rmm::mr::cuda_memory_resource{}; + const std::size_t alloc_size = GetParam(); + auto upstream = rmm::mr::cuda_memory_resource{}; std::vector threads; auto delayed = delayed_memory_resource(upstream, std::chrono::milliseconds{300}); auto mr = rmm::mr::tracking_resource_adaptor(delayed); @@ -66,14 +66,14 @@ TEST_P(allocation_size, MultiThreaded) threads.emplace_back([&, i = i]() { void* ptr{nullptr}; if (i != 0) { std::this_thread::sleep_for(std::chrono::milliseconds{100}); } - EXPECT_NO_THROW(ptr = mr.allocate(stream, allocation_size)); - if (allocation_size != 0) { + EXPECT_NO_THROW(ptr = mr.allocate(stream, alloc_size)); + if (alloc_size != 0) { EXPECT_NE(ptr, nullptr); } else { EXPECT_EQ(ptr, nullptr); } if (i == 0) { std::this_thread::sleep_for(std::chrono::milliseconds{100}); } - mr.deallocate(stream, ptr, allocation_size); + mr.deallocate(stream, ptr, alloc_size); }); } for (auto& t : threads) { diff --git a/cpp/tests/prefetch_tests.cpp b/cpp/tests/prefetch_tests.cpp index 30fe0a647..b135e4043 100644 --- a/cpp/tests/prefetch_tests.cpp +++ b/cpp/tests/prefetch_tests.cpp @@ -37,7 +37,7 @@ struct PrefetchTest : public ::testing::Test { } // Test that the memory range was last prefetched to the specified device - void expect_prefetched(void const* ptr, std::size_t size, rmm::cuda_device_id device) + void expect_prefetched(void const* ptr, std::size_t num_bytes, rmm::cuda_device_id device) { if (!rmm::detail::concurrent_managed_access::is_supported()) { GTEST_SKIP() << "Skipping test: concurrent managed access not supported"; @@ -55,7 +55,7 @@ struct PrefetchTest : public ::testing::Test { prefetch_data_size, cudaMemRangeAttribute::cudaMemRangeAttributeLastPrefetchLocation, ptr, - size)); + num_bytes)); EXPECT_EQ(prefetch_location, device.value()); } }