How to set CUDA compiler flags in Visual Studio 2010?

After persistently getting error : identifier "atomicAdd" is undefined, I've found the solution to be to compile with -arch sm_20 flag. But how to pass this compiler flag in VS 2010? I have tried like so under Project > Properties:

enter image description here

But this apparently has had no effect and the error persists - what am I doing wrong?

Many thanks.


You can select the options for the GPU Code Generation in this dialog:

GPU Code Generation

In this case "compute_20" means that i am compiling for the virtual compute architecture 2.0 - virtual architecture influences the PTX generation stage.

The second part that comes after the coma is "sm_21".This influences the CUBIN generation stage. It defines the real GPU architecture i want to compile the PTX to.

You can find detailed description of the nvcc command line parameters that control the code generation here.


Go to the "Device" section under "CUDA C/C++". There, within "Code Generation" you can specify your sm_20. No need for the -arch.