VS2008 NVCC dependency analysis?

We all know that in (any version of) visual studio whenever an included header file changes for a source file, this source file is rebuilt when “BUILD SOLUTION (F7)” is pressed. However, for NVCC this does not work. :thumbsdown:

This is very annoying for (at least) two reasons

  1. You change a header file included in your .cu and the cubin is not rebuilt. If you are not careful you end up running your binary with stale code
  2. Usually this could (partly) be solved by creating multiple .cu files, which, when change are properly recognised and rebuilt. However, nvcc does NOT have support for linking multiple .cu files together, everyhing has to be in one file (or included therein) (*).

Is there some way to force the dependency analysis of Visual Studio to be active for CUDA files as well? Is this some issue with MSVC, or can a future update of CUDA solve this somewhow?

Error: External calls are not supported (found non-inlined call to …)

nvcc can of course do this. I do it all the time. It works just like gcc: nvcc -o file.o -c file.cu, and then link the o files together.

I’m no expert on dependency handling in visual studio projects, so I cannot answer your questions there. Microsoft tools operate by complicated and undocumented black magic as far as I’m concerned. However, I can tell you that if you generate your visual studio project with CMake (and use FindCuda.cmake for CUDA) all the dependencies are setup correctly.