Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Make async algos require C++14, remove SFINAE context from entry points. #1225

Merged
merged 1 commit into from
Aug 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmake/header_test.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#define THRUST_CPP11_REQUIRED_NO_ERROR
#define THRUST_CPP14_REQUIRED_NO_ERROR
#define THRUST_MODERN_GCC_REQUIRED_NO_ERROR
#include <thrust/${header}>
1 change: 1 addition & 0 deletions internal/build/warningstester_create_uber_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def find_headers(base_dir, rel_dir, exclude = ['\B']):
print('#error no include files found\n')

print('#define THRUST_CPP11_REQUIRED_NO_ERROR')
print('#define THRUST_CPP14_REQUIRED_NO_ERROR')
print('#define THRUST_MODERN_GCC_REQUIRED_NO_ERROR')
for h in headers:
print('#include <' + h + '>')
Expand Down
4 changes: 2 additions & 2 deletions testing/async_copy.cu
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <thrust/detail/config.h>

#if THRUST_CPP_DIALECT >= 2011 && !defined(THRUST_LEGACY_GCC)
#if THRUST_CPP_DIALECT >= 2014

#include <unittest/unittest.h>
#include <unittest/util_async.h>
Expand All @@ -18,7 +18,7 @@
auto operator()( \
ForwardIt&& first, Sentinel&& last, OutputIt&& output \
) const \
THRUST_DECLTYPE_RETURNS( \
THRUST_RETURNS( \
::thrust::async::copy( \
__VA_ARGS__ \
THRUST_PP_COMMA_IF(THRUST_PP_ARITY(__VA_ARGS__)) \
Expand Down
4 changes: 2 additions & 2 deletions testing/async_for_each.cu
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <thrust/detail/config.h>

#if THRUST_CPP_DIALECT >= 2011 && !defined(THRUST_LEGACY_GCC)
#if THRUST_CPP_DIALECT >= 2014

#include <unittest/unittest.h>

Expand All @@ -16,7 +16,7 @@
auto operator()( \
ForwardIt&& first, Sentinel&& last, UnaryFunction&& f \
) const \
THRUST_DECLTYPE_RETURNS( \
THRUST_RETURNS( \
::thrust::async::for_each( \
__VA_ARGS__ \
THRUST_PP_COMMA_IF(THRUST_PP_ARITY(__VA_ARGS__)) \
Expand Down
6 changes: 3 additions & 3 deletions testing/async_reduce.cu
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <thrust/detail/config.h>

#if THRUST_CPP_DIALECT >= 2011 && !defined(THRUST_LEGACY_GCC)
#if THRUST_CPP_DIALECT >= 2014

#include <unittest/unittest.h>
#include <unittest/util_async.h>
Expand Down Expand Up @@ -48,7 +48,7 @@ struct custom_plus
auto operator()( \
ForwardIt&& first, Sentinel&& last \
) \
THRUST_DECLTYPE_RETURNS( \
THRUST_RETURNS( \
::thrust::async::reduce( \
__VA_ARGS__ \
) \
Expand Down Expand Up @@ -76,7 +76,7 @@ struct custom_plus
auto operator()( \
ForwardIt&& first, Sentinel&& last \
) \
THRUST_DECLTYPE_RETURNS( \
THRUST_RETURNS( \
::thrust::reduce( \
__VA_ARGS__ \
) \
Expand Down
6 changes: 3 additions & 3 deletions testing/async_reduce_into.cu
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <thrust/detail/config.h>

#if THRUST_CPP_DIALECT >= 2011 && !defined(THRUST_LEGACY_GCC)
#if THRUST_CPP_DIALECT >= 2014

#include <unittest/unittest.h>
#include <unittest/util_async.h>
Expand Down Expand Up @@ -49,7 +49,7 @@ struct custom_plus
auto operator()( \
ForwardIt&& first, Sentinel&& last, OutputIt&& output \
) \
THRUST_DECLTYPE_RETURNS( \
THRUST_RETURNS( \
::thrust::async::reduce_into( \
__VA_ARGS__ \
) \
Expand Down Expand Up @@ -77,7 +77,7 @@ struct custom_plus
auto operator()( \
ForwardIt&& first, Sentinel&& last \
) \
THRUST_DECLTYPE_RETURNS( \
THRUST_RETURNS( \
::thrust::reduce( \
__VA_ARGS__ \
) \
Expand Down
15 changes: 10 additions & 5 deletions testing/async_sort.cu
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
#include <thrust/detail/config.h>

// Disabled on MSVC for GH issue #1098
#if THRUST_CPP_DIALECT >= 2011 && !defined(THRUST_LEGACY_GCC) && \
THRUST_HOST_COMPILER != THRUST_HOST_COMPILER_MSVC
// Disabled on MSVC && NVCC < 11.1 for GH issue #1098.
#if (THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_MSVC) && defined(__CUDACC__)
#if (__CUDACC_VER_MAJOR__ < 11) || (__CUDACC_VER_MAJOR__ == 11 && __CUDACC_VER_MINOR__ < 1)
#define THRUST_BUG_1098_ACTIVE
#endif // NVCC version check
#endif // MSVC + NVCC check

#if THRUST_CPP_DIALECT >= 2014 && !defined(THRUST_BUG_1098_ACTIVE)

#include <unittest/unittest.h>

Expand Down Expand Up @@ -50,7 +55,7 @@ struct custom_greater
static auto async( \
ForwardIt&& first, Sentinel&& last \
) \
THRUST_DECLTYPE_RETURNS( \
THRUST_RETURNS( \
::thrust::async::sort( \
__VA_ARGS__ \
THRUST_PP_COMMA_IF(THRUST_PP_ARITY(__VA_ARGS__)) \
Expand Down Expand Up @@ -91,7 +96,7 @@ DEFINE_SORT_INVOKER(
static auto async( \
ForwardIt&& first, Sentinel&& last \
) \
THRUST_DECLTYPE_RETURNS( \
THRUST_RETURNS( \
::thrust::async::sort( \
__VA_ARGS__ \
THRUST_PP_COMMA_IF(THRUST_PP_ARITY(__VA_ARGS__)) \
Expand Down
6 changes: 3 additions & 3 deletions testing/async_transform.cu
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <thrust/detail/config.h>

#if THRUST_CPP_DIALECT >= 2011 && !defined(THRUST_LEGACY_GCC)
#if THRUST_CPP_DIALECT >= 2014

#include <unittest/unittest.h>
#include <unittest/util_async.h>
Expand Down Expand Up @@ -48,7 +48,7 @@ struct divide_by_2
ForwardIt&& first, Sentinel&& last, OutputIt&& output \
, UnaryOperation&& op \
) \
THRUST_DECLTYPE_RETURNS( \
THRUST_RETURNS( \
::thrust::async::transform( \
__VA_ARGS__ \
) \
Expand Down Expand Up @@ -78,7 +78,7 @@ struct divide_by_2
ForwardIt&& first, Sentinel&& last, OutputIt&& output \
, UnaryOperation&& op \
) \
THRUST_DECLTYPE_RETURNS( \
THRUST_RETURNS( \
::thrust::transform( \
__VA_ARGS__ \
) \
Expand Down
13 changes: 6 additions & 7 deletions thrust/async/copy.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@
#pragma once

#include <thrust/detail/config.h>
#include <thrust/detail/cpp11_required.h>
#include <thrust/detail/modern_gcc_required.h>
#include <thrust/detail/cpp14_required.h>

#if THRUST_CPP_DIALECT >= 2011 && !defined(THRUST_LEGACY_GCC)
#if THRUST_CPP_DIALECT >= 2014

#include <thrust/detail/static_assert.h>
#include <thrust/detail/select_system.h>
Expand Down Expand Up @@ -82,7 +81,7 @@ struct copy_fn final
, OutputIt&& output
)
// ADL dispatch.
THRUST_DECLTYPE_RETURNS(
THRUST_RETURNS(
async_copy(
thrust::detail::derived_cast(thrust::detail::strip_const(from_exec))
, thrust::detail::derived_cast(thrust::detail::strip_const(to_exec))
Expand All @@ -101,7 +100,7 @@ struct copy_fn final
, ForwardIt&& first, Sentinel&& last
, OutputIt&& output
)
THRUST_DECLTYPE_RETURNS(
THRUST_RETURNS(
copy_fn::call(
thrust::detail::derived_cast(thrust::detail::strip_const(exec))
// Synthesize a suitable new execution policy, because we don't want to
Expand All @@ -117,7 +116,7 @@ struct copy_fn final
template <typename ForwardIt, typename Sentinel, typename OutputIt>
__host__
static auto call(ForwardIt&& first, Sentinel&& last, OutputIt&& output)
THRUST_DECLTYPE_RETURNS(
THRUST_RETURNS(
copy_fn::call(
thrust::detail::select_system(
typename thrust::iterator_system<remove_cvref_t<ForwardIt>>::type{}
Expand All @@ -133,7 +132,7 @@ struct copy_fn final
template <typename... Args>
THRUST_NODISCARD __host__
auto operator()(Args&&... args) const
THRUST_DECLTYPE_RETURNS(
THRUST_RETURNS(
call(THRUST_FWD(args)...)
)
};
Expand Down
11 changes: 5 additions & 6 deletions thrust/async/for_each.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@
#pragma once

#include <thrust/detail/config.h>
#include <thrust/detail/cpp11_required.h>
#include <thrust/detail/modern_gcc_required.h>
#include <thrust/detail/cpp14_required.h>

#if THRUST_CPP_DIALECT >= 2011 && !defined(THRUST_LEGACY_GCC)
#if THRUST_CPP_DIALECT >= 2014

#include <thrust/detail/static_assert.h>
#include <thrust/detail/select_system.h>
Expand Down Expand Up @@ -79,7 +78,7 @@ struct for_each_fn final
, UnaryFunction&& f
)
// ADL dispatch.
THRUST_DECLTYPE_RETURNS(
THRUST_RETURNS(
async_for_each(
thrust::detail::derived_cast(thrust::detail::strip_const(exec))
, THRUST_FWD(first), THRUST_FWD(last)
Expand All @@ -90,7 +89,7 @@ struct for_each_fn final
template <typename ForwardIt, typename Sentinel, typename UnaryFunction>
__host__
static auto call(ForwardIt&& first, Sentinel&& last, UnaryFunction&& f)
THRUST_DECLTYPE_RETURNS(
THRUST_RETURNS(
for_each_fn::call(
thrust::detail::select_system(
typename iterator_system<remove_cvref_t<ForwardIt>>::type{}
Expand All @@ -103,7 +102,7 @@ struct for_each_fn final
template <typename... Args>
THRUST_NODISCARD __host__
auto operator()(Args&&... args) const
THRUST_DECLTYPE_RETURNS(
THRUST_RETURNS(
call(THRUST_FWD(args)...)
)
};
Expand Down
Loading