16#ifndef dealii_cuda_atomic_h
17#define dealii_cuda_atomic_h
21#ifdef DEAL_II_WITH_CUDA
34 inline __device__
float
37 int *address_as_int =
reinterpret_cast<int *
>(address);
38 int old = *address_as_int, assumed;
42 old = atomicCAS(address_as_int,
44 atomicMax(address_as_int, __float_as_int(val)));
46 while (assumed != old);
48 return __longlong_as_double(old);
58 inline __device__
double
61 unsigned long long int *address_as_ull =
62 reinterpret_cast<unsigned long long int *
>(address);
63 unsigned long long int old = *address_as_ull, assumed;
67 old = atomicCAS(address_as_ull,
69 atomicMax(address_as_ull,
70 static_cast<unsigned long long int>(
71 __double_as_longlong(val))));
73 while (assumed != old);
75 return __longlong_as_double(old);
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
float atomicMax_wrapper(float *address, float val)