smanders / externpro

build external projects with cmake
MIT License
13 stars 12 forks source link

nvcc flags #313

Open smanders opened 3 years ago

smanders commented 3 years ago

see discussion https://isrhub.usurf.usu.edu/VantagePlugins/PluginLibraries/pull/17

bnelson619 commented 3 years ago

nvcc processes .cu source files (at a high level) as follows:

  1. Parse the .cu file and separate the CPU-based (host) code from the GPU-based (device) code.
  2. Inject device driver calls as appropriate into the host code (allows calling GPU code to look very much like a function call via the syntax deviceFunction<<<grid, block>>>(args...)).
  3. Use the host compiler (cl/g++) to compile the host code.
  4. Use the device compiler to compile the device code.

The flags passed to the host compiler in step 3 must be specified via the nvcc option -XCompiler. We need to ensure that the flags from CMAKE_CXX_FLAGS* are propagated to the -XCompiler option.