Skip to content

Commit

Permalink
Clean up Thrust includes. (#1011)
Browse files Browse the repository at this point in the history
## Description

This PR cleans up some `#include`s for Thrust. This is meant to help ease the transition to Thrust 1.16 when that is updated in rapids-cmake.

## Context

I opened a PR rapidsai/cudf#10489 that updates cuDF to Thrust 1.16. Notably, Thrust reduced the number of internal header inclusions:
> [#1572](NVIDIA/thrust#1572) Removed several unnecessary header includes. Downstream projects may need to update their includes if they were relying on this behavior.

I spoke with @robertmaynard and he recommended making similar changes to clean up includes ("include what we use," in essence) to make sure we have compatibility with future versions of Thrust across all RAPIDS libraries.

It looks like rmm may be able to build with Thrust 1.16 even without these changes, but I think this changeset may help prevent future problems arising from inconsistency and reliance on `detail` headers.

Authors:
  - Bradley Dice (https://github.com/bdice)

Approvers:
  - Mark Harris (https://github.com/harrism)
  - Vyas Ramasubramani (https://github.com/vyasr)
  - Conor Hoekstra (https://github.com/codereport)

URL: #1011
  • Loading branch information
bdice authored Mar 29, 2022
1 parent 60ed74b commit fb296fe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion benchmarks/device_uvector/device_uvector_bench.cu
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/

#include "../synchronization/synchronization.hpp"
#include "thrust/detail/raw_pointer_cast.h"

#include <rmm/cuda_stream.hpp>
#include <rmm/detail/error.hpp>
Expand All @@ -30,6 +29,9 @@

#include <cuda_runtime_api.h>

#include <thrust/device_vector.h>
#include <thrust/memory.h>

#include <cstdio>
#include <type_traits>

Expand Down
3 changes: 2 additions & 1 deletion include/rmm/mr/device/thrust_allocator_adaptor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
#include <rmm/mr/device/device_memory_resource.hpp>
#include <rmm/mr/device/per_device_resource.hpp>

#include <thrust/detail/type_traits/pointer_traits.h>
#include <thrust/device_malloc_allocator.h>
#include <thrust/device_ptr.h>
#include <thrust/memory.h>

namespace rmm::mr {
/**
Expand Down
2 changes: 2 additions & 0 deletions tests/mr/device/thrust_allocator_tests.cu
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

#include <gtest/gtest.h>

#include <thrust/reduce.h>

// explicit instantiation for test coverage purposes
template class rmm::mr::thrust_allocator<int>;

Expand Down

0 comments on commit fb296fe

Please sign in to comment.