New in version 3.17.
This script locates the NVIDIA CUDA toolkit and the associated libraries, but does not require the
CUDA language be enabled for a given project. This module does not search for the NVIDIA CUDA Samples.
The CUDA Toolkit search behavior uses the following order:
CUDAlanguage has been enabled we will use the directory containing the compiler as the first search location for
CUDAToolkit_ROOT cmake configuration variable (e.g.,
-DCUDAToolkit_ROOT=/some/path) or environment variable is defined, it will be searched. If both an environment variable and a configuration variable are specified, the configuration variable takes precedence.
The directory specified here must be such that the executable
nvcc or the appropriate
version.txt file can be found underneath the specified directory.
find_program(). If this is found, no subsequent search attempts are performed. Users are responsible for ensuring that the first
nvccto show up in the path is the desired path in the event that multiple CUDA Toolkits are installed.
/usr/local/cudaexists, this is used. No subsequent search attempts are performed. No default symbolic link location exists for the Windows platform.
The platform specific default install locations are searched. If exactly one candidate is found, this is used. The default CUDA Toolkit install locations searched are:
X.Y would be a specific version of the CUDA Toolkit, such as
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0
When multiple CUDA Toolkits are installed in the default location of a system (e.g., both
/usr/local/cuda-10.0 exist but the
/usr/local/cuda symbolic link does not exist), this package is marked as not found.
There are too many factors involved in making an automatic decision in the presence of multiple CUDA Toolkits being installed. In this situation, users are encouraged to either (1) set
CUDAToolkit_ROOT or (2) ensure that the correct
nvcc executable shows up in
find_program() to find.
If specified, describes the version of the CUDA Toolkit to search for.
If specified, configuration will error if a suitable CUDA Toolkit is not found.
If specified, the search for a suitable CUDA Toolkit will not produce any messages.
If specified, the CUDA Toolkit is considered found only if the exact
VERSION specified is recovered.
An imported target named
CUDA::toolkit is provided.
This module defines
IMPORTED targets for each of the following libraries that are part of the CUDAToolkit:
The CUDA Runtime library (cudart) are what most applications will typically need to link against to make any calls such as
The CUDA Driver library (cuda) are used by applications that use calls such as
cuMemFree. This is generally used by advanced
The cuBLAS library.
CUDA::cublasLtstarting in CUDA 10.1
CUDA::cublasLt_staticstarting in CUDA 10.1
The cuFFT library.
The cuRAND library.
The cuSOLVER library.
The cuSPARSE library.
The NPP libraries.
nppial: Arithmetic and logical operation functions in
nppicc: Color conversion and sampling functions in
nppicom: JPEG compression and decompression functions in
nppi_compression_functions.h Removed starting in CUDA 11.0, use nvJPEG instead.
nppidei: Data exchange and initialization functions in
nppif: Filtering and computer vision functions in
nppig: Geometry transformation functions found in
nppim: Morphological operation functions found in
nppist: Statistics and linear transform in
nppisu: Memory support functions in
nppitc: Threshold and compare operation functions in
The nvBLAS libraries. This is a shared library only.
The nvGRAPH library. Removed starting in CUDA 11.0
The nvJPEG library. Introduced in CUDA 10.
The nvRTC (Runtime Compilation) library. This is a shared library only.
The NVIDIA Management Library. This is a shared library only.
The NVIDIA Tools Extension. This is a shared library only.
The NVIDIA OpenCL Library. This is a shared library only.
The cuLIBOS library is a backend thread abstraction layer library which is static only. The
CUDA::curand_static, and (when implemented) NPP libraries all automatically have this dependency linked.
Note: direct usage of this target by consumers should not be necessary.
A boolean specifying whether or not the CUDA Toolkit was found.
The exact version of the CUDA Toolkit found (as reported by
nvcc --version or
The major version of the CUDA Toolkit.
The minor version of the CUDA Toolkit.
The patch version of the CUDA Toolkit.
The path to the CUDA Toolkit library directory that contains the CUDA executable
The path to the CUDA Toolkit
include folder containing the header files required to compile a project linking against CUDA.
The path to the CUDA Toolkit library directory that contains the CUDA Runtime library
The path to the CUDA Toolkit directory containing the nvvm directory and version.txt.
The path to the CUDA Toolkit directory including the target architecture when cross-compiling. When not cross-compiling this will be equivalent to the parent directory of
The path to the NVIDIA CUDA compiler
nvcc. Note that this path may not be the same as
nvcc must be found to determine the CUDA Toolkit version as well as determining other features of the Toolkit. This variable is set for the convenience of modules that depend on this one.
© 2000–2020 Kitware, Inc. and Contributors
Licensed under the BSD 3-clause License.