atomic operations atomicExch is undefined

Hello! The problem: atomicExch (and others atomicXXX) is not recognized by nvcc. The card is Quadro FX1700, compute capability 1.1, VS2005, CUDA Wizard 1.2
#include <cutil.h> …
#include <sm_11_atomic_functions.h>
global void kernel1(…) {
… zzz=atomicExch(&row[ix], row[ix]+xxx); …

The compiler error:
c:\cuda\include\common_functions.h(56): warning: dllexport/dllimport conflict with “clock”
C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE\time.h(176): here; dllimport/dllexport dropped error: identifier “atomicExch” is undefined
1 error detected in the compilation of “C:\DOCUME~/tmpxft_00000f64_00000000-6_testcudadll.cpp1.ii”

What could cause the problem? Thanks.

To use the atomic functions you need to add “-arch sm_11” to your nvcc command line.

Great thanks! It works!


I have the same problem but when I added “-arch sm_11” to my comand line, it gave me this error "nvcc fatal : redefinition of argument ‘gpu-name’ "

I am now using CUDA VS Wizard 2.0 for VS2005 and my graphics card is GeForce 8500GT. If I am not wrong, 8500 is of compute capability 1.1, so I think the problem lies in the command line.

The default command line given is

nvcc.exe  -ccbin "C:\Program Files\Microsoft Visual Studio 8\VC\bin" -I"C:\progra~1\CUDA\include" -I"C:\Program Files\NVIDIA Corporation\NVIDIA CUDA SDK\common\inc" -O0 -D_DEBUG -D_CONSOLE -arch sm_10 -code sm_10 --host-compilation C++ -g -c -m 32 -o "Debug\main.obj" -odir "Debug" -ext none -int none

I am thinking that if I change the flag, “-arch sm_10” to “-arch sm_11”, it might solve the problem, but I cant edit my command line…

can anyone help me on this?


I tried to change the default (in Microsoft Visual Studio 8\VC\VCProjectDefaults\cuda.rules ) to -arch sm_11 and -code sm_11 and it worked.

right key on project-> cuda -> advanced -> 1.1 (hardware) Arch&1.1 (hardware) code

Could you give more detail on how to modify the command line? I am new to Visual Studio and a bit lost. I did not understand:

“right key on project-> cuda -> advanced -> 1.1 (hardware) Arch&1.1 (hardware) code”

The only reference to to a nvcc.exe command line is in the “custom build rules”.

Mine shows:

nvcc.exe [AllOptions] [AdditionalOptions] $(InputFileName)

Any help would be greatly appreciated.

right key on project->properties->cuda -> advanced -> 1.1 (hardware) Arch&1.1 (hardware) code

BTW, you can have a look at this video which i made for beginner to make a cuda project step by step in Visual Studio.

When I Right click on project -> properties ->???

I find no reference to CUDA.

I also clicked on the link to your homepage and can not find the video you mentioned.

Thanks for the help

to sigfreund:

you can find the video here: