I want to compile cuda to ptx for embedding. For this I am using CMAKE 3.18.5 with visual studio 16(2019) generator, which is a requirement from the project. The problem I am having is that the target flags are duplicated compute_75,compute_75;compute_75,sm_75 and because of that nvcc refuses to compile it to ptx.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\BuildCustomizations\CUDA 11.2.targets(625,9): error : More than 1 Code Generation option is specified, this is only allowed if NVCC Compilation Type is 'compile' or 'fatbin'.
For a minimal working example I use a code example for how to do this from a github repo which was featured in nvidia devblog. This example works. I change the example to require CMAKE 3.18 (from 3.8) and add
set_property(TARGET CudaPTX PROPERTY CUDA_ARCHITECTURES 75)
set_property(TARGET ExportPTX PROPERTY CUDA_ARCHITECTURES off)
At line 51 (after target_include_directories) and my problem is manifested. screenshot.
- What am I doing wrong?
- How do I begin debugging something like this?
- How can I change my code example to compile, given I require cmake 3.18 and vs2019?