Skip to content

Commit

Permalink
Apply IWYU changes and fix deprecated GTest usage
Browse files Browse the repository at this point in the history
  • Loading branch information
bdice committed Feb 11, 2025
1 parent 670dcbb commit 3fc1ff5
Show file tree
Hide file tree
Showing 31 changed files with 106 additions and 77 deletions.
4 changes: 2 additions & 2 deletions include/rmm/device_scalar.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024, NVIDIA CORPORATION.
* Copyright (c) 2019-2025, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -41,7 +41,7 @@ namespace RMM_NAMESPACE {
template <typename T>
class device_scalar {
public:
static_assert(std::is_trivially_copyable<T>::value, "Scalar type must be trivially copyable");
static_assert(std::is_trivially_copyable_v<T>, "Scalar type must be trivially copyable");

using value_type = typename device_uvector<T>::value_type; ///< T, the type of the scalar element
using size_type = typename device_uvector<T>::size_type; ///< The type used for the size
Expand Down
2 changes: 1 addition & 1 deletion include/rmm/device_uvector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ namespace RMM_NAMESPACE {
*/
template <typename T>
class device_uvector {
static_assert(std::is_trivially_copyable<T>::value,
static_assert(std::is_trivially_copyable_v<T>,
"device_uvector only supports types that are trivially copyable.");

public:
Expand Down
3 changes: 1 addition & 2 deletions include/rmm/mr/device/polymorphic_allocator.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2024, NVIDIA CORPORATION.
* Copyright (c) 2020-2025, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,7 +23,6 @@

#include <cstddef>
#include <memory>
#include <type_traits>

namespace RMM_NAMESPACE {
namespace mr {
Expand Down
3 changes: 1 addition & 2 deletions include/rmm/mr/device/pool_memory_resource.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2024, NVIDIA CORPORATION.
* Copyright (c) 2020-2025, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -33,7 +33,6 @@
#include <cuda_runtime_api.h>
#include <thrust/iterator/counting_iterator.h>
#include <thrust/iterator/transform_iterator.h>
#include <thrust/optional.h>

#include <algorithm>
#include <cstddef>
Expand Down
7 changes: 5 additions & 2 deletions tests/container_multidevice_tests.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2024, NVIDIA CORPORATION.
* Copyright (c) 2023-2025, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -22,17 +22,20 @@
#include <rmm/device_uvector.hpp>
#include <rmm/mr/device/per_device_resource.hpp>

#include <cuda_runtime_api.h>

#include <gtest/gtest.h>

#include <type_traits>
#include <utility>

template <typename ContainerType>
struct ContainerMultiDeviceTest : public ::testing::Test {};

using containers =
::testing::Types<rmm::device_buffer, rmm::device_uvector<int>, rmm::device_scalar<int>>;

TYPED_TEST_CASE(ContainerMultiDeviceTest, containers);
TYPED_TEST_SUITE(ContainerMultiDeviceTest, containers);

TYPED_TEST(ContainerMultiDeviceTest, CreateDestroyDifferentActiveDevice)
{
Expand Down
4 changes: 3 additions & 1 deletion tests/cuda_stream_pool_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2021, NVIDIA CORPORATION.
* Copyright (c) 2020-2025, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -22,6 +22,8 @@

#include <gtest/gtest.h>

#include <cstdint>

struct CudaStreamPoolTest : public ::testing::Test {
rmm::cuda_stream_pool pool{};
};
Expand Down
4 changes: 3 additions & 1 deletion tests/cuda_stream_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2024, NVIDIA CORPORATION.
* Copyright (c) 2020-2025, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,7 +23,9 @@
#include <gtest/gtest-death-test.h>
#include <gtest/gtest.h>

#include <memory>
#include <sstream>
#include <utility>

struct CudaStreamTest : public ::testing::Test {};

Expand Down
4 changes: 2 additions & 2 deletions tests/device_buffer_tests.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024, NVIDIA CORPORATION.
* Copyright (c) 2019-2025, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -60,7 +60,7 @@ struct DeviceBufferTest : public ::testing::Test {

using resources = ::testing::Types<rmm::mr::cuda_memory_resource, rmm::mr::managed_memory_resource>;

TYPED_TEST_CASE(DeviceBufferTest, resources);
TYPED_TEST_SUITE(DeviceBufferTest, resources);

TYPED_TEST(DeviceBufferTest, EmptyBuffer)
{
Expand Down
13 changes: 6 additions & 7 deletions tests/device_scalar_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024, NVIDIA CORPORATION.
* Copyright (c) 2019-2025, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -42,24 +42,23 @@ struct DeviceScalarTest : public ::testing::Test {

DeviceScalarTest() : value{random_value()} {}

template <typename U = T, std::enable_if_t<std::is_same<U, bool>::value, bool> = true>
template <typename U = T, std::enable_if_t<std::is_same_v<U, bool>, bool> = true>
U random_value()
{
static std::bernoulli_distribution distribution{};
return distribution(generator);
}

template <
typename U = T,
std::enable_if_t<(std::is_integral<U>::value && not std::is_same<U, bool>::value), bool> = true>
template <typename U = T,
std::enable_if_t<(std::is_integral_v<U> && not std::is_same_v<U, bool>), bool> = true>
U random_value()
{
static std::uniform_int_distribution<U> distribution{std::numeric_limits<T>::lowest(),
std::numeric_limits<T>::max()};
return distribution(generator);
}

template <typename U = T, std::enable_if_t<std::is_floating_point<U>::value, bool> = true>
template <typename U = T, std::enable_if_t<std::is_floating_point_v<U>, bool> = true>
U random_value()
{
auto const mean{100};
Expand All @@ -71,7 +70,7 @@ struct DeviceScalarTest : public ::testing::Test {

using Types = ::testing::Types<bool, int8_t, int16_t, int32_t, int64_t, float, double>;

TYPED_TEST_CASE(DeviceScalarTest, Types);
TYPED_TEST_SUITE(DeviceScalarTest, Types);

TYPED_TEST(DeviceScalarTest, Uninitialized)
{
Expand Down
8 changes: 6 additions & 2 deletions tests/device_uvector_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*
* Copyright (c) 2020-2024, NVIDIA CORPORATION.
* Copyright (c) 2020-2025, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,6 +23,10 @@
#include <gtest/gtest.h>
#include <gtest/internal/gtest-type-util.h>

#include <cstdint>
#include <iterator>
#include <utility>

// explicit instantiation for test coverage purposes.
template class rmm::device_uvector<int32_t>;

Expand All @@ -33,7 +37,7 @@ struct TypedUVectorTest : ::testing::Test {

using TestTypes = ::testing::Types<int8_t, int32_t, uint64_t, float, double>;

TYPED_TEST_CASE(TypedUVectorTest, TestTypes);
TYPED_TEST_SUITE(TypedUVectorTest, TestTypes);

TYPED_TEST(TypedUVectorTest, MemoryResource)
{
Expand Down
7 changes: 5 additions & 2 deletions tests/logger_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@
#include <rmm/mr/device/logging_resource_adaptor.hpp>

#include <benchmarks/utilities/log_parser.hpp>
#include <gmock/gmock.h>
#include <gtest/gtest.h>

#include <algorithm>
#include <cstdlib>
#include <filesystem>
#include <thread>
#include <iostream>
#include <memory>
#include <string>
#include <vector>

namespace rmm::test {
namespace {
Expand Down
8 changes: 4 additions & 4 deletions tests/mr/device/adaptor_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2024, NVIDIA CORPORATION.
* Copyright (c) 2021-2025, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,8 +16,7 @@

#include "../../byte_literals.hpp"

#include <rmm/cuda_stream_view.hpp>
#include <rmm/detail/error.hpp>
#include <rmm/error.hpp>
#include <rmm/mr/device/aligned_resource_adaptor.hpp>
#include <rmm/mr/device/cuda_memory_resource.hpp>
#include <rmm/mr/device/device_memory_resource.hpp>
Expand All @@ -36,6 +35,7 @@
#include <gtest/gtest.h>

#include <cstddef>
#include <memory>
#include <type_traits>

using cuda_mr = rmm::mr::cuda_memory_resource;
Expand Down Expand Up @@ -110,7 +110,7 @@ struct AdaptorTest : public ::testing::Test {
}
};

TYPED_TEST_CASE(AdaptorTest, adaptors);
TYPED_TEST_SUITE(AdaptorTest, adaptors);

TYPED_TEST(AdaptorTest, NullUpstream)
{
Expand Down
6 changes: 4 additions & 2 deletions tests/mr/device/aligned_mr_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2024, NVIDIA CORPORATION.
* Copyright (c) 2021-2025, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,14 +17,16 @@
#include "../../mock_resource.hpp"

#include <rmm/aligned.hpp>
#include <rmm/detail/error.hpp>
#include <rmm/error.hpp>
#include <rmm/mr/device/aligned_resource_adaptor.hpp>
#include <rmm/mr/device/device_memory_resource.hpp>
#include <rmm/mr/device/per_device_resource.hpp>

#include <gmock/gmock.h>
#include <gtest/gtest.h>

#include <cstddef>

namespace rmm::test {
namespace {

Expand Down
10 changes: 6 additions & 4 deletions tests/mr/device/arena_mr_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2024, NVIDIA CORPORATION.
* Copyright (c) 2021-2025, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,23 +16,25 @@

#include "../../byte_literals.hpp"

#include <rmm/aligned.hpp>
#include <rmm/cuda_device.hpp>
#include <rmm/cuda_stream.hpp>
#include <rmm/detail/error.hpp>
#include <rmm/error.hpp>
#include <rmm/mr/device/arena_memory_resource.hpp>
#include <rmm/mr/device/device_memory_resource.hpp>
#include <rmm/mr/device/per_device_resource.hpp>
#include <rmm/resource_ref.hpp>

#include <cuda/stream_ref>

#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <sys/stat.h>

#include <cstddef>
#include <limits>
#include <memory>
#include <set>
#include <thread>
#include <utility>
#include <vector>

namespace rmm::test {
Expand Down
3 changes: 2 additions & 1 deletion tests/mr/device/binning_mr_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, NVIDIA CORPORATION.
* Copyright (c) 2021-2025, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,6 +14,7 @@
* limitations under the License.
*/

#include <rmm/error.hpp>
#include <rmm/mr/device/binning_memory_resource.hpp>
#include <rmm/mr/device/cuda_memory_resource.hpp>

Expand Down
8 changes: 4 additions & 4 deletions tests/mr/device/callback_mr_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022-2024, NVIDIA CORPORATION.
* Copyright (c) 2022-2025, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,15 +18,15 @@
#include "../../mock_resource.hpp"

#include <rmm/cuda_stream_view.hpp>
#include <rmm/detail/error.hpp>
#include <rmm/device_buffer.hpp>
#include <rmm/mr/device/callback_memory_resource.hpp>
#include <rmm/mr/device/device_memory_resource.hpp>
#include <rmm/mr/device/per_device_resource.hpp>
#include <rmm/resource_ref.hpp>

#include <gmock/gmock.h>
#include <gtest/gtest.h>

#include <cstddef>
#include <iostream>
#include <string>

namespace rmm::test {
Expand Down
5 changes: 3 additions & 2 deletions tests/mr/device/cuda_async_mr_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2024, NVIDIA CORPORATION.
* Copyright (c) 2021-2025, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,10 +14,11 @@
* limitations under the License.
*/

#include <rmm/cuda_device.hpp>
#include <rmm/detail/error.hpp>
#include <rmm/mr/device/cuda_async_memory_resource.hpp>

#include <cuda_runtime_api.h>

#include <gtest/gtest.h>

namespace rmm::test {
Expand Down
5 changes: 2 additions & 3 deletions tests/mr/device/failure_callback_mr_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2024, NVIDIA CORPORATION.
* Copyright (c) 2021-2025, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,8 +17,7 @@
#include "../../byte_literals.hpp"

#include <rmm/cuda_stream_view.hpp>
#include <rmm/detail/error.hpp>
#include <rmm/device_buffer.hpp>
#include <rmm/error.hpp>
#include <rmm/mr/device/device_memory_resource.hpp>
#include <rmm/mr/device/failure_callback_resource_adaptor.hpp>

Expand Down
Loading

0 comments on commit 3fc1ff5

Please sign in to comment.