error: identifier "atomicAdd" is undefinede


i have an error when using atomicAdd() function in vs08 compiler the error is:

error: identifier “atomicAdd” is undefinede

my code is like this:

__global__ void VecAdd(int* old){

if( i < N){

if( k < epsilon)

int value = atomicAdd(&old[0], 1);



how can i fix this error?

It’s in “sm_11_atomic_functions.h” and other similarly named include files. I would make sure you’re including the correct include file: [font=“Courier New”]#include <cuda.h>[/font] should be enough, I think.

Actually, I think this means he isn’t compiling with -arch sm_11 or greater.

i use “sm_11_atomic_functions.h” and “cuda.h” but problem not fix yet. ho can i check that compiling perform with -arch sm_11?

how can i check that compiling perform with -arch sm_11?

You have to specify it to the compiler.
If you are using cuda build rule, there you will have ‘GPU architecture’ option in the properties of the .cu file. Make it sm_11.
Or else if you are using custom build rule, add “-arch sm_11" to the commandline.
By default it will be sm_10.

thank you!