10 #include <type_traits>
13 #define ALPAKA_ASSERT(...) assert(__VA_ARGS__)
17 #define ALPAKA_NOOP(...) \
24 #if !defined(ALPAKA_DISABLE_ASSERT_ACC)
25 # define ALPAKA_ASSERT_ACC_IMPL(...) ALPAKA_ASSERT(__VA_ARGS__)
27 # define ALPAKA_ASSERT_ACC_IMPL(...) ALPAKA_NOOP(__VA_ARGS__)
35 #if defined(ALPAKA_ACC_GPU_CUDA_ENABLED) && defined(__CUDA_ARCH__)
37 # define ALPAKA_ASSERT_ACC(...) ALPAKA_ASSERT_ACC_IMPL(__VA_ARGS__)
38 #elif defined(ALPAKA_ACC_GPU_HIP_ENABLED) && defined(__HIP_DEVICE_COMPILE__)
40 # define ALPAKA_ASSERT_ACC(...) ALPAKA_ASSERT_ACC_IMPL(__VA_ARGS__)
41 #elif defined(ALPAKA_ACC_SYCL_ENABLED) && defined(__SYCL_DEVICE_ONLY__)
43 # if defined(SYCL_EXT_ONEAPI_ASSERT)
44 # define ALPAKA_ASSERT_ACC(...) ALPAKA_ASSERT_ACC_IMPL(__VA_ARGS__)
46 # define ALPAKA_ASSERT_ACC(...) ALPAKA_NOOP(__VA_ARGS__)
52 # define ALPAKA_ASSERT_ACC(...) ALPAKA_ASSERT(__VA_ARGS__)
59 template<
typename TArg>
63 [[maybe_unused]] TArg
const&
arg)
65 if constexpr(std::is_signed_v<TArg>)
76 template<
typename TArg>
84 template<
typename TLhs,
typename TRhs>
88 [[maybe_unused]] TRhs
const& rhs)
90 if constexpr(std::is_signed_v<TRhs> || (TLhs::value != 0u))
100 template<
typename TLhs,
typename TRhs>
#define ALPAKA_ASSERT_ACC(...)
ALPAKA_ASSERT_ACC is an assert-like macro.
#define ALPAKA_FN_HOST_ACC
#define ALPAKA_NO_HOST_ACC_WARNING
Disable nvcc warning: 'calling a host function from host device function.' Usage: ALPAKA_NO_HOST_ACC_...
ALPAKA_NO_HOST_ACC_WARNING constexpr ALPAKA_FN_HOST_ACC auto assertValueUnsigned(TArg const &arg) -> void
This method checks integral values if they are greater or equal zero. The implementation prevents war...
ALPAKA_NO_HOST_ACC_WARNING constexpr ALPAKA_FN_HOST_ACC auto assertGreaterThan(TRhs const &rhs) -> void
This function asserts that the integral value TLhs is greater than TRhs.
constexpr ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_HOST_ACC T arg(Complex< T > const &x)
Argument.
ALPAKA_NO_HOST_ACC_WARNING static constexpr ALPAKA_FN_HOST_ACC auto assertGreaterThan([[maybe_unused]] TRhs const &rhs)
ALPAKA_NO_HOST_ACC_WARNING static constexpr ALPAKA_FN_HOST_ACC auto assertValueUnsigned([[maybe_unused]] TArg const &arg)