Double variable AtomicAdd

I am trying to use the double atomic add in my project but i have always the same error :
error: identifier “__longlong_as_double” is undefined
error: identifier “__double_as_longlong” is undefined
error: no instance of overloaded function “atomicCAS” matches the argument list
identifier “__longlong_as_double” is undefined
Function code used :

device double MyAtomicAdd(double* address, double val)
unsigned long long int* address_as_ull = (unsigned long long int*)address;

unsigned long long int old = *address_as_ull, assumed;

do{ assumed = old;
old = atomicCAS(address_as_ull, assumed,__double_as_longlong(val +__longlong_as_double(assum$
} while (assumed != old);

return __longlong_as_double(old);

This was posted to an inappropriate forum (“Announcements”). Please exercise care in selecting a forum in the future.

Make sure you compile your code for the correct compute capability, for example by specifying the appropriate target architecture with the -arch switch of nvcc. The error messages you are seeing are consistent with the hypothesis that you are compiling for a compute capability 1.0 platform which is the compiler default in older versions of CUDA.

i didn’t understand… what should i change exactly? Can you help me step by step
do i have to change something in the make file or i have to add a specific library ??

What GPU do you have? Each GPU has a specific compute capability (architecture). I am reasonably sure that for what you are trying to accomplish you will need at least compute capability 2.0. You then specify the compute capability for nvcc when you compile the CUDA code. For example, your GPU may be a Tesla K20, which is compute capability 3.5. You would compile your code with nvcc -arch=sm_35.

Where the relevant invocation of nvcc occurs in your build and how the correct command line switches are fed to nvcc will depend on the build system you use, I do not have any insights into that. If your CUDA code is just a single file for now, you can simply build it from the command line:

nvcc -arch=[GPU-architecture-specification] -o [executable-name] [source-file]