Skip to content

Commit 576500e

Browse files
Remove obsolete ways to set iterator category (NVIDIA#2759)
1 parent ab6ffd4 commit 576500e

8 files changed

+40
-126
lines changed

cub/cub/iterator/arg_index_input_iterator.cuh

+3-15
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,11 @@
4646
#include <cub/thread/thread_load.cuh>
4747
#include <cub/thread/thread_store.cuh>
4848

49+
#include <thrust/iterator/iterator_facade.h>
50+
#include <thrust/iterator/iterator_traits.h>
4951
#include <thrust/version.h>
5052

51-
#include <iostream>
52-
#include <iterator>
53-
54-
#if (THRUST_VERSION >= 100700)
55-
// This iterator is compatible with Thrust API 1.7 and newer
56-
# include <thrust/iterator/iterator_facade.h>
57-
# include <thrust/iterator/iterator_traits.h>
58-
#endif // THRUST_VERSION
53+
#include <ostream>
5954

6055
CUB_NAMESPACE_BEGIN
6156

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

135-
#if (THRUST_VERSION >= 100700)
136-
// Use Thrust's iterator categories so we can use these iterators in Thrust 1.7 (or newer) methods
137-
138130
/// The iterator category
139131
using iterator_category = typename THRUST_NS_QUALIFIER::detail::iterator_facade_category<
140132
THRUST_NS_QUALIFIER::any_system_tag,
141133
THRUST_NS_QUALIFIER::random_access_traversal_tag,
142134
value_type,
143135
reference>::type;
144-
#else
145-
/// The iterator category
146-
using iterator_category = std::random_access_iterator_tag;
147-
#endif // THRUST_VERSION
148136

149137
private:
150138
InputIteratorT itr;

cub/cub/iterator/cache_modified_input_iterator.cuh

+11-19
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,19 @@
4343
# pragma system_header
4444
#endif // no system header
4545

46-
#if !defined(_CCCL_COMPILER_NVRTC)
46+
#ifdef _CCCL_COMPILER_NVRTC
47+
# include <cuda/std/iterator>
48+
#else // _CCCL_COMPILER_NVRTC
49+
# include <thrust/iterator/iterator_facade.h>
50+
# include <thrust/iterator/iterator_traits.h>
51+
4752
# include <iostream>
4853
# include <iterator>
49-
#else
50-
# include <cuda/std/iterator>
51-
#endif
54+
#endif // _CCCL_COMPILER_NVRTC
5255

5356
#include <cub/thread/thread_load.cuh>
5457
#include <cub/thread/thread_store.cuh>
5558

56-
#if (THRUST_VERSION >= 100700)
57-
// This iterator is compatible with Thrust API 1.7 and newer
58-
# include <thrust/iterator/iterator_facade.h>
59-
# include <thrust/iterator/iterator_traits.h>
60-
#endif // THRUST_VERSION
61-
6259
CUB_NAMESPACE_BEGIN
6360

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

129-
#if !defined(_CCCL_COMPILER_NVRTC)
130-
# if (THRUST_VERSION >= 100700)
131-
// Use Thrust's iterator categories so we can use these iterators in Thrust 1.7 (or newer) methods
126+
#ifdef _CCCL_COMPILER_NVRTC
127+
using iterator_category = ::cuda::std::random_access_iterator_tag;
128+
#else // _CCCL_COMPILER_NVRTC
132129
using iterator_category = typename THRUST_NS_QUALIFIER::detail::iterator_facade_category<
133130
THRUST_NS_QUALIFIER::device_system_tag,
134131
THRUST_NS_QUALIFIER::random_access_traversal_tag,
135132
value_type,
136133
reference>::type;
137-
# else // THRUST_VERSION < 100700
138-
using iterator_category = std::random_access_iterator_tag;
139-
# endif // THRUST_VERSION
140-
#else // defined(_CCCL_COMPILER_NVRTC)
141-
using iterator_category = ::cuda::std::random_access_iterator_tag;
142-
#endif // defined(_CCCL_COMPILER_NVRTC)
134+
#endif // _CCCL_COMPILER_NVRTC
143135

144136
public:
145137
/// Wrapped native pointer

cub/cub/iterator/cache_modified_output_iterator.cuh

+3-14
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,10 @@
4646
#include <cub/thread/thread_load.cuh>
4747
#include <cub/thread/thread_store.cuh>
4848

49-
#include <iostream>
50-
#include <iterator>
49+
#include <thrust/iterator/iterator_facade.h>
50+
#include <thrust/iterator/iterator_traits.h>
5151

52-
#if (THRUST_VERSION >= 100700)
53-
// This iterator is compatible with Thrust API 1.7 and newer
54-
# include <thrust/iterator/iterator_facade.h>
55-
# include <thrust/iterator/iterator_traits.h>
56-
#endif // THRUST_VERSION
52+
#include <iosfwd>
5753

5854
CUB_NAMESPACE_BEGIN
5955

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

146-
#if (THRUST_VERSION >= 100700)
147-
// Use Thrust's iterator categories so we can use these iterators in Thrust 1.7 (or newer) methods
148-
149142
/// The iterator category
150143
using iterator_category = typename THRUST_NS_QUALIFIER::detail::iterator_facade_category<
151144
THRUST_NS_QUALIFIER::device_system_tag,
152145
THRUST_NS_QUALIFIER::random_access_traversal_tag,
153146
value_type,
154147
reference>::type;
155-
#else
156-
/// The iterator category
157-
using iterator_category = std::random_access_iterator_tag;
158-
#endif // THRUST_VERSION
159148

160149
private:
161150
ValueType* ptr;

cub/cub/iterator/constant_input_iterator.cuh

+3-14
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,10 @@
4646
#include <cub/thread/thread_load.cuh>
4747
#include <cub/thread/thread_store.cuh>
4848

49-
#include <iostream>
50-
#include <iterator>
49+
#include <thrust/iterator/iterator_facade.h>
50+
#include <thrust/iterator/iterator_traits.h>
5151

52-
#if (THRUST_VERSION >= 100700)
53-
// This iterator is compatible with Thrust API 1.7 and newer
54-
# include <thrust/iterator/iterator_facade.h>
55-
# include <thrust/iterator/iterator_traits.h>
56-
#endif // THRUST_VERSION
52+
#include <ostream>
5753

5854
CUB_NAMESPACE_BEGIN
5955

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

114-
#if (THRUST_VERSION >= 100700)
115-
// Use Thrust's iterator categories so we can use these iterators in Thrust 1.7 (or newer) methods
116-
117110
/// The iterator category
118111
using iterator_category = typename THRUST_NS_QUALIFIER::detail::iterator_facade_category<
119112
THRUST_NS_QUALIFIER::any_system_tag,
120113
THRUST_NS_QUALIFIER::random_access_traversal_tag,
121114
value_type,
122115
reference>::type;
123-
#else
124-
/// The iterator category
125-
using iterator_category = std::random_access_iterator_tag;
126-
#endif // THRUST_VERSION
127116

128117
private:
129118
ValueType val;

cub/cub/iterator/counting_input_iterator.cuh

+10-21
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,14 @@
4646
#include <cub/thread/thread_load.cuh>
4747
#include <cub/thread/thread_store.cuh>
4848

49-
#if !defined(_CCCL_COMPILER_NVRTC)
50-
# include <iostream>
51-
# include <iterator>
52-
#else
53-
# include <cuda/std/iterator>
54-
#endif
55-
5649
#include <cuda/std/iterator>
5750

58-
#if (THRUST_VERSION >= 100700)
59-
// This iterator is compatible with Thrust API 1.7 and newer
51+
#ifndef _CCCL_COMPILER_NVRTC
6052
# include <thrust/iterator/iterator_facade.h>
6153
# include <thrust/iterator/iterator_traits.h>
62-
#endif // THRUST_VERSION
54+
55+
# include <ostream>
56+
#endif // _CCCL_COMPILER_NVRTC
6357

6458
CUB_NAMESPACE_BEGIN
6559

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

119-
#if !defined(_CCCL_COMPILER_NVRTC)
120-
# if (THRUST_VERSION >= 100700)
121-
// Use Thrust's iterator categories so we can use these iterators in Thrust 1.7 (or newer) methods
113+
#ifdef _CCCL_COMPILER_NVRTC
114+
using iterator_category = ::cuda::std::random_access_iterator_tag;
115+
#else // _CCCL_COMPILER_NVRTC
122116
using iterator_category = typename THRUST_NS_QUALIFIER::detail::iterator_facade_category<
123117
THRUST_NS_QUALIFIER::any_system_tag,
124118
THRUST_NS_QUALIFIER::random_access_traversal_tag,
125119
value_type,
126120
reference>::type;
127-
# else // THRUST_VERSION < 100700
128-
using iterator_category = std::random_access_iterator_tag;
129-
# endif // THRUST_VERSION
130-
#else // defined(_CCCL_COMPILER_NVRTC)
131-
using iterator_category = ::cuda::std::random_access_iterator_tag;
132-
#endif // defined(_CCCL_COMPILER_NVRTC)
121+
#endif // _CCCL_COMPILER_NVRTC
133122

134123
private:
135124
ValueType val;
@@ -228,13 +217,13 @@ public:
228217
}
229218

