How to I use atomic functions? any library?

I see

#define ATOMICS 0

in histogram sample, but don’t quite get it.

in your cuda toolkit installation folder/include there is a file called sm_11_atomic_functions.h
All the supported atomic functions are defined there.
Keep in mind that atomic functions are only supported on Devices with
compute capability 1.1

Thanks! I included <sm_11_atomic_functions.h> after reading your reply. But the compiler still says:


1> identifier “atomicAdd” is undefined

1> temp_ipCount=atomicAdd(ipCount, 1);

I’m using Visual Studio 2005 for CUDA development. I read in some sample “add ‘arch sm_11’ to the command line” but have no idea how to do it in Visual Studio or if it is neccessary.

Add this as a compiler argument:

-arch sm_11

So in visual studio right click on your .cu file and go click properties > custom build step > command line, and add it so it looks something like:


“$(CUDA_BIN_PATH)\nvcc.exe” -arch sm_11 -ccbin …