11 #include <type_traits>
23 auto const old = *addr;
26 # pragma GCC diagnostic push
27 # pragma GCC diagnostic ignored "-Wconversion"
32 # pragma GCC diagnostic pop
45 auto const old = *addr;
48 # pragma GCC diagnostic push
49 # pragma GCC diagnostic ignored "-Wconversion"
53 # pragma GCC diagnostic pop
67 auto const old = *addr;
82 auto const old = *addr;
97 auto const old = *addr;
114 auto const old = *addr;
116 ref = ((old >= value) ?
static_cast<T
>(0) :
static_cast<T
>(old +
static_cast<T
>(1)));
131 auto const old = *addr;
133 ref = (((old ==
static_cast<T
>(0)) || (old > value)) ? value :
static_cast<T
>(old -
static_cast<T
>(1)));
146 auto const old = *addr;
161 auto const old = *addr;
176 auto const old = *addr;
189 template<
typename T, std::enable_if_t<!std::is_
floating_po
int_v<T>,
bool> = true>
192 auto const old = *addr;
197 #if BOOST_COMP_GNUC && (BOOST_COMP_GNUC == BOOST_VERSION_NUMBER(7, 4, 0))
198 # pragma GCC diagnostic push
199 # pragma GCC diagnostic ignored "-Wstrict-overflow"
202 ref = ((old == compare) ? value : old);
203 #if BOOST_COMP_GNUC && (BOOST_COMP_GNUC == BOOST_VERSION_NUMBER(7, 4, 0))
204 # pragma GCC diagnostic pop
212 template<
typename T, std::enable_if_t<std::is_
floating_po
int_v<T>,
bool> = true>
215 static_assert(
sizeof(T) == 4u ||
sizeof(T) == 8u,
"AtomicCas is supporting only 32bit and 64bit values!");
217 using BitType = std::conditional_t<
sizeof(T) == 4u,
unsigned int,
unsigned long long>;
230 auto const old = *addr;
235 #if BOOST_COMP_GNUC && (BOOST_COMP_GNUC == BOOST_VERSION_NUMBER(7, 4, 0))
236 # pragma GCC diagnostic push
237 # pragma GCC diagnostic ignored "-Wstrict-overflow"
242 ref = ((o.r == c.r) ? value : old);
243 #if BOOST_COMP_GNUC && (BOOST_COMP_GNUC == BOOST_VERSION_NUMBER(7, 4, 0))
244 # pragma GCC diagnostic pop
#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 ALPAKA_FN_HOST_ACC auto max(T const &max_ctx, Tx const &x, Ty const &y)
Returns the larger of two arguments. NaNs are treated as missing data (between a NaN and a numeric va...
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_HOST_ACC auto min(T const &min_ctx, Tx const &x, Ty const &y)
Returns the smaller of two arguments. NaNs are treated as missing data (between a NaN and a numeric v...
The alpaka accelerator library.
The addition function object.
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_HOST_ACC auto operator()(T *const addr, T const &value) const -> T
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_HOST_ACC auto operator()(T *const addr, T const &value) const -> T
The compare and swap function object.
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_HOST_ACC auto operator()(T *addr, T const &compare, T const &value) const -> T
AtomicCas for non floating point values.
The decrement function object.
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_HOST_ACC auto operator()(T *const addr, T const &value) const -> T
Decrement down to 0, then reset to value.
The exchange function object.
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_HOST_ACC auto operator()(T *const addr, T const &value) const -> T
The increment function object.
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_HOST_ACC auto operator()(T *const addr, T const &value) const -> T
Increments up to value, then reset to 0.
The maximum function object.
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_HOST_ACC auto operator()(T *const addr, T const &value) const -> T
The minimum function object.
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_HOST_ACC auto operator()(T *const addr, T const &value) const -> T
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_HOST_ACC auto operator()(T *const addr, T const &value) const -> T
The subtraction function object.
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_HOST_ACC auto operator()(T *const addr, T const &value) const -> T
The exclusive or function object.
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_HOST_ACC auto operator()(T *const addr, T const &value) const -> T