Skip to content

Commit

Permalink
Remove obsolete ways to set iterator category (#2759)
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardmgruber authored Nov 12, 2024
1 parent ab6ffd4 commit 576500e
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 126 deletions.
18 changes: 3 additions & 15 deletions cub/cub/iterator/arg_index_input_iterator.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,11 @@
#include <cub/thread/thread_load.cuh>
#include <cub/thread/thread_store.cuh>

#include <thrust/iterator/iterator_facade.h>
#include <thrust/iterator/iterator_traits.h>
#include <thrust/version.h>

#include <iostream>
#include <iterator>

#if (THRUST_VERSION >= 100700)
// This iterator is compatible with Thrust API 1.7 and newer
# include <thrust/iterator/iterator_facade.h>
# include <thrust/iterator/iterator_traits.h>
#endif // THRUST_VERSION
#include <ostream>

CUB_NAMESPACE_BEGIN

Expand Down Expand Up @@ -132,19 +127,12 @@ public:
/// The type of a reference to an element the iterator can point to
using reference = value_type;

#if (THRUST_VERSION >= 100700)
// Use Thrust's iterator categories so we can use these iterators in Thrust 1.7 (or newer) methods

/// The iterator category
using iterator_category = typename THRUST_NS_QUALIFIER::detail::iterator_facade_category<
THRUST_NS_QUALIFIER::any_system_tag,
THRUST_NS_QUALIFIER::random_access_traversal_tag,
value_type,
reference>::type;
#else
/// The iterator category
using iterator_category = std::random_access_iterator_tag;
#endif // THRUST_VERSION

private:
InputIteratorT itr;
Expand Down
30 changes: 11 additions & 19 deletions cub/cub/iterator/cache_modified_input_iterator.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,19 @@
# pragma system_header
#endif // no system header

#if !defined(_CCCL_COMPILER_NVRTC)
#ifdef _CCCL_COMPILER_NVRTC
# include <cuda/std/iterator>
#else // _CCCL_COMPILER_NVRTC
# include <thrust/iterator/iterator_facade.h>
# include <thrust/iterator/iterator_traits.h>

# include <iostream>
# include <iterator>
#else
# include <cuda/std/iterator>
#endif
#endif // _CCCL_COMPILER_NVRTC

#include <cub/thread/thread_load.cuh>
#include <cub/thread/thread_store.cuh>

#if (THRUST_VERSION >= 100700)
// This iterator is compatible with Thrust API 1.7 and newer
# include <thrust/iterator/iterator_facade.h>
# include <thrust/iterator/iterator_traits.h>
#endif // THRUST_VERSION

CUB_NAMESPACE_BEGIN

/**
Expand Down Expand Up @@ -126,20 +123,15 @@ public:
/// The type of a reference to an element the iterator can point to
using reference = ValueType;

#if !defined(_CCCL_COMPILER_NVRTC)
# if (THRUST_VERSION >= 100700)
// Use Thrust's iterator categories so we can use these iterators in Thrust 1.7 (or newer) methods
#ifdef _CCCL_COMPILER_NVRTC
using iterator_category = ::cuda::std::random_access_iterator_tag;
#else // _CCCL_COMPILER_NVRTC
using iterator_category = typename THRUST_NS_QUALIFIER::detail::iterator_facade_category<
THRUST_NS_QUALIFIER::device_system_tag,
THRUST_NS_QUALIFIER::random_access_traversal_tag,
value_type,
reference>::type;
# else // THRUST_VERSION < 100700
using iterator_category = std::random_access_iterator_tag;
# endif // THRUST_VERSION
#else // defined(_CCCL_COMPILER_NVRTC)
using iterator_category = ::cuda::std::random_access_iterator_tag;
#endif // defined(_CCCL_COMPILER_NVRTC)
#endif // _CCCL_COMPILER_NVRTC

public:
/// Wrapped native pointer
Expand Down
17 changes: 3 additions & 14 deletions cub/cub/iterator/cache_modified_output_iterator.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,10 @@
#include <cub/thread/thread_load.cuh>
#include <cub/thread/thread_store.cuh>

#include <iostream>
#include <iterator>
#include <thrust/iterator/iterator_facade.h>
#include <thrust/iterator/iterator_traits.h>

#if (THRUST_VERSION >= 100700)
// This iterator is compatible with Thrust API 1.7 and newer
# include <thrust/iterator/iterator_facade.h>
# include <thrust/iterator/iterator_traits.h>
#endif // THRUST_VERSION
#include <iosfwd>

CUB_NAMESPACE_BEGIN

Expand Down Expand Up @@ -143,19 +139,12 @@ public:
/// The type of a reference to an element the iterator can point to
using reference = Reference;

#if (THRUST_VERSION >= 100700)
// Use Thrust's iterator categories so we can use these iterators in Thrust 1.7 (or newer) methods

/// The iterator category
using iterator_category = typename THRUST_NS_QUALIFIER::detail::iterator_facade_category<
THRUST_NS_QUALIFIER::device_system_tag,
THRUST_NS_QUALIFIER::random_access_traversal_tag,
value_type,
reference>::type;
#else
/// The iterator category
using iterator_category = std::random_access_iterator_tag;
#endif // THRUST_VERSION

private:
ValueType* ptr;
Expand Down
17 changes: 3 additions & 14 deletions cub/cub/iterator/constant_input_iterator.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,10 @@
#include <cub/thread/thread_load.cuh>
#include <cub/thread/thread_store.cuh>

#include <iostream>
#include <iterator>
#include <thrust/iterator/iterator_facade.h>
#include <thrust/iterator/iterator_traits.h>

#if (THRUST_VERSION >= 100700)
// This iterator is compatible with Thrust API 1.7 and newer
# include <thrust/iterator/iterator_facade.h>
# include <thrust/iterator/iterator_traits.h>
#endif // THRUST_VERSION
#include <ostream>

CUB_NAMESPACE_BEGIN

Expand Down Expand Up @@ -111,19 +107,12 @@ public:
/// The type of a reference to an element the iterator can point to
using reference = ValueType;

#if (THRUST_VERSION >= 100700)
// Use Thrust's iterator categories so we can use these iterators in Thrust 1.7 (or newer) methods

/// The iterator category
using iterator_category = typename THRUST_NS_QUALIFIER::detail::iterator_facade_category<
THRUST_NS_QUALIFIER::any_system_tag,
THRUST_NS_QUALIFIER::random_access_traversal_tag,
value_type,
reference>::type;
#else
/// The iterator category
using iterator_category = std::random_access_iterator_tag;
#endif // THRUST_VERSION

private:
ValueType val;
Expand Down
31 changes: 10 additions & 21 deletions cub/cub/iterator/counting_input_iterator.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,14 @@
#include <cub/thread/thread_load.cuh>
#include <cub/thread/thread_store.cuh>

#if !defined(_CCCL_COMPILER_NVRTC)
# include <iostream>
# include <iterator>
#else
# include <cuda/std/iterator>
#endif

#include <cuda/std/iterator>

#if (THRUST_VERSION >= 100700)
// This iterator is compatible with Thrust API 1.7 and newer
#ifndef _CCCL_COMPILER_NVRTC
# include <thrust/iterator/iterator_facade.h>
# include <thrust/iterator/iterator_traits.h>
#endif // THRUST_VERSION

# include <ostream>
#endif // _CCCL_COMPILER_NVRTC

CUB_NAMESPACE_BEGIN

Expand Down Expand Up @@ -116,20 +110,15 @@ public:
/// The type of a reference to an element the iterator can point to
using reference = ValueType;

#if !defined(_CCCL_COMPILER_NVRTC)
# if (THRUST_VERSION >= 100700)
// Use Thrust's iterator categories so we can use these iterators in Thrust 1.7 (or newer) methods
#ifdef _CCCL_COMPILER_NVRTC
using iterator_category = ::cuda::std::random_access_iterator_tag;
#else // _CCCL_COMPILER_NVRTC
using iterator_category = typename THRUST_NS_QUALIFIER::detail::iterator_facade_category<
THRUST_NS_QUALIFIER::any_system_tag,
THRUST_NS_QUALIFIER::random_access_traversal_tag,
value_type,
reference>::type;
# else // THRUST_VERSION < 100700
using iterator_category = std::random_access_iterator_tag;
# endif // THRUST_VERSION
#else // defined(_CCCL_COMPILER_NVRTC)
using iterator_category = ::cuda::std::random_access_iterator_tag;
#endif // defined(_CCCL_COMPILER_NVRTC)
#endif // _CCCL_COMPILER_NVRTC

private:
ValueType val;
Expand Down Expand Up @@ -228,13 +217,13 @@ public:
}

/// ostream operator
#if !defined(_CCCL_COMPILER_NVRTC)
#ifndef _CCCL_COMPILER_NVRTC
friend std::ostream& operator<<(std::ostream& os, const self_type& itr)
{
os << "[" << itr.val << "]";
return os;
}
#endif
#endif // _CCCL_COMPILER_NVRTC
};

CUB_NAMESPACE_END
17 changes: 3 additions & 14 deletions cub/cub/iterator/discard_output_iterator.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,10 @@
# pragma system_header
#endif // no system header

#include <iostream>
#include <iterator>
#include <thrust/iterator/iterator_facade.h>
#include <thrust/iterator/iterator_traits.h>

#if (THRUST_VERSION >= 100700)
// This iterator is compatible with Thrust API 1.7 and newer
# include <thrust/iterator/iterator_facade.h>
# include <thrust/iterator/iterator_traits.h>
#endif // THRUST_VERSION
#include <ostream>

CUB_NAMESPACE_BEGIN

Expand Down Expand Up @@ -78,19 +74,12 @@ public:
/// The type of a reference to an element the iterator can point to
using reference = void;

#if (THRUST_VERSION >= 100700)
// Use Thrust's iterator categories so we can use these iterators in Thrust 1.7 (or newer) methods

/// The iterator category
using iterator_category = typename THRUST_NS_QUALIFIER::detail::iterator_facade_category<
THRUST_NS_QUALIFIER::any_system_tag,
THRUST_NS_QUALIFIER::random_access_traversal_tag,
value_type,
reference>::type;
#else
/// The iterator category
using iterator_category = std::random_access_iterator_tag;
#endif // THRUST_VERSION

private:
OffsetT offset;
Expand Down
19 changes: 4 additions & 15 deletions cub/cub/iterator/tex_obj_input_iterator.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,12 @@
#include <cub/thread/thread_store.cuh>
#include <cub/util_debug.cuh>

#include <iostream>
#include <iterator>
#include <thrust/iterator/iterator_facade.h>
#include <thrust/iterator/iterator_traits.h>

#include <nv/target>
#include <ostream>

#if (THRUST_VERSION >= 100700)
// This iterator is compatible with Thrust API 1.7 and newer
# include <thrust/iterator/iterator_facade.h>
# include <thrust/iterator/iterator_traits.h>
#endif // THRUST_VERSION
#include <nv/target>

CUB_NAMESPACE_BEGIN

Expand Down Expand Up @@ -128,19 +124,12 @@ public:
/// The type of a reference to an element the iterator can point to
using reference = T;

#if (THRUST_VERSION >= 100700)
// Use Thrust's iterator categories so we can use these iterators in Thrust 1.7 (or newer) methods

/// The iterator category
using iterator_category = typename THRUST_NS_QUALIFIER::detail::iterator_facade_category<
THRUST_NS_QUALIFIER::device_system_tag,
THRUST_NS_QUALIFIER::random_access_traversal_tag,
value_type,
reference>::type;
#else
/// The iterator category
using iterator_category = std::random_access_iterator_tag;
#endif // THRUST_VERSION

private:
// Largest texture word we can use in device
Expand Down
17 changes: 3 additions & 14 deletions cub/cub/iterator/transform_input_iterator.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,10 @@
#include <cub/thread/thread_load.cuh>
#include <cub/thread/thread_store.cuh>

#include <iostream>
#include <iterator>
#include <thrust/iterator/iterator_facade.h>
#include <thrust/iterator/iterator_traits.h>

#if (THRUST_VERSION >= 100700)
// This iterator is compatible with Thrust API 1.7 and newer
# include <thrust/iterator/iterator_facade.h>
# include <thrust/iterator/iterator_traits.h>
#endif // THRUST_VERSION
#include <iosfwd>

CUB_NAMESPACE_BEGIN

Expand Down Expand Up @@ -134,19 +130,12 @@ public:
/// The type of a reference to an element the iterator can point to
using reference = ValueType;

#if (THRUST_VERSION >= 100700)
// Use Thrust's iterator categories so we can use these iterators in Thrust 1.7 (or newer) methods

/// The iterator category
using iterator_category = typename THRUST_NS_QUALIFIER::detail::iterator_facade_category<
THRUST_NS_QUALIFIER::any_system_tag,
THRUST_NS_QUALIFIER::random_access_traversal_tag,
value_type,
reference>::type;
#else
/// The iterator category
using iterator_category = std::random_access_iterator_tag;
#endif // THRUST_VERSION

private:
ConversionOp conversion_op;
Expand Down

0 comments on commit 576500e

Please sign in to comment.