c++ - CMake: How to pass mode dependent compile flags to nvcc in visual studio environment -


i using cmake compile cuda codes, don't know how pass different compile flags nvcc, in debug or release mode. wish can specify follows,

set(cuda_gene_flags_debug "-gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37") set(cuda_gene_flags_release "-xptxas -o3 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37") 

so when specify debug or release mode in visual studio, these flags can chosen automatically. can give me hand on this? thanks.

i encountered same problem while compiling linking openmp cuda program.

according latest cmake document findcuda here, should try these 3 variables: cuda_nvcc_flags, cuda_nvcc_flags_debug , cuda_nvcc_flags_release.

but didn't work me , found reference.

if none of above variables work, try use cmake_cuda_flags workaround:

set(cmake_cuda_flags ${your_flags}) 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -