summaryrefslogtreecommitdiff
path: root/Modules/FindCUDAToolkit.cmake
Commit message (Collapse)AuthorAgeFilesLines
* CUDAToolkit: Add include paths for CUDA::cuptiPeter Bell2022-04-261-7/+20
| | | | | | | | CUDA's cupti library has its headers in a seperate directory on a standard CUDA install, but `CUDA::cupti` only adds the default cuda include directory. Issue: #22761
* FindCUDAToolkit: Add missing cufftw_static targetRobert Maynard2022-03-211-1/+1
| | | | Fixes #23347
* CUDA: Generic all and all-major supportRaul Tambre2022-02-011-36/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 14d8a276 (CUDA: Support nvcc 11.5 new -arch=all|all-major flags, 2021-08-17) added all and all-major options to CUDA_ARCHITECTURES. These are fairly generic and likely to see real-world use by distributors. Thus it's desirable to support these also for Clang and older NVCC versions. The supported architectures are dependent on the toolkit version. We determine the toolkit version prior to compiler detection. For NVCC we get the version from the vendor identification output, but for Clang we need to invoke NVCC separately. The architecture information is mostly based on the Wikipedia list with the earliest supported version being CUDA 7.0. This could be documented and expanded in the future to allow projects to query CUDA toolkit version and architecture information. For Clang we additionally constrain based on its support. Additionally the architecture mismatch detection logic is fixed, improved and updated for generic support: * Commit 01428c55 (CUDA: Fail fast if CMAKE_CUDA_ARCHITECTURES doesn't work during detection, 2020-08-29) enabled CMAKE_CUDA_COMPILER_ID_REQUIRE_SUCCESS if CMAKE_CUDA_ARCHITECTURES is specified. This results in CMakeDetermineCompilerID.cmake printing the compiler error and our code for presenting the mismatch in a user-friendly way being useless. The custom logic seems preferable so go back to not enabling it. * Commit 14d8a276 (CUDA: Support nvcc 11.5 new -arch=all|all-major flags, 2021-08-17) tried to support CMP0054 but forgot to add x to the interpolated result. Thus the conditions would always evaluate to false. This is fixed as a byproduct of removing NVIDIA specific checks, improving the error message and replacing architectures_mode with a simpler architectures_explicit. Visual Studio support omits testing the flags during detection due to complexities in determining the toolkit version when using it. A long-term proper implementation would be #23161. Implements #22860.
* FindCUDAToolkit: Remove duplicated targets in docsGuo2022-01-241-3/+1
| | | | Also remove an unfinished sentence.
* Merge topic 'cudatoolkit_find_cufft_static_nocallback'Brad King2022-01-131-0/+4
|\ | | | | | | | | | | | | | | a4126d1c01 CUDAToolkit: Add CUDA::cufft_static_nocallback target Acked-by: Kitware Robot <kwrobot@kitware.com> Reviewed-by: Raul Tambre <raul@tambre.ee> Merge-request: !6856
| * CUDAToolkit: Add CUDA::cufft_static_nocallback targetRobert Maynard2022-01-121-0/+4
| | | | | | | | Fixes: #23098
* | FindCUDAToolkit: depend cublas on cublasLt for CUDA 11.0+Robert Maynard2022-01-121-0/+7
|/
* FindCUDAToolkit: Correct cusparse dependencies for 10.1, 11.2.2Robert Maynard2021-11-191-0/+17
|
* FindCUDAToolkit: Fix missing sibling include directory for math librariesSteven Hahn2021-10-051-0/+19
| | | | Fixes: #22706
* FindCUDAToolkit: Understand NVHPC versioned math library layoutRobert Maynard2021-07-281-0/+3
| | | | | | | | | | | The NVHPC packages bundle the CUDA math libraries in a sibling directory (`math_libs`) instead of in with the rest of the cuda libraries. Depending on the NVHPC package the math_libs folder can have versioned subdirectories, therefore we prefer finding the same versions as the CUDA Toolkit and falling back to the latest when not possible.
* Merge topic 'FindCUDAToolkit-doc-version'Brad King2021-07-081-3/+8
|\ | | | | | | | | | | | | 266fc8ada5 FindCUDAToolkit: Properly document the version support Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6320
| * FindCUDAToolkit: Properly document the version supportRobert Maynard2021-07-071-3/+8
| |
* | Merge topic 'correct_cuda_toolkit_version_typo'Brad King2021-07-071-1/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | 0d54276c82 Correct CUDAToolkit_VERSION_MINOR variable name typo Acked-by: Kitware Robot <kwrobot@kitware.com> Reviewed-by: Raul Tambre <raul@tambre.ee> Merge-request: !6311
| * | Correct CUDAToolkit_VERSION_MINOR variable name typoRobert Maynard2021-07-061-1/+1
| |/
* | FindCUDATookit: Fix ordering of libraries in imported targetsDan Ibanez2021-07-011-2/+2
|/ | | | | | | | | | Before this a downstream code linking to `CUDA::cusparse_static` and `CUDA::curand_static` would get a link line with `libcusparse_static.a`, then `libculibos.a`, then `libcurand_static.a`. Use `IMPORTED_LOCATION` to tell CMake about the proper dependency ordering where `libculibos.a` comes last, because the other two libraries depend on `libculibos.a`. Fixes: #22365
* CUDA: improve regex for CUDA Toolkit root from nvcc verbose outputRobert Maynard2021-05-061-1/+1
| | | | | | | | | | | | The original regular expression was greedy and would match any environment variable ending with `TOP` (like `DESKTOP`). This is an issue on windows where `nvcc -v` would output all environment variables before the compiler's verbose output. To resolve this issue we use a tighter match algorithm that looks for `#$ TOP=` instead of `TOP=`. Fixes: #22158
* CUDA: Capture all nvcc output when extracting toolkit rootBrad King2021-02-121-3/+4
| | | | | | | | | Since commit fb2afef620 (CUDA: Support nvcc symlinking to ccache, 2021-01-07) and commit 3cef91a321 (CUDA: Always extract CUDA Toolkit root from nvcc verbose output, 2021-02-03) we always run the command `nvcc -v __cmake_determine_cuda` to look for the toolkit root in its stderr. On Windows, that command may print to stdout instead, so capture that as well.
* Merge topic 'findcudatoolkit_handle_cuda_compiler_without_enabled_lang'Brad King2021-02-101-0/+1
|\ | | | | | | | | | | | | | | | | cd89d1c328 FindCUDAToolkit: Robust version checks when CUDA lang is not enabled Acked-by: Kitware Robot <kwrobot@kitware.com> Reviewed-by: Raul Tambre <raul@tambre.ee> Tested-by: Raul Tambre <raul@tambre.ee> Merge-request: !5787
| * FindCUDAToolkit: Robust version checks when CUDA lang is not enabledRobert Maynard2021-02-091-0/+1
| | | | | | | | | | | | Previously if you set `CMAKE_CUDA_COMPILER` but hadn't enabled the CUDA language, FindCUDAToolkit would not correctly compute the version information.
* | CUDA: Always extract CUDA Toolkit root from nvcc verbose outputRobert Maynard2021-02-081-13/+12
|/ | | | | | | | | | | | Fixes #21750, #21763 Given that NVCC can be provided by multiple different sources (NVIDIA HPC SDK, CUDA Toolkit, distro) each of which has a different layout, we need to extract the CUDA toolkit root from the compiler itself, allowing us to support numerious different scattered toolkit layouts. The NVIDIA HPC SDK specifically ships two copies of nvcc one in `compilers/bin/` and one in `cuda/bin`. Thus when using `compilers/bin/nvcc` the Toolkit root logic fails.
* Merge topic 'findcudatoolkit_env_path'Brad King2021-02-031-1/+1
|\ | | | | | | | | | | | | | | 4ea6d3c3ae FindCUDAToolkit: Restore use of CUDA_PATH environment variable Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Raul Tambre <raul@tambre.ee> Merge-request: !5761
| * FindCUDAToolkit: Restore use of CUDA_PATH environment variableRobert Maynard2021-02-031-1/+1
| | | | | | | | | | | | | | | | Refactoring in commit 7cc815a2a6 (CUDAToolkit: Detect CUDA SDK that don't have nvcc, 2020-07-24, v3.19.0-rc1~366^2) accidentally broke use of the `CUDA_PATH` environment variable. Fixes: #21740
* | CUDA: Support nvcc symlinking to ccacheRong Ou2021-01-111-1/+13
| | | | | | | | | | | | | | Invoke `nvcc -v` to find the real CUDA bin directory. This is needed if `nvcc` is a symlink to `ccache` or `colornvcc`. Fixes: #21177
* | Help: Add `.. versionadded` directives to module docsNikita Nemkin2020-12-021-0/+5
|/ | | | Issue: #19715
* CUDA: Enable support on QNXjanbernloehr2020-11-021-1/+3
| | | | | | | | | | | This fixes the following two issues with the CUDA support on QNX: * cuda target name is not derived correctly (should be `aarch64-qnx`). * linking `cudart` must not be linked against `rt`, `dl`, `pthread`. This enables to use cmake's native cuda support on QNX. Fixes: #21381
* FindCUDAToolkit: Support scattered installations when crosscompilingRaul Tambre2020-09-201-4/+5
| | | | | | | | | | Previously when CMAKE_CROSSCOMPILING was ON we'd end up not setting the target directory if the non-scattered one didn't exist. Fix this by assuming a scattered installation if the target directory isn't set after the crosscompiling logic. This is the same fix as commit 2c0d5d01ee (CUDA: Support scattered installations when crosscompiling with Clang, 2020-09-14).
* CUDAToolkit: Detect CUDA SDK that don't have nvccRobert Maynard2020-07-301-54/+99
| | | | | | | | When a CUDA sdk doesn't have nvcc, defer to the existence of a version.txt file. When we do this fall back we also reconstruct the CUDA version via version.txt Fixes #20643
* Fix typos identified using codespellJean-Christophe Fillion-Robin2020-07-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See https://github.com/codespell-project/codespell#readme The following command was used: ``` codespell -q6 --skip="\ .git,\ *.json,\ ./Copyright.txt,\ ./Help/command/foreach.rst,\ ./Help/prop_test/REQUIRED_FILES.rst,\ ./Help/variable/CTEST_COVERAGE_COMMAND.rst,\ ./Modules/CMakeCheckCompilerFlagCommonPatterns.cmake,\ ./Modules/CMakeRCInformation.cmake,\ ./Modules/Internal/CPack/NSIS.template.in,\ ./Modules/FindMatlab.cmake,\ ./Modules/MatlabTestsRedirect.cmake,\ ./Modules/Platform/Windows-Clang.cmake,\ ./Modules/Platform/Windows-Intel-Fortran.cmake,\ ./Modules/Platform/Windows-MSVC.cmake,\ ./Source/CMakeVersion.cmake,\ ./Source/cmConvertMSBuildXMLToJSON.py,\ ./Source/cmCreateTestSourceList.cxx,\ ./Source/cmGlobalVisualStudio10Generator.cxx,\ ./Source/cmExportBuildFileGenerator.cxx,\ ./Source/cmExportInstallAndroidMKGenerator.cxx,\ ./Source/cmExportInstallFileGenerator.cxx,\ ./Source/cmExportSet.cxx,\ ./Source/cmExportTryCompileFileGenerator.cxx,\ ./Source/cmFindPackageCommand.cxx,\ ./Source/cmInstallCommand.cxx,\ ./Source/cmGeneratorExpressionLexer.cxx,\ ./Source/cmLocalVisualStudio7Generator.cxx,\ ./Source/cmOrderDirectories.cxx,\ ./Source/cmTarget.cxx,\ ./Source/kwsys/*,\ ./Source/QtDialog/CMakeSetupDialog.ui,\ ./Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx,\ ./Source/CTest/cmParseCoberturaCoverage.h,\ ./Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in,\ ./Tests/RunCMake/CPack/tests/DMG_SLA/English.license.rtf,\ ./Tests/RunCMake/CPack/tests/DMG_SLA/German.license.txt,\ ./Tests/RunCMake/CPack/tests/DMG_SLA/German.menu.txt,\ ./Tests/RunCMake/GoogleTest/xml_output.cpp,\ ./Tests/RunCMake/Make/TargetMessages*,\ ./Utilities/*,\ " \ -L "\ dependees,\ endwhile,\ fo,\ filetest,\ helpfull,\ nd,\ objext,\ stoll,\ supercedes,\ superceded,\ vas,\ varn,\ " ```
* Help: Add Sphinx 'versionadded' directives to each top-level documentKitware Robot2020-07-061-0/+2
| | | | | | | Run the `Utilities/Sphinx/update_versions.py` script to add initial markup to every top-level document and find module. Issue: #19715
* CudaToolkit: Update for new/removed libraries in CUDA 11Robert Maynard2020-06-181-1/+5
|
* CUDA: Determine CUDA toolkit location for NVCCRaul Tambre2020-06-121-1/+1
| | | | | Similar to how we already do for Clang. Avoids a lot of redundant work in FindCUDAToolkit.
* CUDA: Pass toolkit path to ClangRaul Tambre2020-06-121-115/+126
| | | | | | | | | | | | | | | | | | | | | | | | | Clang isn't very good at finding the installed CUDA toolkit. The upstream recommendation is that we should pass the toolkit explicitly. Additionally: * Avoids Clang having to search for the toolkit on every invocation. * Allows the user to use a toolkit from a non-standard location by simply setting CUDAToolkit_ROOT. The same way as with FindCUDAToolkit. Clang wants the directory containing the device library and version.txt as the toolkit path. We thus pass the newly introduced CUDAToolkit_LIBRARY_ROOT as the toolkit path. We save CUDAToolkit_ROOT_DIR and CUDAToolkit_LIBRARY_ROOT on Clang to have them available in try_compile() and avoid unnecessary re-searching or a possibly different installation being found in FindCUDAToolkit. This however means that the selected toolkit can't be changed after the initial language enablement. We now determine CUDA compiler ID before doing actual detection, as we don't want to spend time finding the CUDA toolkit for NVIDIA. Implements #20754.
* FindCUDAToolkit: Avoid unnecessary temporary variable computing binary dirRaul Tambre2020-06-121-6/+4
|
* FindCUDAToolkit: Remove unnecessary checks around searchesRaul Tambre2020-06-121-15/+11
| | | | | find_*() don't search if the result variable is already set. Remove the if()s around such cases.
* FindCUDAToolkit: Use list(SORT) to sort in natural orderRaul Tambre2020-06-121-36/+4
| | | | | We had a custom loop to sort in the natural order. Since CMake 3.18 this is supported natively by CMake and simplifies the code significantly.
* FindCUDAToolkit: Compute CUDAToolkit_INCLUDE_DIR instead of searchingRaul Tambre2020-06-121-4/+7
| | | | | | | We can avoid searching for this since CUDAToolkit_TARGET_DIR always contains the include/ directory. But add a warning just in case. Also apply this in CMakeDetermineCUDACompiler for Clang code.
* FindCUDAToolkit: Add CUDAToolkit_LIBRARY_ROOTRaul Tambre2020-06-121-0/+15
| | | | | | | | | On scattered installations version.txt and nvvm are located at this location. This may be useful to users and will allow us in the future to parse version.txt instead of invoking nvcc to figure out the CUDA toolkit version. We also add it to CMakeDetermineCUDACompiler in preparation for future use by Clang code.
* FindCUDAToolkit: Re-unify with Internal/CUDAToolkitRaul Tambre2020-06-121-3/+211
| | | | | | | | | | | | | | | | A portion of FindCUDAToolkit was previously split in commit dc2eae1f (FindCUDAToolkit: Factor out discovery code into a separate file, 2020-04-22) out into Internal/CUDAToolkit to allow re-use of the code in CMakeDetermineCUDACompiler for Clang support. This has turned out to be a bad solution due to Clang requiring quite a bit of special handling and special handling for NVCC leaking out from Internal/CUDAToolkit into the Clang code using it. Thus it seems better to re-unify this code and duplicate the parts of the code necessary for Clang where it's required. This will help us get logic correct for both NVCC and CUDA handling. We can still unify the common parts in the future once the code has matured.
* FindCUDAToolkit: Fix cudart not found status messageRaul Tambre2020-06-081-4/+4
| | | | | | This ended up after the searching after commit dc2eae1 (FindCUDAToolkit: Factor out discovery code into a separate file, 2020-04-22). Move it back to where it was and should be.
* FindCUDAToolkit: Factor out discovery code into a separate fileRaul Tambre2020-05-151-218/+8
| | | | | | This allows for re-use in other parts of the code, that require the CUDA toolkit location, but can't or may not want to use the full `FindCUDAToolkit`.
* Merge topic 'FindCUDAToolkit-search-stubs'Brad King2020-04-151-2/+20
|\ | | | | | | | | | | | | 4f1e24efa0 FindCUDAToolkit searches stub location last Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4589
| * FindCUDAToolkit searches stub location lastRobert Maynard2020-04-141-2/+20
| | | | | | | | Fixes #20252
* | CUDAToolkit: Deduce toolkit binary directory from compiler path only for NVCCRaul Tambre2020-04-071-2/+2
|/ | | | | This assumption doesn't hold for Clang. When crosscompiling this causes X86 libraries to be used and thus linker errors.
* CUDAToolkit: Mark find queries as advanced variablesRobert Maynard2020-03-101-1/+8
| | | | Fixes #20435
* CUDAToolkit: Add support for cupti libraryRobert Maynard2020-02-061-1/+23
| | | | Fixes: #20318
* CUDAToolkit: Correct location of OpenCL doc linkRobert Maynard2020-02-061-2/+2
|
* CUDAToolkit: Add required static runtime library dependenciesRobert Maynard2020-01-301-0/+25
| | | | | CUDAToolkit now adds the correct libraries that are required by the static runtime.
* FindCUDAToolkit: Fix behavior on multiple callsRodolfo Lima2020-01-281-41/+22
| | | | | | | | | Update `_CUDAToolkit_find_and_add_import_lib` to create and add dependencies to a target in one step that shared a single guard against repeated definitions. Otherwise we were adding dependencies again on every call. Fixes: #20282
* FindCUDAToolkit: Fix CUDA::* target guard logicRodolfo Lima2020-01-281-4/+6
| | | | Issue: #20282
* CUDAToolkit: Use CMAKE_FIND_ROOT_PATH for all sdk lib searchesRobert Maynard2020-01-271-6/+18
|