From 576500e3708aaf05c44eb0793a7aa069a2c7c820 Mon Sep 17 00:00:00 2001 From: Bernhard Manfred Gruber Date: Tue, 12 Nov 2024 10:09:48 +0100 Subject: [PATCH] Remove obsolete ways to set iterator category (#2759) --- cub/cub/iterator/arg_index_input_iterator.cuh | 18 ++--------- .../cache_modified_input_iterator.cuh | 30 +++++++----------- .../cache_modified_output_iterator.cuh | 17 ++-------- cub/cub/iterator/constant_input_iterator.cuh | 17 ++-------- cub/cub/iterator/counting_input_iterator.cuh | 31 ++++++------------- cub/cub/iterator/discard_output_iterator.cuh | 17 ++-------- cub/cub/iterator/tex_obj_input_iterator.cuh | 19 +++--------- cub/cub/iterator/transform_input_iterator.cuh | 17 ++-------- 8 files changed, 40 insertions(+), 126 deletions(-) diff --git a/cub/cub/iterator/arg_index_input_iterator.cuh b/cub/cub/iterator/arg_index_input_iterator.cuh index 413f38853d1..fdd3f184203 100644 --- a/cub/cub/iterator/arg_index_input_iterator.cuh +++ b/cub/cub/iterator/arg_index_input_iterator.cuh @@ -46,16 +46,11 @@ #include #include +#include +#include #include -#include -#include - -#if (THRUST_VERSION >= 100700) -// This iterator is compatible with Thrust API 1.7 and newer -# include -# include -#endif // THRUST_VERSION +#include CUB_NAMESPACE_BEGIN @@ -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; diff --git a/cub/cub/iterator/cache_modified_input_iterator.cuh b/cub/cub/iterator/cache_modified_input_iterator.cuh index 06456e2a669..89903d01ebb 100644 --- a/cub/cub/iterator/cache_modified_input_iterator.cuh +++ b/cub/cub/iterator/cache_modified_input_iterator.cuh @@ -43,22 +43,19 @@ # pragma system_header #endif // no system header -#if !defined(_CCCL_COMPILER_NVRTC) +#ifdef _CCCL_COMPILER_NVRTC +# include +#else // _CCCL_COMPILER_NVRTC +# include +# include + # include # include -#else -# include -#endif +#endif // _CCCL_COMPILER_NVRTC #include #include -#if (THRUST_VERSION >= 100700) -// This iterator is compatible with Thrust API 1.7 and newer -# include -# include -#endif // THRUST_VERSION - CUB_NAMESPACE_BEGIN /** @@ -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 diff --git a/cub/cub/iterator/cache_modified_output_iterator.cuh b/cub/cub/iterator/cache_modified_output_iterator.cuh index b442a4ad99a..fa4e501b80f 100644 --- a/cub/cub/iterator/cache_modified_output_iterator.cuh +++ b/cub/cub/iterator/cache_modified_output_iterator.cuh @@ -46,14 +46,10 @@ #include #include -#include -#include +#include +#include -#if (THRUST_VERSION >= 100700) -// This iterator is compatible with Thrust API 1.7 and newer -# include -# include -#endif // THRUST_VERSION +#include CUB_NAMESPACE_BEGIN @@ -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; diff --git a/cub/cub/iterator/constant_input_iterator.cuh b/cub/cub/iterator/constant_input_iterator.cuh index 1c3babc3f31..87252292d86 100644 --- a/cub/cub/iterator/constant_input_iterator.cuh +++ b/cub/cub/iterator/constant_input_iterator.cuh @@ -46,14 +46,10 @@ #include #include -#include -#include +#include +#include -#if (THRUST_VERSION >= 100700) -// This iterator is compatible with Thrust API 1.7 and newer -# include -# include -#endif // THRUST_VERSION +#include CUB_NAMESPACE_BEGIN @@ -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; diff --git a/cub/cub/iterator/counting_input_iterator.cuh b/cub/cub/iterator/counting_input_iterator.cuh index 5a384d45fc8..bee7f1349dd 100644 --- a/cub/cub/iterator/counting_input_iterator.cuh +++ b/cub/cub/iterator/counting_input_iterator.cuh @@ -46,20 +46,14 @@ #include #include -#if !defined(_CCCL_COMPILER_NVRTC) -# include -# include -#else -# include -#endif - #include -#if (THRUST_VERSION >= 100700) -// This iterator is compatible with Thrust API 1.7 and newer +#ifndef _CCCL_COMPILER_NVRTC # include # include -#endif // THRUST_VERSION + +# include +#endif // _CCCL_COMPILER_NVRTC CUB_NAMESPACE_BEGIN @@ -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; @@ -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 diff --git a/cub/cub/iterator/discard_output_iterator.cuh b/cub/cub/iterator/discard_output_iterator.cuh index b54f86d0946..4b3698d53f3 100644 --- a/cub/cub/iterator/discard_output_iterator.cuh +++ b/cub/cub/iterator/discard_output_iterator.cuh @@ -43,14 +43,10 @@ # pragma system_header #endif // no system header -#include -#include +#include +#include -#if (THRUST_VERSION >= 100700) -// This iterator is compatible with Thrust API 1.7 and newer -# include -# include -#endif // THRUST_VERSION +#include CUB_NAMESPACE_BEGIN @@ -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; diff --git a/cub/cub/iterator/tex_obj_input_iterator.cuh b/cub/cub/iterator/tex_obj_input_iterator.cuh index 0837b074486..76ba47924e6 100644 --- a/cub/cub/iterator/tex_obj_input_iterator.cuh +++ b/cub/cub/iterator/tex_obj_input_iterator.cuh @@ -47,16 +47,12 @@ #include #include -#include -#include +#include +#include -#include +#include -#if (THRUST_VERSION >= 100700) -// This iterator is compatible with Thrust API 1.7 and newer -# include -# include -#endif // THRUST_VERSION +#include CUB_NAMESPACE_BEGIN @@ -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 diff --git a/cub/cub/iterator/transform_input_iterator.cuh b/cub/cub/iterator/transform_input_iterator.cuh index a396a2dd81d..9e3166afb82 100644 --- a/cub/cub/iterator/transform_input_iterator.cuh +++ b/cub/cub/iterator/transform_input_iterator.cuh @@ -46,14 +46,10 @@ #include #include -#include -#include +#include +#include -#if (THRUST_VERSION >= 100700) -// This iterator is compatible with Thrust API 1.7 and newer -# include -# include -#endif // THRUST_VERSION +#include CUB_NAMESPACE_BEGIN @@ -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;