Atomic Operations in Visual Studio 2010

Hi,

I am going to use atomics in my application. However, there is a little problem with my code. When I compile the my code ( *.cu file) which contains atomicAdd(), it fails and returns “indentifier atomicAdd() is undefined” .

I use Microsoft Visual Studio 2010, with CUDA 5.0 sdk on win7 64 bit. The device is GeForce gtx 660 ti.

can anybody help me in this regard?
Thank you very much

I found the solution!

I enclosed my code (atomicAdd() invocation) in a #if block and used CUDA_ARCH macro as follows:

#if CUDA_ARCH >= 110
atomicAdd( & vals[0] , 10);
atomicAdd( & vals[1] , 12);
#endif

The code enclosed in the if block is grayed.
I don’t know, why the compiler does not compile with proper flags (i.e. codegen = arch=300) and returns this error. However, when the application is built, it works properly and atomicAdd also works!!!