[cmake-developers] CUDA as a compiler instead FindCUDA?

James Bigler jamesbigler at gmail.com
Fri Jan 16 14:16:38 EST 2015

On Fri, Jan 16, 2015 at 6:46 AM, Brad King <brad.king at kitware.com> wrote:

> On 01/16/2015 06:54 AM, Adam Strzelecki wrote:
> > Hi. It makes me curious why CUDA support is not just implemented
> > as compiler via proper CMakeDetermineCUDACompiler
> I don't think there is any reason besides no one doing it yet.
Whenever someone brings this up I want to make sure these features get

1. Support for dependency scanning.  If I change a header included by
file.cu I want file.cu to be recompiled.  This is easy for makefiles, hard
for anything else.
2. In the past there have been bugs with nvcc, such as leaving a partially
written output file during generation that failed, that FindCUDA has worked
3. Host flags generally need to be propagated to the CUDA flags (I'll admit
that this support in FindCUDA isn't perfect).
4. How do you support other targets besides cubin (obj), such as PTX?
5. How would separable compilation work?  Especially since you can't easily
replace the linker.
6. If you support PTX, can you use the output as input for other custom
commands (I like to encode the PTX into strings compiled into C++ files
using bin2c from CUDA).

> is CMake open to accept patch that will make CUDA support via
> > new compiler definition?
> Yes!  Does CUDA distinguish between C and C++?  Should there be
> separate "CUDAC" and "CUDACXX" languages?
No.  All CUDA code is C++ code as of 3-4 years ago.  I wouldn't attempt to
add support for really old versions of CUDA anyway.

> Does Visual Studio or Xcode have any builtin CUDA support, perhaps
> via a plugin?  This will affect how the corresponding generators
> need to handle the language.  Without native support then they
> will have to generate custom commands to build the languages.

There are CUDA plugins (build rules for VS+MSbuild).  These get updated for
every version of CUDA. I'm not sure how the different versions live side by
side, since I don't use them.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150116/f6d833f4/attachment.html>

More information about the cmake-developers mailing list