230219
/// ostream operator
231-
#if !defined(_CCCL_COMPILER_NVRTC)
220+
#ifndef _CCCL_COMPILER_NVRTC
232221
friend std::ostream& operator<<(std::ostream& os, const self_type& itr)
233222
{
234223
os << "[" << itr.val << "]";
235224
return os;
236225
}
237-
#endif
226+
#endif // _CCCL_COMPILER_NVRTC
238227
};
239228

240229
CUB_NAMESPACE_END

cub/cub/iterator/discard_output_iterator.cuh

+3-14
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,10 @@
4343
# pragma system_header
4444
#endif // no system header
4545

46-
#include <iostream>
47-
#include <iterator>
46+
#include <thrust/iterator/iterator_facade.h>
47+
#include <thrust/iterator/iterator_traits.h>
4848

49-
#if (THRUST_VERSION >= 100700)
50-
// This iterator is compatible with Thrust API 1.7 and newer
51-
# include <thrust/iterator/iterator_facade.h>
52-
# include <thrust/iterator/iterator_traits.h>
53-
#endif // THRUST_VERSION
49+
#include <ostream>
5450

5551
CUB_NAMESPACE_BEGIN
5652

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

81-
#if (THRUST_VERSION >= 100700)
82-
// Use Thrust's iterator categories so we can use these iterators in Thrust 1.7 (or newer) methods
83-
8477
/// The iterator category
8578
using iterator_category = typename THRUST_NS_QUALIFIER::detail::iterator_facade_category<
8679
THRUST_NS_QUALIFIER::any_system_tag,
8780
THRUST_NS_QUALIFIER::random_access_traversal_tag,
8881
value_type,
8982
reference>::type;
90-
#else
91-
/// The iterator category
92-
using iterator_category = std::random_access_iterator_tag;
93-
#endif // THRUST_VERSION
9483

