MCPcopy Create free account
hub / github.com/NGSolve/ngsolve / atomicAdd

Function atomicAdd

ngscuda/cuda_core.hpp:21–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19#ifdef __CUDA_ARCH__
20#if __CUDA_ARCH__ < 600
21 inline __device__ double atomicAdd(double* address, double val)
22 {
23 unsigned long long int* address_as_ull =
24 (unsigned long long int*)address;
25 unsigned long long int old = *address_as_ull, assumed;
26
27 do {
28 assumed = old;
29 old = atomicCAS(address_as_ull, assumed,
30 __double_as_longlong(val +
31 __longlong_as_double(assumed)));
32
33 // Note: uses integer comparison to avoid hang in case of NaN (since NaN != NaN)
34 } while (assumed != old);
35
36 return __longlong_as_double(old);
37 }
38#endif
39#endif
40

Callers 10

WorkerFunction · 0.85
RunParallelFunction · 0.85
BlockJacobiKernelFunction · 0.85
BlockJacobiTransKernelFunction · 0.85
DeviceRegionTimerClass · 0.85
~DeviceRegionTimerFunction · 0.85
MultAddMethod · 0.85
MultTransAddMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected