1 #ifndef HeterogeneousCore_AlpakaInterface_interface_atomicMaxF_h 2 #define HeterogeneousCore_AlpakaInterface_interface_atomicMaxF_h 4 #include <alpaka/alpaka.hpp> 10 template <
typename TAcc,
typename = std::enable_if_t<alpaka::isAccelerator<TAcc>>>
11 ALPAKA_FN_HOST_ACC ALPAKA_FN_INLINE
static float atomicMaxF(
const TAcc& acc,
float* address,
float val) {
12 #if defined(__CUDA_ARCH__) or defined(__HIP_DEVICE_COMPILE__) 14 int ret = __float_as_int(*address);
15 while (
val > __int_as_float(
ret)) {
20 return __int_as_float(
ret);
23 int ret = edm::bit_cast<
int>(*address);
24 while (
val > edm::bit_cast<float>(
ret)) {
26 if ((
ret = alpaka::atomicCas(acc, (
int*)address, old, edm::bit_cast<int>(
val))) == old)
29 return edm::bit_cast<
float>(
ret);
30 #endif // __CUDA_ARCH__ or __HIP_DEVICE_COMPILE__ 33 #endif // HeterogeneousCore_AlpakaInterface_interface_atomicMaxF_h
T1 atomicCAS(T1 *address, T1 compare, T2 val)
ret
prodAgent to be discontinued
ALPAKA_FN_HOST_ACC static ALPAKA_FN_INLINE float atomicMaxF(const TAcc &acc, float *address, float val)