where -arch sm_11 in VS2008? error: identifier "atomicAdd" is undefined


i have an error when compiling the subsequent code, the error is:

error: identifier “atomicAdd” is undefined

i use a 8400 gs graphic card with compute capability 1.1 and compile my code with VS2008, in my previous post one person commented that maybe i do not compile my code with -arch sm_11, i cant understand how can i use -arch sm_11 in VS2008. anyone can help me what’s this meaning? and how can i fix this error?

#include <sm_11_atomic_functions.h>

#include <cuda.h>

__global__ void VecAdd(int* old){

if( i < N){

if( k < epsilon)

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



If you don’t know how to compile with sm_11, then do the following:

  1. On the Solution Explorer on the right-hand side of the screen, right click your project name and select “Properties”.

  2. On the left-hand side of the box that pops up, there is a field you can click called “CUDA Build Rule v3.0.0” (yours might have a different version number?).

  3. Now click where you can type into the box to the right of “GPU Architecture” and replace (presumably) sm_10 with sm_11.

Easy as 1-2-3. Hope this is what you were talking about.

Hey Zenosparadox thanks for that.

I have always wondered if mine is configured properly (originally a copy of either an SDK one, or someone elses) and I have similarly had troubles with atomics. From what you say my .csproj is obviously inferior to the one you are using.

If I do what you say, in the “Custom Build Step” for the project in the describtion field it just says “Performing Custom Build Step” nothing else there or anywhere I can find.

However if I view the properties for a file that is part of that project and view the Custom Build Step for that file in the Command line field (if Debug mode) it has

(CUDA_BIN_PATH)\nvcc.exe" -ccbin "(VCInstallDir)bin” -c -D_DEBUG -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Wp64,/Od,/Zi,/RTC1,/MTd -I"(CUDA_INC_PATH)" -I./ -I../../common/inc -o (ConfigurationName)$(InputName).obj $(InputFileName)

(NB /Wp64 is in there and that is causing a heap of “deprecated” warnings and -arch sm_… not visible anywhere)

—and for Release mode —
(CUDA_BIN_PATH)\nvcc.exe" -ccbin "(VCInstallDir)bin” -c -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Wp64,/O2,/Zi,/MT -I"(CUDA_INC_PATH)" -I./ -I../../common/inc -o (ConfigurationName)$(InputName).obj $(InputFileName)

– and different again for each of the Emus —

As this is for the file it means every .cu file has to have similaar entries for its Visual Studio properties. If I view the .csproj with UltraEdit it is quite lenghly and repetetive.

Also if I do the same for the simpleAtomicIntrinsics from the SDK then VisualStudio only allows me to view the CommandLine, I have to use UltraEdit to see that it is
-arch sm_11. So with that one ‘atomics’ work, but it also has layers of dependencies that have made it to painful to pick up a ‘project’ file and move it into our master solution :( and as a result I have had to avoid using atomics.

So its all a bit of a mess really.

Q: Is there a better way for the .csproj to be set up ?
Q: is there an example somewhere ?

I am using Cuda with C#, also sometimes with C++ or C

Thanks in advance

thank you!