nvcc Custom Build in Visual Studio? how to?

I’ve been using IDE running CUDA samples and modifying them, thus I have no idea what it is like using nvcc. Is it all through command line, requiring makefile?

If I need to specify some nvcc custom build parameter for compiling (like -arch sm_11), can I set it somewhere in Visual Studio?

I’m asking these originally because I can’t use atomic functions. Even though I included <sm_11_atomic_functions.h> which defines all the atomic functions, the compiler of VS still reports “identifier ‘atomicAdd’ is undefined”. What should I do?

If you’re using VS IDE and you right-click on your .cu file in your project and choose Properties you’ll be able to look at the custom build command, command line (if one exists already, otherwise you’ll need to add one) For example:

(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)

You’ll need to be sure to include you header using the -I option.

Hope that answers your question…

What GPU are you using?

You need to have a compute capability 1.1 GPU in order to use atomicAdd.

maybe this is your problem?

[edit]Just saw someone already pointed out the compute capability 1.1[/edit]


I do have one GeForce8800 GT which is of compute capability 1.1…