[CMake] [New Module] FindCUDA

James Bigler jamesbigler at gmail.com
Tue Aug 25 14:11:07 EDT 2009


This is code that is up for inclusion into the CMake Modules directory.

FindCUDA does several things.

1. It locates all the build tools found in the NVIDIA CUDA toolkit and SDK.
2. It provides common options used to control CUDA code compilation.
3. It provides macros that setup the build rules to convert CUDA files
into object code or PTX files.
4. It maintains source level dependencies.  If you change a file that
a CUDA file depends on, it will cause the CUDA file to recompile.

Attached is a zip file that contains the 4 files needed for use.  I
needed to use a zip file to get below the 40 KB email size limit that
didn't allow my email through before.

1. FindCUDA.cmake - main file that users call.
2. run_nvcc.cmake - script used to invoke the nvcc compiler and other
helper commands (such as generating the dependency file).  This file
is configured per CUDA file, so that if you change one of the compiler
options it will regenerate this file causing the CUDA file to be
compiled anew.
3. make2cmake - converts the makefile formatted dependency file that
nvcc produces into a form suitable for CMake to include.
4. parse_cubin.cmake - parses a cubin file generated by nvcc and
reports statistics about the file.

Comments are welcome.

A version that also has some sample driver code (as well as the
FindCUDA scripts) can be found here:

svn checkout https://code.sci.utah.edu/svn/findcuda/trunk FindCUDA

Thanks,
James
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FindCUDA.zip
Type: application/zip
Size: 18378 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090825/b1150a78/attachment-0001.zip>


More information about the CMake mailing list