9584
private:
9685
OffsetT offset;

cub/cub/iterator/tex_obj_input_iterator.cuh

+4-15
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,12 @@
4747
#include <cub/thread/thread_store.cuh>
4848
#include <cub/util_debug.cuh>
4949

50-
#include <iostream>
51-
#include <iterator>
50+
#include <thrust/iterator/iterator_facade.h>
51+
#include <thrust/iterator/iterator_traits.h>
5252

53-
#include <nv/target>
53+
#include <ostream>
5454

55-
#if (THRUST_VERSION >= 100700)
56-
// This iterator is compatible with Thrust API 1.7 and newer
57-
# include <thrust/iterator/iterator_facade.h>
58-
# include <thrust/iterator/iterator_traits.h>
59-
#endif // THRUST_VERSION
55+
#include <nv/target>
6056

6157
CUB_NAMESPACE_BEGIN
6258

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

131-
#if (THRUST_VERSION >= 100700)
132-
// Use Thrust's iterator categories so we can use these iterators in Thrust 1.7 (or newer) methods
133-
134127
/// The iterator category
135128
using iterator_category = typename THRUST_NS_QUALIFIER::detail::iterator_facade_category<
136129
THRUST_NS_QUALIFIER::device_system_tag,
137130
THRUST_NS_QUALIFIER::random_access_traversal_tag,
138131
value_type,
139132
reference>::type;
140-
#else
141-
/// The iterator category
142-
using iterator_category = std::random_access_iterator_tag;
143-
#endif // THRUST_VERSION
144133

145134
private:
146135
// Largest texture word we can use in device

cub/cub/iterator/transform_input_iterator.cuh

+3-14
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,10 @@
4646
#include <cub/thread/thread_load.cuh>
4747
#include <cub/thread/thread_store.cuh>
4848

49-
#include <iostream>
50-
#include <iterator>
49+
#include <thrust/iterator/iterator_facade.h>
50+
#include <thrust/iterator/iterator_traits.h>
5151

52-
#if (THRUST_VERSION >= 100700)
53-
// This iterator is compatible with Thrust API 1.7 and newer
54-
# include <thrust/iterator/iterator_facade.h>
55-
# include <thrust/iterator/iterator_traits.h>
56-
#endif // THRUST_VERSION
52+
#include <iosfwd>
5753

5854
CUB_NAMESPACE_BEGIN
5955

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

137-
#if (THRUST_VERSION >= 100700)
138-
// Use Thrust's iterator categories so we can use these iterators in Thrust 1.7 (or newer) methods
139-
140133
/// The iterator category
141134
using iterator_category = typename THRUST_NS_QUALIFIER::detail::iterator_facade_category<
142135
THRUST_NS_QUALIFIER::any_system_tag,
143136
THRUST_NS_QUALIFIER::random_access_traversal_tag,
144137
value_type,
145138
reference>::type;
146-
#else
147-
/// The iterator category
148-
using iterator_category = std::random_access_iterator_tag;
149-
#endif // THRUST_VERSION
150139

151140
private:
152141
ConversionOp conversion_op;

0 commit comments

Comments
 (0)