How to set CUDA compiler flags in Visual Studio 2010?

后端 未结 3 1332
后悔当初
后悔当初 2020-11-30 13:17

After persistently getting error : identifier \"atomicAdd\" is undefined, I\'ve found the solution to be to compile with -arch sm_20 flag. But how

相关标签:
3条回答
  • 2020-11-30 13:36

    Be aware that there's separate properties for both the project and .cu files. Apparently they get merged before compilation.

    I'd gotten caught by this trying to specify GPUs for compute 3.0 & greater, but .cu properties had some leftover specifications for 1.0 & 2.0

    0 讨论(0)
  • 2020-11-30 13:37

    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.

    0 讨论(0)
  • 2020-11-30 13:55

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

    0 讨论(0)
提交回复
热议问题