How to set CUDA compiler flags in Visual Studio 2010?

After constantly getting error : identifier "atomicAdd" is undefined I found a solution for compiling with the -arch sm_20 flag. But how to pass this compiler flag in VS 2010? I tried this under Project > Properties :

enter image description here

But this, apparently, did not affect, and the error persists - what am I doing wrong?

Thank you very much.

+3
source share
3 answers

In this dialog box, you can select options for generating GPU code:

GPU Code Generation

In this case, "compute_20" means that I am compiling for virtual computing architecture 2.0 - the virtual architecture affects the stage of PTX generation.

The second part that comes after a coma is "sm_21". This affects the generation phase of CUBIN. It defines the real architecture of the GPU. I want to compile PTX.

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

+12
source

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

+2
source

Remember that there are separate properties for both the project file and .cu. Apparently they are merged before compilation.

I was caught by this while trying to specify a GPU for computing 3.0 and above, but the .cu properties had some remaining specifications for 1.0 and 2.0

+2
source

All Articles