Skip to content

Commit

Permalink
Add missing Thrust includes (rapidsai#2310)
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.17 when that is updated in rapids-cmake.

## Context

I opened a PR rapidsai/cudf#10489 that updates cuDF to Thrust 1.16. Notably, version 1.16 of Thrust reduced the number of internal header inclusions:
> [rapidsai#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.

This changeset also makes it more obvious where cugraph depends on `thrust/detail` headers.

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

Approvers:
  - Brad Rees (https://github.com/BradReesWork)
  - Seunghwa Kang (https://github.com/seunghwak)

URL: rapidsai#2310
  • Loading branch information
bdice authored Jun 29, 2022
1 parent fa701f5 commit d0863d4
Show file tree
Hide file tree
Showing 123 changed files with 672 additions and 39 deletions.
4 changes: 2 additions & 2 deletions cpp/cmake/thirdparty/get_cuhornet.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#=============================================================================
# Copyright (c) 2021, NVIDIA CORPORATION.
# Copyright (c) 2021-2022, 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 @@ -21,7 +21,7 @@ function(find_and_configure_cuhornet)
FetchContent_Declare(
cuhornet
GIT_REPOSITORY https://github.com/rapidsai/cuhornet.git
GIT_TAG 4a1daa18405c0242370e16ce302dfa7eb5d9e857
GIT_TAG 2b56aba8ca160f98a2362f644425c879910bdd96
SOURCE_SUBDIR hornet
)
FetchContent_GetProperties(cuhornet)
Expand Down
2 changes: 2 additions & 0 deletions cpp/include/cugraph/detail/decompress_edge_partition.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include <thrust/for_each.h>
#include <thrust/iterator/counting_iterator.h>
#include <thrust/optional.h>
#include <thrust/sequence.h>
#include <thrust/tuple.h>

#include <optional>
#include <tuple>
Expand Down
2 changes: 2 additions & 0 deletions cpp/include/cugraph/detail/graph_utils.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

#include <cuco/detail/hash_functions.cuh>
#include <thrust/binary_search.h>
#include <thrust/distance.h>
#include <thrust/execution_policy.h>
#include <thrust/sort.h>
#include <thrust/tabulate.h>
#include <thrust/transform.h>
Expand Down
2 changes: 2 additions & 0 deletions cpp/include/cugraph/detail/utility_wrappers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include <raft/handle.hpp>
#include <rmm/device_uvector.hpp>

#include <thrust/sequence.h>

namespace cugraph {
namespace detail {

Expand Down
1 change: 1 addition & 0 deletions cpp/include/cugraph/edge_partition_device_view.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include <thrust/binary_search.h>
#include <thrust/distance.h>
#include <thrust/execution_policy.h>
#include <thrust/optional.h>
#include <thrust/tuple.h>

Expand Down
3 changes: 3 additions & 0 deletions cpp/include/cugraph/prims/count_if_v.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@

#include <thrust/count.h>
#include <thrust/execution_policy.h>
#include <thrust/iterator/counting_iterator.h>
#include <thrust/iterator/transform_iterator.h>
#include <thrust/reduce.h>

namespace cugraph {

Expand Down
17 changes: 17 additions & 0 deletions cpp/include/cugraph/prims/detail/nbr_intersection.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,27 @@
#include <rmm/device_uvector.hpp>
#include <rmm/mr/device/polymorphic_allocator.hpp>

#include <thrust/binary_search.h>
#include <thrust/copy.h>
#include <thrust/count.h>
#include <thrust/distance.h>
#include <thrust/execution_policy.h>
#include <thrust/fill.h>
#include <thrust/for_each.h>
#include <thrust/functional.h>
#include <thrust/gather.h>
#include <thrust/iterator/counting_iterator.h>
#include <thrust/iterator/iterator_traits.h>
#include <thrust/iterator/transform_iterator.h>
#include <thrust/iterator/zip_iterator.h>
#include <thrust/optional.h>
#include <thrust/remove.h>
#include <thrust/scan.h>
#include <thrust/set_operations.h>
#include <thrust/sort.h>
#include <thrust/tabulate.h>
#include <thrust/transform.h>
#include <thrust/tuple.h>
#include <thrust/unique.h>

#include <array>
Expand Down
5 changes: 5 additions & 0 deletions cpp/include/cugraph/prims/edge_partition_src_dst_property.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,15 @@

#include <thrust/binary_search.h>
#include <thrust/distance.h>
#include <thrust/execution_policy.h>
#include <thrust/fill.h>
#include <thrust/iterator/constant_iterator.h>
#include <thrust/iterator/counting_iterator.h>
#include <thrust/iterator/iterator_traits.h>
#include <thrust/iterator/transform_iterator.h>
#include <thrust/iterator/zip_iterator.h>
#include <thrust/optional.h>
#include <thrust/tuple.h>

#include <optional>
#include <type_traits>
Expand Down
5 changes: 5 additions & 0 deletions cpp/include/cugraph/prims/extract_if_e.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@

#include <raft/handle.hpp>

#include <thrust/distance.h>
#include <thrust/iterator/zip_iterator.h>
#include <thrust/remove.h>
#include <thrust/tuple.h>

#include <cstdint>
#include <numeric>
#include <optional>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@
#include <rmm/mr/device/per_device_resource.hpp>
#include <rmm/mr/device/polymorphic_allocator.hpp>

#include <thrust/copy.h>
#include <thrust/count.h>
#include <thrust/distance.h>
#include <thrust/fill.h>
#include <thrust/functional.h>
#include <thrust/iterator/constant_iterator.h>
#include <thrust/iterator/counting_iterator.h>
#include <thrust/iterator/transform_iterator.h>
#include <thrust/iterator/zip_iterator.h>
#include <thrust/reduce.h>
#include <thrust/scatter.h>
#include <thrust/sort.h>
#include <thrust/transform.h>
#include <thrust/tuple.h>
#include <thrust/unique.h>

#include <type_traits>

namespace cugraph {
Expand Down Expand Up @@ -147,7 +163,7 @@ struct reduce_with_init_t {
* @brief Iterate over every vertex's destination key-aggregated outgoing edges to update vertex
* property values.
*
* This function is inspired by thrust::transfrom_reduce().
* This function is inspired by thrust::transform_reduce().
* Unlike per_v_transform_reduce_outgoing_e, this function first aggregates outgoing edges by
* destination keys to support two level reduction for every vertex.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,14 @@

#include <cub/cub.cuh>
#include <thrust/distance.h>
#include <thrust/execution_policy.h>
#include <thrust/fill.h>
#include <thrust/for_each.h>
#include <thrust/functional.h>
#include <thrust/iterator/counting_iterator.h>
#include <thrust/iterator/transform_iterator.h>
#include <thrust/optional.h>
#include <thrust/scatter.h>
#include <thrust/transform_reduce.h>
#include <thrust/tuple.h>
#include <thrust/type_traits/integer_sequence.h>
Expand Down Expand Up @@ -890,7 +897,7 @@ void per_v_transform_reduce_e(raft::handle_t const& handle,
/**
* @brief Iterate over every vertex's incoming edges to update vertex properties.
*
* This function is inspired by thrust::transfrom_reduce.
* This function is inspired by thrust::transform_reduce.
*
* @tparam GraphViewType Type of the passed non-owning graph object.
* @tparam EdgePartitionSrcValueInputWrapper Type of the wrapper for edge partition source property
Expand Down Expand Up @@ -955,7 +962,7 @@ void per_v_transform_reduce_incoming_e(
/**
* @brief Iterate over every vertex's outgoing edges to update vertex properties.
*
* This function is inspired by thrust::transfrom_reduce().
* This function is inspired by thrust::transform_reduce().
*
* @tparam GraphViewType Type of the passed non-owning graph object.
* @tparam EdgePartitionSrcValueInputWrapper Type of the wrapper for edge partition source property
Expand Down
3 changes: 3 additions & 0 deletions cpp/include/cugraph/prims/property_op_utils.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@

#include <cub/cub.cuh>
#include <thrust/detail/type_traits/iterator/is_discard_iterator.h>
#include <thrust/functional.h>
#include <thrust/iterator/discard_iterator.h>
#include <thrust/iterator/iterator_traits.h>
#include <thrust/memory.h>
#include <thrust/tuple.h>

#include <array>
Expand Down
2 changes: 2 additions & 0 deletions cpp/include/cugraph/prims/reduce_op.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

#include <raft/comms/comms.hpp>

#include <thrust/functional.h>

namespace cugraph {
namespace reduce_op {

Expand Down
2 changes: 2 additions & 0 deletions cpp/include/cugraph/prims/reduce_v.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
#include <raft/handle.hpp>
#include <rmm/device_scalar.hpp>

#include <thrust/copy.h>
#include <thrust/execution_policy.h>
#include <thrust/iterator/iterator_traits.h>
#include <thrust/reduce.h>

namespace cugraph {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,21 @@
#include <raft/handle.hpp>
#include <rmm/exec_policy.hpp>

#include <thrust/binary_search.h>
#include <thrust/copy.h>
#include <thrust/count.h>
#include <thrust/execution_policy.h>
#include <thrust/fill.h>
#include <thrust/for_each.h>
#include <thrust/functional.h>
#include <thrust/iterator/counting_iterator.h>
#include <thrust/iterator/iterator_traits.h>
#include <thrust/iterator/zip_iterator.h>
#include <thrust/merge.h>
#include <thrust/reduce.h>
#include <thrust/sort.h>
#include <thrust/tabulate.h>
#include <thrust/tuple.h>

#include <type_traits>

Expand Down Expand Up @@ -172,7 +186,7 @@ struct accumulate_vertex_property_t {
* and one for every vertex in the intersection) per-vertex. We may add
* transform_reduce_triplet_of_dst_nbr_intersection_of_e_endpoints_by_v in the future to allow
* emitting different values for different vertices in the intersection of edge endpoints. This
* function is inspired by thrust::transfrom_reduce().
* function is inspired by thrust::transform_reduce().
*
* @tparam GraphViewType Type of the passed non-owning graph object.
* @tparam EdgePartitionSrcValueInputWrapper Type of the wrapper for edge partition source property
Expand Down
7 changes: 7 additions & 0 deletions cpp/include/cugraph/prims/transform_reduce_e.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
#include <raft/handle.hpp>
#include <rmm/exec_policy.hpp>

#include <thrust/execution_policy.h>
#include <thrust/fill.h>
#include <thrust/functional.h>
#include <thrust/iterator/counting_iterator.h>
#include <thrust/optional.h>
#include <thrust/reduce.h>
#include <thrust/transform_reduce.h>
#include <thrust/tuple.h>

#include <cstdint>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@

#include <raft/handle.hpp>

#include <thrust/copy.h>
#include <thrust/count.h>
#include <thrust/iterator/counting_iterator.h>
#include <thrust/optional.h>
#include <thrust/reduce.h>
#include <thrust/sort.h>
#include <thrust/tuple.h>

#include <type_traits>

namespace cugraph {
Expand Down
3 changes: 3 additions & 0 deletions cpp/include/cugraph/prims/transform_reduce_v.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
#include <raft/handle.hpp>

#include <thrust/execution_policy.h>
#include <thrust/iterator/counting_iterator.h>
#include <thrust/iterator/iterator_traits.h>
#include <thrust/iterator/transform_iterator.h>
#include <thrust/transform_reduce.h>

namespace cugraph {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,24 @@

#include <cub/cub.cuh>
#include <thrust/binary_search.h>
#include <thrust/copy.h>
#include <thrust/count.h>
#include <thrust/distance.h>
#include <thrust/execution_policy.h>
#include <thrust/functional.h>
#include <thrust/iterator/constant_iterator.h>
#include <thrust/iterator/counting_iterator.h>
#include <thrust/iterator/iterator_traits.h>
#include <thrust/iterator/zip_iterator.h>
#include <thrust/optional.h>
#include <thrust/reduce.h>
#include <thrust/remove.h>
#include <thrust/sort.h>
#include <thrust/transform.h>
#include <thrust/transform_reduce.h>
#include <thrust/tuple.h>
#include <thrust/type_traits/integer_sequence.h>
#include <thrust/unique.h>

#include <algorithm>
#include <cstdlib>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,15 @@

#include <thrust/binary_search.h>
#include <thrust/copy.h>
#include <thrust/count.h>
#include <thrust/distance.h>
#include <thrust/execution_policy.h>
#include <thrust/for_each.h>
#include <thrust/gather.h>
#include <thrust/iterator/counting_iterator.h>
#include <thrust/iterator/permutation_iterator.h>
#include <thrust/iterator/transform_iterator.h>
#include <thrust/scatter.h>

#include <algorithm>
#include <numeric>
Expand Down
1 change: 1 addition & 0 deletions cpp/include/cugraph/prims/update_v_frontier.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include <thrust/distance.h>
#include <thrust/functional.h>
#include <thrust/iterator/iterator_traits.h>
#include <thrust/iterator/zip_iterator.h>
#include <thrust/remove.h>
#include <thrust/transform.h>
Expand Down
16 changes: 13 additions & 3 deletions cpp/include/cugraph/prims/vertex_frontier.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,19 @@
#include <rmm/device_scalar.hpp>
#include <rmm/device_uvector.hpp>

#include <thrust/copy.h>
#include <thrust/distance.h>
#include <thrust/fill.h>
#include <thrust/iterator/constant_iterator.h>
#include <thrust/iterator/zip_iterator.h>
#include <thrust/merge.h>
#include <thrust/partition.h>
#include <thrust/reduce.h>
#include <thrust/remove.h>
#include <thrust/sort.h>
#include <thrust/transform.h>
#include <thrust/tuple.h>
#include <thrust/unique.h>

#include <cinttypes>
#include <cstddef>
Expand Down Expand Up @@ -357,7 +367,7 @@ class vertex_frontier_t {
thrust::make_zip_iterator(thrust::make_tuple(bucket_indices.begin(), this_bucket.begin()));
auto new_this_bucket_size = static_cast<size_t>(thrust::distance(
pair_first,
thrust::stable_partition( // stalbe_partition to maintain sorted order within each bucket
thrust::stable_partition( // stable_partition to maintain sorted order within each bucket
handle_ptr_->get_thrust_policy(),
pair_first,
pair_first + bucket_indices.size(),
Expand Down Expand Up @@ -397,7 +407,7 @@ class vertex_frontier_t {
} else if (to_bucket_indices.size() == 2) {
auto next_bucket_size = static_cast<size_t>(thrust::distance(
pair_first,
thrust::stable_partition( // stalbe_partition to maintain sorted order within each bucket
thrust::stable_partition( // stable_partition to maintain sorted order within each bucket
handle_ptr_->get_thrust_policy(),
pair_first,
pair_last,
Expand All @@ -410,7 +420,7 @@ class vertex_frontier_t {
next_bucket_size,
static_cast<size_t>(thrust::distance(pair_first + next_bucket_size, pair_last))};
} else {
thrust::stable_sort( // stalbe_sort to maintain sorted order within each bucket
thrust::stable_sort( // stable_sort to maintain sorted order within each bucket
handle_ptr_->get_thrust_policy(),
pair_first,
pair_last,
Expand Down
11 changes: 11 additions & 0 deletions cpp/include/cugraph/utilities/collect_comm.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,19 @@
#include <rmm/mr/device/per_device_resource.hpp>
#include <rmm/mr/device/polymorphic_allocator.hpp>

#include <thrust/adjacent_difference.h>
#include <thrust/binary_search.h>
#include <thrust/copy.h>
#include <thrust/distance.h>
#include <thrust/execution_policy.h>
#include <thrust/find.h>
#include <thrust/functional.h>
#include <thrust/iterator/iterator_traits.h>
#include <thrust/iterator/zip_iterator.h>
#include <thrust/sort.h>
#include <thrust/transform.h>
#include <thrust/tuple.h>
#include <thrust/unique.h>

#include <iterator>
#include <memory>
Expand Down
Loading

0 comments on commit d0863d4

Please sign in to comment.