From c70afb6030002f1204f849d25a5e56ce5f9c3cd0 Mon Sep 17 00:00:00 2001 From: Conor Hoekstra Date: Fri, 25 Jun 2021 17:18:46 -0400 Subject: [PATCH 1/7] Update conda env files --- conda/environments/rmm_dev_cuda10.1.yml | 4 ++-- conda/environments/rmm_dev_cuda10.2.yml | 4 ++-- conda/environments/rmm_dev_cuda11.0.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/conda/environments/rmm_dev_cuda10.1.yml b/conda/environments/rmm_dev_cuda10.1.yml index dc5dccc0f..e0939573f 100644 --- a/conda/environments/rmm_dev_cuda10.1.yml +++ b/conda/environments/rmm_dev_cuda10.1.yml @@ -3,8 +3,8 @@ channels: - rapidsai - conda-forge dependencies: -- clang=8.0.1 -- clang-tools=8.0.1 +- clang=11.0.0 +- clang-tools=11.0.0 - cmake>=3.20.1 - cmake-format=0.6.11 - flake8=3.8.3 diff --git a/conda/environments/rmm_dev_cuda10.2.yml b/conda/environments/rmm_dev_cuda10.2.yml index ff647d024..c69a06b83 100644 --- a/conda/environments/rmm_dev_cuda10.2.yml +++ b/conda/environments/rmm_dev_cuda10.2.yml @@ -3,8 +3,8 @@ channels: - rapidsai - conda-forge dependencies: -- clang=8.0.1 -- clang-tools=8.0.1 +- clang=11.0.0 +- clang-tools=11.0.0 - cmake>=3.20.1 - cmake-format=0.6.11 - flake8=3.8.3 diff --git a/conda/environments/rmm_dev_cuda11.0.yml b/conda/environments/rmm_dev_cuda11.0.yml index 0d2dfaf92..0ee4bdc65 100644 --- a/conda/environments/rmm_dev_cuda11.0.yml +++ b/conda/environments/rmm_dev_cuda11.0.yml @@ -3,8 +3,8 @@ channels: - rapidsai - conda-forge dependencies: -- clang=8.0.1 -- clang-tools=8.0.1 +- clang=11.0.0 +- clang-tools=11.0.0 - cmake>=3.20.1 - cmake-format=0.6.11 - flake8=3.8.3 From ef8fe3dfdaf1749b0d9522b16567338a6c108f90 Mon Sep 17 00:00:00 2001 From: Conor Hoekstra Date: Fri, 25 Jun 2021 17:19:10 -0400 Subject: [PATCH 2/7] Update python script --- scripts/run-clang-format.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/run-clang-format.py b/scripts/run-clang-format.py index 69ad04e6e..5014e0bca 100755 --- a/scripts/run-clang-format.py +++ b/scripts/run-clang-format.py @@ -22,7 +22,7 @@ import sys import tempfile -EXPECTED_VERSION = "8.0.1" +EXPECTED_VERSION = "11.0.0" VERSION_REGEX = re.compile(r"clang-format version ([0-9.]+)") # NOTE: populate this list with more top-level dirs as we add more of them # to the rmm repo From 90759d0a97eb94721c00771cb95603c870d564a0 Mon Sep 17 00:00:00 2001 From: Conor Hoekstra Date: Fri, 25 Jun 2021 17:19:19 -0400 Subject: [PATCH 3/7] Update .clang-format --- .clang-format | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.clang-format b/.clang-format index 2f0f549cf..ec0ddcfa1 100644 --- a/.clang-format +++ b/.clang-format @@ -6,15 +6,21 @@ Language: Cpp AccessModifierOffset: -1 AlignAfterOpenBracket: Align AlignConsecutiveAssignments: true +AlignConsecutiveBitFields: true AlignConsecutiveDeclarations: false +AlignConsecutiveMacros: true AlignEscapedNewlines: Left AlignOperands: true AlignTrailingComments: true +AllowAllArgumentsOnNextLine: true +AllowAllConstructorInitializersOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: true AllowShortBlocksOnASingleLine: true AllowShortCaseLabelsOnASingleLine: true +AllowShortEnumsOnASingleLine: true AllowShortFunctionsOnASingleLine: All AllowShortIfStatementsOnASingleLine: true +AllowShortLambdasOnASingleLine: true AllowShortLoopsOnASingleLine: false # This is deprecated AlwaysBreakAfterDefinitionReturnType: None @@ -40,14 +46,15 @@ BraceWrapping: SplitEmptyFunction: false SplitEmptyRecord: false SplitEmptyNamespace: false +BreakAfterJavaFieldAnnotations: false BreakBeforeBinaryOperators: None BreakBeforeBraces: WebKit BreakBeforeInheritanceComma: false -BreakInheritanceList: BeforeColon +BreakBeforeTernaryOperators: true BreakBeforeTernaryOperators: true BreakConstructorInitializersBeforeComma: false BreakConstructorInitializers: BeforeColon -BreakAfterJavaFieldAnnotations: false +BreakInheritanceList: BeforeColon BreakStringLiterals: true ColumnLimit: 100 CommentPragmas: '^ IWYU pragma:' @@ -57,7 +64,7 @@ ConstructorInitializerAllOnOneLineOrOnePerLine: true ConstructorInitializerIndentWidth: 2 ContinuationIndentWidth: 2 Cpp11BracedListStyle: true -DerivePointerAlignment: true +DerivePointerAlignment: false DisableFormat: false ExperimentalAutoDetectBinPacking: false FixNamespaceComments: true @@ -139,14 +146,17 @@ SpaceBeforeCtorInitializerColon: true SpaceBeforeInheritanceColon: true SpaceBeforeParens: ControlStatements SpaceBeforeRangeBasedForLoopColon: true +SpaceBeforeSquareBrackets: false +SpaceInEmptyBlock: false SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 2 SpacesInAngles: false +SpacesInConditionalStatement: false SpacesInContainerLiterals: true SpacesInCStyleCastParentheses: false SpacesInParentheses: false SpacesInSquareBrackets: false -Standard: Cpp11 +Standard: c++17 StatementMacros: - Q_UNUSED - QT_REQUIRE_VERSION From 81a651e372116f8903eaee29828ccb40d3e544e4 Mon Sep 17 00:00:00 2001 From: Conor Hoekstra Date: Fri, 25 Jun 2021 17:19:38 -0400 Subject: [PATCH 4/7] Formatting changes --- include/rmm/detail/aligned.hpp | 16 ++--- include/rmm/detail/error.hpp | 2 +- include/rmm/device_scalar.hpp | 22 +++---- include/rmm/logger.hpp | 10 ++-- include/rmm/mr/host/new_delete_resource.hpp | 18 +++--- .../rmm/mr/host/pinned_memory_resource.hpp | 20 +++---- include/rmm/thrust_rmm_allocator.h | 6 +- tests/device_buffer_tests.cu | 60 +++++++++---------- tests/mr/device/statistics_mr_tests.cpp | 8 +-- tests/mr/device/tracking_mr_tests.cpp | 14 ++--- 10 files changed, 88 insertions(+), 88 deletions(-) diff --git a/include/rmm/detail/aligned.hpp b/include/rmm/detail/aligned.hpp index 06c9103ae..17973d033 100644 --- a/include/rmm/detail/aligned.hpp +++ b/include/rmm/detail/aligned.hpp @@ -119,7 +119,7 @@ constexpr bool is_aligned(std::size_t v, std::size_t align_bytes) noexcept * `alignment`. */ template -void *aligned_allocate(std::size_t bytes, std::size_t alignment, Alloc alloc) +void* aligned_allocate(std::size_t bytes, std::size_t alignment, Alloc alloc) { assert(is_pow2(alignment)); @@ -127,19 +127,19 @@ void *aligned_allocate(std::size_t bytes, std::size_t alignment, Alloc alloc) // plus store of the correction offset std::size_t padded_allocation_size{bytes + alignment + sizeof(std::ptrdiff_t)}; - char *const original = static_cast(alloc(padded_allocation_size)); + char* const original = static_cast(alloc(padded_allocation_size)); // account for storage of offset immediately prior to the aligned pointer - void *aligned{original + sizeof(std::ptrdiff_t)}; + void* aligned{original + sizeof(std::ptrdiff_t)}; // std::align modifies `aligned` to point to the first aligned location std::align(alignment, bytes, aligned, padded_allocation_size); // Compute the offset between the original and aligned pointers - std::ptrdiff_t offset = static_cast(aligned) - original; + std::ptrdiff_t offset = static_cast(aligned) - original; // Store the offset immediately before the aligned pointer - *(static_cast(aligned) - 1) = offset; + *(static_cast(aligned) - 1) = offset; return aligned; } @@ -160,14 +160,14 @@ void *aligned_allocate(std::size_t bytes, std::size_t alignment, Alloc alloc) * @tparam Dealloc A unary callable type that deallocates memory. */ template -void aligned_deallocate(void *p, std::size_t bytes, std::size_t alignment, Dealloc dealloc) +void aligned_deallocate(void* p, std::size_t bytes, std::size_t alignment, Dealloc dealloc) { (void)alignment; // Get offset from the location immediately prior to the aligned pointer - std::ptrdiff_t const offset = *(reinterpret_cast(p) - 1); + std::ptrdiff_t const offset = *(reinterpret_cast(p) - 1); - void *const original = static_cast(p) - offset; + void* const original = static_cast(p) - offset; dealloc(original); } diff --git a/include/rmm/detail/error.hpp b/include/rmm/detail/error.hpp index 42cf7f9f8..057f67ba3 100644 --- a/include/rmm/detail/error.hpp +++ b/include/rmm/detail/error.hpp @@ -76,7 +76,7 @@ class out_of_range : public std::out_of_range { } // namespace rmm #define STRINGIFY_DETAIL(x) #x -#define RMM_STRINGIFY(x) STRINGIFY_DETAIL(x) +#define RMM_STRINGIFY(x) STRINGIFY_DETAIL(x) /** * @brief Macro for checking (pre-)conditions that throws an exception when diff --git a/include/rmm/device_scalar.hpp b/include/rmm/device_scalar.hpp index d51e8c76b..f44ba1c28 100644 --- a/include/rmm/device_scalar.hpp +++ b/include/rmm/device_scalar.hpp @@ -47,19 +47,19 @@ class device_scalar { ~device_scalar() = default; RMM_EXEC_CHECK_DISABLE - device_scalar(device_scalar &&) = default; + device_scalar(device_scalar&&) = default; - device_scalar &operator=(device_scalar &&) = default; + device_scalar& operator=(device_scalar&&) = default; /** * @brief Copy ctor is deleted as it doesn't allow a stream argument */ - device_scalar(device_scalar const &) = delete; + device_scalar(device_scalar const&) = delete; /** * @brief Copy assignment is deleted as it doesn't allow a stream argument */ - device_scalar &operator=(device_scalar const &) = delete; + device_scalar& operator=(device_scalar const&) = delete; /** * @brief Default constructor is deleted as it doesn't allow a stream argument @@ -82,7 +82,7 @@ class device_scalar { */ explicit device_scalar( cuda_stream_view stream, - rmm::mr::device_memory_resource *mr = rmm::mr::get_current_device_resource()) + rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) : _storage{1, stream, mr} { } @@ -104,9 +104,9 @@ class device_scalar { * @param mr Optional, resource with which to allocate. */ explicit device_scalar( - value_type const &initial_value, + value_type const& initial_value, cuda_stream_view stream, - rmm::mr::device_memory_resource *mr = rmm::mr::get_current_device_resource()) + rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) : _storage{1, stream, mr} { set_value_async(initial_value, stream); @@ -124,9 +124,9 @@ class device_scalar { * @param stream The stream to use for the allocation and copy * @param mr The resource to use for allocating the new `device_scalar` */ - device_scalar(device_scalar const &other, + device_scalar(device_scalar const& other, cuda_stream_view stream, - rmm::mr::device_memory_resource *mr = rmm::mr::get_current_device_resource()) + rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) : _storage{other._storage, stream, mr} { } @@ -186,14 +186,14 @@ class device_scalar { * @param v The host value which will be copied to device * @param stream CUDA stream on which to perform the copy */ - void set_value_async(value_type const &v, cuda_stream_view s) + void set_value_async(value_type const& v, cuda_stream_view s) { _storage.set_element_async(0, v, s); } // Disallow passing literals to set_value to avoid race conditions where the memory holding the // literal can be freed before the async memcpy / memset executes. - void set_value_async(value_type &&, cuda_stream_view) = delete; + void set_value_async(value_type&&, cuda_stream_view) = delete; /** * @brief Sets the value of the `device_scalar` to zero on the specified stream. diff --git a/include/rmm/logger.hpp b/include/rmm/logger.hpp index 433b5fb96..99a0f7b2e 100644 --- a/include/rmm/logger.hpp +++ b/include/rmm/logger.hpp @@ -87,11 +87,11 @@ inline spdlog::logger& logger() // The default is INFO, but it should be used sparingly, so that by default a log file is only // output if there is important information, warnings, errors, and critical failures // Log messages that require computation should only be used at level TRACE and DEBUG -#define RMM_LOG_TRACE(...) SPDLOG_LOGGER_TRACE(&rmm::logger(), __VA_ARGS__) -#define RMM_LOG_DEBUG(...) SPDLOG_LOGGER_DEBUG(&rmm::logger(), __VA_ARGS__) -#define RMM_LOG_INFO(...) SPDLOG_LOGGER_INFO(&rmm::logger(), __VA_ARGS__) -#define RMM_LOG_WARN(...) SPDLOG_LOGGER_WARN(&rmm::logger(), __VA_ARGS__) -#define RMM_LOG_ERROR(...) SPDLOG_LOGGER_ERROR(&rmm::logger(), __VA_ARGS__) +#define RMM_LOG_TRACE(...) SPDLOG_LOGGER_TRACE(&rmm::logger(), __VA_ARGS__) +#define RMM_LOG_DEBUG(...) SPDLOG_LOGGER_DEBUG(&rmm::logger(), __VA_ARGS__) +#define RMM_LOG_INFO(...) SPDLOG_LOGGER_INFO(&rmm::logger(), __VA_ARGS__) +#define RMM_LOG_WARN(...) SPDLOG_LOGGER_WARN(&rmm::logger(), __VA_ARGS__) +#define RMM_LOG_ERROR(...) SPDLOG_LOGGER_ERROR(&rmm::logger(), __VA_ARGS__) #define RMM_LOG_CRITICAL(...) SPDLOG_LOGGER_CRITICAL(&rmm::logger(), __VA_ARGS__) } // namespace rmm diff --git a/include/rmm/mr/host/new_delete_resource.hpp b/include/rmm/mr/host/new_delete_resource.hpp index 14aa3831c..aaf1d9c25 100644 --- a/include/rmm/mr/host/new_delete_resource.hpp +++ b/include/rmm/mr/host/new_delete_resource.hpp @@ -31,12 +31,12 @@ namespace mr { *---------------------------------------------------------------------------**/ class new_delete_resource final : public host_memory_resource { public: - new_delete_resource() = default; - ~new_delete_resource() = default; - new_delete_resource(new_delete_resource const &) = default; - new_delete_resource(new_delete_resource &&) = default; - new_delete_resource &operator=(new_delete_resource const &) = default; - new_delete_resource &operator=(new_delete_resource &&) = default; + new_delete_resource() = default; + ~new_delete_resource() = default; + new_delete_resource(new_delete_resource const&) = default; + new_delete_resource(new_delete_resource&&) = default; + new_delete_resource& operator=(new_delete_resource const&) = default; + new_delete_resource& operator=(new_delete_resource&&) = default; private: /**---------------------------------------------------------------------------* @@ -52,7 +52,7 @@ class new_delete_resource final : public host_memory_resource { * @param alignment Alignment of the allocation * @return void* Pointer to the newly allocated memory *---------------------------------------------------------------------------**/ - void *do_allocate(std::size_t bytes, + void* do_allocate(std::size_t bytes, std::size_t alignment = detail::RMM_DEFAULT_HOST_ALIGNMENT) override { // If the requested alignment isn't supported, use default @@ -81,11 +81,11 @@ class new_delete_resource final : public host_memory_resource { *`p`. * @param stream Stream on which to perform deallocation *---------------------------------------------------------------------------**/ - void do_deallocate(void *p, + void do_deallocate(void* p, std::size_t bytes, std::size_t alignment = detail::RMM_DEFAULT_HOST_ALIGNMENT) override { - detail::aligned_deallocate(p, bytes, alignment, [](void *p) { ::operator delete(p); }); + detail::aligned_deallocate(p, bytes, alignment, [](void* p) { ::operator delete(p); }); } }; } // namespace mr diff --git a/include/rmm/mr/host/pinned_memory_resource.hpp b/include/rmm/mr/host/pinned_memory_resource.hpp index f98187eab..5188644cd 100644 --- a/include/rmm/mr/host/pinned_memory_resource.hpp +++ b/include/rmm/mr/host/pinned_memory_resource.hpp @@ -32,12 +32,12 @@ namespace mr { *---------------------------------------------------------------------------**/ class pinned_memory_resource final : public host_memory_resource { public: - pinned_memory_resource() = default; - ~pinned_memory_resource() = default; - pinned_memory_resource(pinned_memory_resource const &) = default; - pinned_memory_resource(pinned_memory_resource &&) = default; - pinned_memory_resource &operator=(pinned_memory_resource const &) = default; - pinned_memory_resource &operator=(pinned_memory_resource &&) = default; + pinned_memory_resource() = default; + ~pinned_memory_resource() = default; + pinned_memory_resource(pinned_memory_resource const&) = default; + pinned_memory_resource(pinned_memory_resource&&) = default; + pinned_memory_resource& operator=(pinned_memory_resource const&) = default; + pinned_memory_resource& operator=(pinned_memory_resource&&) = default; private: /**---------------------------------------------------------------------------* @@ -53,7 +53,7 @@ class pinned_memory_resource final : public host_memory_resource { * @param alignment Alignment of the allocation * @return void* Pointer to the newly allocated memory *---------------------------------------------------------------------------**/ - void *do_allocate(std::size_t bytes, std::size_t alignment = alignof(std::max_align_t)) override + void* do_allocate(std::size_t bytes, std::size_t alignment = alignof(std::max_align_t)) override { // don't allocate anything if the user requested zero bytes if (0 == bytes) { return nullptr; } @@ -63,7 +63,7 @@ class pinned_memory_resource final : public host_memory_resource { (detail::is_supported_alignment(alignment)) ? alignment : detail::RMM_DEFAULT_HOST_ALIGNMENT; return detail::aligned_allocate(bytes, alignment, [](std::size_t size) { - void *p{nullptr}; + void* p{nullptr}; auto status = cudaMallocHost(&p, size); if (cudaSuccess != status) { throw std::bad_alloc{}; } return p; @@ -88,14 +88,14 @@ class pinned_memory_resource final : public host_memory_resource { *`p`. * @param stream Stream on which to perform deallocation *---------------------------------------------------------------------------**/ - void do_deallocate(void *p, + void do_deallocate(void* p, std::size_t bytes, std::size_t alignment = alignof(std::max_align_t)) override { (void)alignment; if (nullptr == p) { return; } detail::aligned_deallocate( - p, bytes, alignment, [](void *p) { RMM_ASSERT_CUDA_SUCCESS(cudaFreeHost(p)); }); + p, bytes, alignment, [](void* p) { RMM_ASSERT_CUDA_SUCCESS(cudaFreeHost(p)); }); } }; } // namespace mr diff --git a/include/rmm/thrust_rmm_allocator.h b/include/rmm/thrust_rmm_allocator.h index fdb6c3f8a..889faa3bd 100644 --- a/include/rmm/thrust_rmm_allocator.h +++ b/include/rmm/thrust_rmm_allocator.h @@ -25,7 +25,7 @@ namespace rmm { using par_t = decltype(thrust::cuda::par(*(new rmm::mr::thrust_allocator()))); -using deleter_t = std::function; +using deleter_t = std::function; using exec_policy_t = std::unique_ptr; /** @@ -40,8 +40,8 @@ using exec_policy_t = std::unique_ptr; [[deprecated("Use new exec_policy in rmm/exec_policy.hpp")]] inline exec_policy_t exec_policy( cudaStream_t stream = 0) { - auto *alloc = new rmm::mr::thrust_allocator(cuda_stream_view{stream}); - auto deleter = [alloc](par_t *pointer) { + auto* alloc = new rmm::mr::thrust_allocator(cuda_stream_view{stream}); + auto deleter = [alloc](par_t* pointer) { delete alloc; delete pointer; }; diff --git a/tests/device_buffer_tests.cu b/tests/device_buffer_tests.cu index 448c9259d..fa36a2751 100644 --- a/tests/device_buffer_tests.cu +++ b/tests/device_buffer_tests.cu @@ -97,7 +97,7 @@ TYPED_TEST(DeviceBufferTest, ExplicitMemoryResourceStream) TYPED_TEST(DeviceBufferTest, CopyFromRawDevicePointer) { - void *device_memory{nullptr}; + void* device_memory{nullptr}; EXPECT_EQ(cudaSuccess, cudaMalloc(&device_memory, this->size)); rmm::device_buffer buff(device_memory, this->size, rmm::cuda_stream_view{}); EXPECT_NE(nullptr, buff.data()); @@ -115,7 +115,7 @@ TYPED_TEST(DeviceBufferTest, CopyFromRawHostPointer) { std::vector host_data(this->size); rmm::device_buffer buff( - static_cast(host_data.data()), this->size, rmm::cuda_stream_view{}); + static_cast(host_data.data()), this->size, rmm::cuda_stream_view{}); EXPECT_NE(nullptr, buff.data()); EXPECT_EQ(this->size, buff.size()); EXPECT_EQ(this->size, buff.capacity()); @@ -148,8 +148,8 @@ TYPED_TEST(DeviceBufferTest, CopyConstructor) // Initialize buffer thrust::sequence(rmm::exec_policy(rmm::cuda_stream_default), - static_cast(buff.data()), - static_cast(buff.data()) + buff.size(), + static_cast(buff.data()), + static_cast(buff.data()) + buff.size(), 0); rmm::device_buffer buff_copy(buff, rmm::cuda_stream_default); // uses default MR @@ -162,9 +162,9 @@ TYPED_TEST(DeviceBufferTest, CopyConstructor) EXPECT_EQ(buff_copy.stream(), rmm::cuda_stream_view{}); EXPECT_TRUE(thrust::equal(rmm::exec_policy(rmm::cuda_stream_default), - static_cast(buff.data()), - static_cast(buff.data()) + buff.size(), - static_cast(buff_copy.data()))); + static_cast(buff.data()), + static_cast(buff.data()) + buff.size(), + static_cast(buff_copy.data()))); // now use buff's stream and MR rmm::device_buffer buff_copy2(buff, buff.stream(), buff.memory_resource()); @@ -173,9 +173,9 @@ TYPED_TEST(DeviceBufferTest, CopyConstructor) EXPECT_EQ(buff_copy2.stream(), buff.stream()); EXPECT_TRUE(thrust::equal(rmm::exec_policy(rmm::cuda_stream_default), - static_cast(buff.data()), - static_cast(buff.data()) + buff.size(), - static_cast(buff_copy.data()))); + static_cast(buff.data()), + static_cast(buff.data()) + buff.size(), + static_cast(buff_copy.data()))); } TYPED_TEST(DeviceBufferTest, CopyCapacityLargerThanSize) @@ -187,8 +187,8 @@ TYPED_TEST(DeviceBufferTest, CopyCapacityLargerThanSize) buff.resize(new_size, rmm::cuda_stream_default); thrust::sequence(rmm::exec_policy(rmm::cuda_stream_default), - static_cast(buff.data()), - static_cast(buff.data()) + buff.size(), + static_cast(buff.data()), + static_cast(buff.data()) + buff.size(), 0); rmm::device_buffer buff_copy(buff, rmm::cuda_stream_default); EXPECT_NE(nullptr, buff_copy.data()); @@ -202,9 +202,9 @@ TYPED_TEST(DeviceBufferTest, CopyCapacityLargerThanSize) EXPECT_EQ(buff_copy.stream(), rmm::cuda_stream_view{}); EXPECT_TRUE(thrust::equal(rmm::exec_policy(rmm::cuda_stream_default), - static_cast(buff.data()), - static_cast(buff.data()) + buff.size(), - static_cast(buff_copy.data()))); + static_cast(buff.data()), + static_cast(buff.data()) + buff.size(), + static_cast(buff_copy.data()))); } TYPED_TEST(DeviceBufferTest, CopyConstructorExplicitMr) @@ -212,8 +212,8 @@ TYPED_TEST(DeviceBufferTest, CopyConstructorExplicitMr) rmm::device_buffer buff(this->size, rmm::cuda_stream_default, &this->mr); thrust::sequence(rmm::exec_policy(rmm::cuda_stream_default), - static_cast(buff.data()), - static_cast(buff.data()) + buff.size(), + static_cast(buff.data()), + static_cast(buff.data()) + buff.size(), 0); rmm::device_buffer buff_copy(buff, this->stream, &this->mr); EXPECT_NE(nullptr, buff_copy.data()); @@ -225,9 +225,9 @@ TYPED_TEST(DeviceBufferTest, CopyConstructorExplicitMr) EXPECT_NE(buff.stream(), buff_copy.stream()); EXPECT_TRUE(thrust::equal(rmm::exec_policy(buff_copy.stream()), - static_cast(buff.data()), - static_cast(buff.data()) + buff.size(), - static_cast(buff_copy.data()))); + static_cast(buff.data()), + static_cast(buff.data()) + buff.size(), + static_cast(buff_copy.data()))); } TYPED_TEST(DeviceBufferTest, CopyCapacityLargerThanSizeExplicitMr) @@ -239,8 +239,8 @@ TYPED_TEST(DeviceBufferTest, CopyCapacityLargerThanSizeExplicitMr) buff.resize(new_size, rmm::cuda_stream_default); thrust::sequence(rmm::exec_policy(rmm::cuda_stream_default), - static_cast(buff.data()), - static_cast(buff.data()) + buff.size(), + static_cast(buff.data()), + static_cast(buff.data()) + buff.size(), 0); rmm::device_buffer buff_copy(buff, this->stream, &this->mr); EXPECT_NE(nullptr, buff_copy.data()); @@ -255,9 +255,9 @@ TYPED_TEST(DeviceBufferTest, CopyCapacityLargerThanSizeExplicitMr) EXPECT_NE(buff.stream(), buff_copy.stream()); EXPECT_TRUE(thrust::equal(rmm::exec_policy(buff_copy.stream()), - static_cast(buff.data()), - static_cast(buff.data()) + buff.size(), - static_cast(buff_copy.data()))); + static_cast(buff.data()), + static_cast(buff.data()) + buff.size(), + static_cast(buff_copy.data()))); } TYPED_TEST(DeviceBufferTest, MoveConstructor) @@ -393,8 +393,8 @@ TYPED_TEST(DeviceBufferTest, ResizeSmaller) rmm::device_buffer buff(this->size, rmm::cuda_stream_default, &this->mr); thrust::sequence(rmm::exec_policy(rmm::cuda_stream_default), - static_cast(buff.data()), - static_cast(buff.data()) + buff.size(), + static_cast(buff.data()), + static_cast(buff.data()) + buff.size(), 0); auto old_data = buff.data(); @@ -416,9 +416,9 @@ TYPED_TEST(DeviceBufferTest, ResizeSmaller) EXPECT_EQ(buff.capacity(), buff.size()); EXPECT_TRUE(thrust::equal(rmm::exec_policy(rmm::cuda_stream_default), - static_cast(buff.data()), - static_cast(buff.data()) + buff.size(), - static_cast(old_content.data()))); + static_cast(buff.data()), + static_cast(buff.data()) + buff.size(), + static_cast(old_content.data()))); } TYPED_TEST(DeviceBufferTest, ResizeBigger) diff --git a/tests/mr/device/statistics_mr_tests.cpp b/tests/mr/device/statistics_mr_tests.cpp index fa7297608..83464bbe2 100644 --- a/tests/mr/device/statistics_mr_tests.cpp +++ b/tests/mr/device/statistics_mr_tests.cpp @@ -50,7 +50,7 @@ TEST(StatisticsTest, Empty) TEST(StatisticsTest, AllFreed) { statistics_adaptor mr{rmm::mr::get_current_device_resource()}; - std::vector allocations; + std::vector allocations; for (int i = 0; i < 10; ++i) { allocations.push_back(mr.allocate(10_MiB)); } @@ -66,12 +66,12 @@ TEST(StatisticsTest, AllFreed) TEST(StatisticsTest, PeakAllocations) { statistics_adaptor mr{rmm::mr::get_current_device_resource()}; - std::vector allocations; + std::vector allocations; for (std::size_t i = 0; i < 10; ++i) { allocations.push_back(mr.allocate(10_MiB)); } // Delete every other allocation - for (auto &&it = allocations.begin(); it != allocations.end(); ++it) { + for (auto&& it = allocations.begin(); it != allocations.end(); ++it) { mr.deallocate(*it, 10_MiB); it = allocations.erase(it); } @@ -173,7 +173,7 @@ TEST(StatisticsTest, NegativeInnerTracking) // wrapped memory resource. This can happen if the MR is not saved with the // memory pointer statistics_adaptor mr{rmm::mr::get_current_device_resource()}; - std::vector allocations; + std::vector allocations; for (std::size_t i = 0; i < 10; ++i) { allocations.push_back(mr.allocate(10_MiB)); } diff --git a/tests/mr/device/tracking_mr_tests.cpp b/tests/mr/device/tracking_mr_tests.cpp index 0ad6f7fc5..8dc666f0c 100644 --- a/tests/mr/device/tracking_mr_tests.cpp +++ b/tests/mr/device/tracking_mr_tests.cpp @@ -44,7 +44,7 @@ TEST(TrackingTest, Empty) TEST(TrackingTest, AllFreed) { tracking_adaptor mr{rmm::mr::get_current_device_resource()}; - std::vector allocations; + std::vector allocations; for (int i = 0; i < 10; ++i) { allocations.push_back(mr.allocate(10_MiB)); } @@ -58,7 +58,7 @@ TEST(TrackingTest, AllFreed) TEST(TrackingTest, AllocationsLeftWithStacks) { tracking_adaptor mr{rmm::mr::get_current_device_resource(), true}; - std::vector allocations; + std::vector allocations; for (int i = 0; i < 10; ++i) { allocations.push_back(mr.allocate(10_MiB)); } @@ -67,7 +67,7 @@ TEST(TrackingTest, AllocationsLeftWithStacks) } EXPECT_EQ(mr.get_outstanding_allocations().size(), 5); EXPECT_EQ(mr.get_allocated_bytes(), 50_MiB); - auto const &outstanding_allocations = mr.get_outstanding_allocations(); + auto const& outstanding_allocations = mr.get_outstanding_allocations(); EXPECT_EQ(outstanding_allocations.size(), 5); EXPECT_NE(outstanding_allocations.begin()->second.strace, nullptr); } @@ -75,7 +75,7 @@ TEST(TrackingTest, AllocationsLeftWithStacks) TEST(TrackingTest, AllocationsLeftWithoutStacks) { tracking_adaptor mr{rmm::mr::get_current_device_resource()}; - std::vector allocations; + std::vector allocations; for (int i = 0; i < 10; ++i) { allocations.push_back(mr.allocate(10_MiB)); } @@ -84,7 +84,7 @@ TEST(TrackingTest, AllocationsLeftWithoutStacks) } EXPECT_EQ(mr.get_outstanding_allocations().size(), 5); EXPECT_EQ(mr.get_allocated_bytes(), 50_MiB); - auto const &outstanding_allocations = mr.get_outstanding_allocations(); + auto const& outstanding_allocations = mr.get_outstanding_allocations(); EXPECT_EQ(outstanding_allocations.size(), 5); EXPECT_EQ(outstanding_allocations.begin()->second.strace, nullptr); } @@ -139,7 +139,7 @@ TEST(TrackingTest, NegativeInnerTracking) // wrapped memory resource. This can happen if the MR is not saved with the // memory pointer tracking_adaptor mr{rmm::mr::get_current_device_resource()}; - std::vector allocations; + std::vector allocations; for (std::size_t i = 0; i < 10; ++i) { allocations.push_back(mr.allocate(10_MiB)); } @@ -171,7 +171,7 @@ TEST(TrackingTest, NegativeInnerTracking) TEST(TrackingTest, DeallocWrongBytes) { tracking_adaptor mr{rmm::mr::get_current_device_resource()}; - std::vector allocations; + std::vector allocations; for (std::size_t i = 0; i < 10; ++i) { allocations.push_back(mr.allocate(10_MiB)); } From 83c5d1152eadb769c9f7fb33131090e95828be7c Mon Sep 17 00:00:00 2001 From: Conor Hoekstra Date: Fri, 25 Jun 2021 17:24:03 -0400 Subject: [PATCH 5/7] Fix for CI --- ci/checks/style.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ci/checks/style.sh b/ci/checks/style.sh index eb41bc6b5..6552caf0b 100644 --- a/ci/checks/style.sh +++ b/ci/checks/style.sh @@ -14,6 +14,10 @@ LANG=C.UTF-8 . /opt/conda/etc/profile.d/conda.sh conda activate rapids +gpuci_conda_retry remove --force rapids-build-env rapids-notebook-env +gpuci_conda_retry install -y "clang=11.0.0" +gpuci_conda_retry install -y "clang-tools=11.0.0" + # Run isort and get results/return code ISORT=`isort --check-only python --settings-path=python/setup.cfg ` ISORT_RETVAL=$? From 4d539938f7c403c309e9db170450a98b279500ea Mon Sep 17 00:00:00 2001 From: Conor Hoekstra Date: Sun, 27 Jun 2021 21:46:36 -0400 Subject: [PATCH 6/7] Remove duplicate line --- .clang-format | 1 - 1 file changed, 1 deletion(-) diff --git a/.clang-format b/.clang-format index ec0ddcfa1..0c05436e9 100644 --- a/.clang-format +++ b/.clang-format @@ -51,7 +51,6 @@ BreakBeforeBinaryOperators: None BreakBeforeBraces: WebKit BreakBeforeInheritanceComma: false BreakBeforeTernaryOperators: true -BreakBeforeTernaryOperators: true BreakConstructorInitializersBeforeComma: false BreakConstructorInitializers: BeforeColon BreakInheritanceList: BeforeColon From b66df43cef53edb12b9cfb908fe82bcbf9f2dbcf Mon Sep 17 00:00:00 2001 From: Conor Hoekstra Date: Sun, 27 Jun 2021 21:47:04 -0400 Subject: [PATCH 7/7] Remove temporary CI fix --- ci/checks/style.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ci/checks/style.sh b/ci/checks/style.sh index 6552caf0b..eb41bc6b5 100644 --- a/ci/checks/style.sh +++ b/ci/checks/style.sh @@ -14,10 +14,6 @@ LANG=C.UTF-8 . /opt/conda/etc/profile.d/conda.sh conda activate rapids -gpuci_conda_retry remove --force rapids-build-env rapids-notebook-env -gpuci_conda_retry install -y "clang=11.0.0" -gpuci_conda_retry install -y "clang-tools=11.0.0" - # Run isort and get results/return code ISORT=`isort --check-only python --settings-path=python/setup.cfg ` ISORT_RETVAL=$?