Commit Graph

149 Commits

Author SHA1 Message Date
Robert Maynard
c88d5cdd06 CUDAToolkit: Add CUDA 12.9 nvtx3 updates
Starting in CUDA 12.9 the `nvToolsExt` library is no longer provided.
C and C++ projects should switch over to `nvtx3`.

Projects that previously used `nvToolsExt` with Fortran, can now use the
new `CUDA::nvtx3_interop` target for the same functionality with the new
NVTX v3 API.
2025-06-17 09:55:21 -04:00
Brad King
b01c1df41b Merge topic 'cuda-nvcc-system-includes'
d2be863b5e CUDA: Add include paths from nvcc SYSTEM_INCLUDES entry

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10857
2025-06-06 08:12:49 -04:00
Robert Maynard
d2be863b5e CUDA: Add include paths from nvcc SYSTEM_INCLUDES entry
Upcoming versions of nvcc are adding support for `SYSTEM_INCLUDES`
which contain includes that are implicitly used with `-isystem`
instead of `-I`.

Support of this is needed in CMake as some CUDA Toolkit releases will
start to have a different include directory layout and using only the
output from `INCLUDES` will be insufficient to find all headers.
2025-06-05 10:53:12 -04:00
Brad King
d8e9b1bbdf FindCUDAToolkit: Simplify internal documentation links 2025-06-04 19:40:04 -04:00
Brad King
db9b79fb9b FindCUDAToolkit: Update documentation URLs 2025-06-04 19:40:00 -04:00
Brad King
1049b0d9a5 FindCUDAToolkit: Fix documentation link to cuRAND section 2025-06-04 11:37:19 -04:00
Brad King
4f2482700b FindCUDAToolkit: Fix cross-compiling without CMAKE_SYSTEM_PROCESSOR
Previously we relied on the cross-compiling toolchain file to set
`CMAKE_SYSTEM_PROCESSOR` to a value consistent with the CUDA compiler's
target architecture.  When a compiled language is enabled, we now have
its target architecture in `CMAKE_<LANG>_COMPILER_ARCHITECTURE_ID`.
Use that to select the CUDA toolkit's corresponding target directory.

If no language is enabled, or the compiler's target architecture is not
known, fall back to `CMAKE_SYSTEM_PROCESSOR`.  If that is not set, fail
with an explicit error make clear what is wrong.
2025-03-27 10:21:57 -04:00
Brad King
48460d22aa Merge topic 'FindCUDAToolkit-cupti'
cbb8f30ee6 CUDAToolkit: Restore ability to find cupti library

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robertjmaynard@gmail.com>
Merge-request: !10533
2025-03-27 09:10:32 -04:00
Brad King
d5d7175d9c Merge topic 'FindCUDAToolkit-cupti' into release-3.31
cbb8f30ee6 CUDAToolkit: Restore ability to find cupti library

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10533
2025-03-27 09:09:47 -04:00
Marcus D. Hanwell
cbb8f30ee6 CUDAToolkit: Restore ability to find cupti library
In commit f69b9b7305 (CUDAToolkit: Restore ability to find cupti
headers, 2023-12-08, v3.28.1~8^2) we did not update the CUPTI library
searches to add the extra search path needed for certain install layouts
(only the header search path). Add the additional library search paths.

Fixes: #26770
Issue: #25484
2025-03-26 14:03:34 -04:00
Brad King
40eeca77c3 CUDA/Clang: Sync target directory table with FindCUDAToolkit
Since commit 6636693134 (FindCUDAToolkit: Re-unify with
Internal/CUDAToolkit, 2020-06-11, v3.18.0-rc2~6^2~7) the table is
duplicated.

Update the CUDA target directory table for Clang to account for changes
to the equivalent table in FindCUDAToolkit:

* commit bcdd486bf7 (CUDA: Enable support on QNX, 2020-10-30,
                     v3.19.0-rc3~8^2~1)
* commit 743d4181b4 (FindCUDAToolkit: Support cross-compilation to
                     sbsa-linux, 2023-01-11, v3.26.0-rc1~118^2)
2025-03-04 13:51:29 -05:00
Brad King
05efcdd464 FindCUDA: Sync target directory table with FindCUDAToolkit
The table has been duplicated since commit 69fcad9332 (CUDAToolkit: Add
support for cross-compiling, 2020-01-21, v3.17.0-rc1~104^2~1).
2025-03-04 13:51:29 -05:00
Kitware Robot
1772622772 LICENSE: Replace references to Copyright.txt with LICENSE.rst
```
git grep -lz 'Copyright.txt or https://cmake.org/licensing ' |
  while IFS= read -r -d $'\0' f ; do
    sed -i '/Copyright.txt or https:\/\/cmake.org\/licensing / {
              s/Copyright.txt/LICENSE.rst/
            }' "$f" ; done
```
2025-03-03 10:43:35 -05:00
Connor Baker
c5d81a2468 FindCUDAToolkit: Fix precondition for dependency on Threads
`FindThreads` requires that C or CXX be enabled.  Previously we were
only checking that `CMAKE_{C,CXX}_COMPILER` have been set, which does
not mean the languages have been enabled.
2025-02-16 11:21:18 -05:00
Nikita Nemkin
d138555959 Help: Use Title Case for all "Imported Targets" sections 2025-01-31 12:23:29 -05:00
Brad King
7afa58b15d Modules/Find*: Include FindPackageHandleStandardArgs normally
Since commit d74210a8bd (CMP0017: Remove support for OLD behavior,
2024-11-17) we can rely on CMP0017's NEW behavior unconditionally.
Calling `include(FindPackageHandleStandardArgs)` in a builtin module
will always get the builtin `FindPackageHandleStandardArgs`.
2025-01-30 08:53:12 -05:00
Alex Turbov
bc8621d999 Fix: A lot of typos in code found by typos
Yet another great code spellchecker: https://github.com/crate-ci/typos/

(Will be added later as a `pre-commit` hook)
2025-01-12 18:49:34 +04:00
Seth R Johnson
fb0b3d1585 FindCUDAToolkit: Remove debug message
This was left accidentally by commit 587c0443cc (FindCUDAToolkit:
Support CUDA version extraction from version.json, 2023-05-02,
v3.26.4~3^2).
2024-10-25 08:32:00 -04:00
Robert Maynard
9d29544082 FindCUDAToolkit: nvrtc shouldn't hard depend on nvJitLink
The dependency on nvJitLink was due to misunderstanding how runtime compiled code that uses
LTO is used. It doesn't require nvrtc to have a dependency on nvJitLink, just the caller.
2024-10-14 10:16:29 -04:00
Robert Maynard
7671a2f4c1 CUDAToolkit: nvrtc shouldn't hard depend on nvrtc-builtins
Depending on nvrtc-builtins breaks CUDA enhanced compatibility across
minor versions. The static version of nvrtc continues to need the
dependency due to undefined symbols
2024-10-09 11:58:04 -04:00
Brad King
fb303f6086 Merge topic 'FindCUDAToolkit-clear-failure'
8f974011ea FindCUDAToolkit: Allow new search locations after failure

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9650
2024-07-19 10:04:17 -04:00
Brad King
078eb8d79d Merge topic 'FindCUDAToolkit-windows-only'
973b019363 FindCUDAToolkit: Refactor search windows only search directories

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9648
2024-07-18 09:01:16 -04:00
Robert Maynard
973b019363 FindCUDAToolkit: Refactor search windows only search directories
Will allow us to better support layout changes going forward
2024-07-17 10:47:34 -04:00
Kyle Edwards
b3f02006f0 FindCUDAToolkit: Add ability to find static version of nvml
Fixes: #26131
2024-07-15 10:35:36 -04:00
Robert Maynard
8f974011ea FindCUDAToolkit: Allow new search locations after failure
Fixes #22010
2024-07-10 09:44:57 -04:00
Robert Maynard
eed16fbc00 FindCUDAToolkit: Use CUDA compiler path even when CUDA lang not enabled
Fixes: #25567
2024-05-29 14:39:29 -04:00
Brad King
5ec306fb13 FindCUDAToolkit: Replace a documentation link with its permanent redirect 2024-04-23 08:02:54 -04:00
Brad King
480cf4a714 FindCUDAToolkit: Replace documentation links with their permanent redirects 2024-04-02 08:43:12 -04:00
Robert Maynard
d47c5e3358 FindCUDAToolkit: Remove unneeded dependencies on the cuda driver
The nvrtc-builtins and nvptxcompiler projects don't required linking
to the cuda driver. We previously did this due to reading the
upstream documentation incorrectly.
2024-03-11 15:51:11 -04:00
Robert Maynard
d420ee6b43 FindCUDAToolkit: Add support for nvfatbin added in 12.4 2024-03-05 16:43:09 -05:00
Robert Maynard
17d758b36d FindCUDAToolkit: Fix cuda driver dependencies
Fixes: #25665
2024-02-12 13:29:41 -05:00
Brad King
070810b324 Merge topic 'FindCUDAToolkit-cudart-deps' into release-3.29
4a3cafec4f FindCUDAToolkit: Fix cudart dependencies

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9236
2024-02-09 09:00:03 -05:00
Robert Maynard
4a3cafec4f FindCUDAToolkit: Fix cudart dependencies
Fixes: #25665
2024-02-08 12:57:13 -05:00
Brad King
dd4a6dff92 Link explicitly to private transitive dependencies on stub libraries
We represent stub libraries, e.g., for CUDA, using imported `SHARED`
library targets with only `IMPORTED_IMPLIB`, and no `IMPORTED_LOCATION`,
to indicate that the stub file is meant only for linkers and not dynamic
loaders.  See commit 7351d590ee (cmTarget: Add a way to represent
imported shared library stubs, 2023-07-17, v3.28.0-rc1~344^2) and commit
fc6508921c (cmComputeLinkInformation: Restore soname lookup for
non-imported targets, 2023-12-05, v3.28.0~4^2).

If a shared library is linked to a stub, it has a `NEEDED` field
populated with the `SONAME` found in the stub.  When a dependent target
links to such a shared library, some linkers want to find a library file
on disk and load it to see what symbols it provides.  This is necessary
for linkers that enforce `--no-allow-shlib-undefined`.  On hosts with
only the stub library installed, e.g., with only the CUDA toolkit
development package, the real runtime library corresponding to the
stub's `SONAME` may not even exist, so no `-rpath-link` flag can help
linkers find it.  Pass the stub library to linkers explicitly so they
can find it without searching.
2024-01-04 11:59:26 -05:00
Robert Maynard
09a3c8b46b CUDAToolkit: Correctly search all include paths from compiler
The CUDAToolkit usage of `find_path( PATHS )` was incorrectly
quoting a list of paths causing none of them to be used.
2023-12-14 14:04:53 -05:00
Brad King
7cbf1f7a58 Merge topic 'bug/fix_cupti_regression' into release-3.28
f69b9b7305 CUDAToolkit: Restore ability to find cupti headers

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Misha Chornyi <mchornyi@nvidia.com>
Merge-request: !9054
2023-12-12 08:36:26 -05:00
Robert Maynard
f69b9b7305 CUDAToolkit: Restore ability to find cupti headers
Fixes #25484

PR !8835 failed to update the CUPTI header searches to use the
new internal FindCUDAToolkit search variables. This caused the
CUDA::cupti target to always not exist.
2023-12-08 11:46:54 -05:00
Brad King
d85bf99bcb FindCUDAToolkit: Fix stub library representation on reconfigure
Since commit 0744c02e24 (FindCUDAToolkit: targets pointing to stubs now
use IMPORTED_IMPLIB, 2023-07-24, v3.28.0-rc1~309^2) we recognize CUDA
stub libraries and represent them in a special way.  However, the logic
only works on the first configuration of a build tree when the libraries
are first found.  Once the results are cached, we incorrectly revert to
the non-stub representation.

Fix this by recognizing stub libraries based on their path instead.
2023-12-06 16:10:24 -05:00
Robert Maynard
b38a8e77cb FindCUDAToolkit: Search for cufile library name being lowercase
Fixes #25398
2023-11-08 10:43:30 -05:00
Robert Maynard
0b6ae9c467 FindCUDAToolkit: Restore CUDAToolkit_LIBRARY_SEARCH_DIRS variable
This was accidentally dropped by commit 4316d4dcfd (FindCUDAToolkit:
Search all of `nvcc` implicit includes and library dirs, 2023-09-26).
2023-10-04 12:10:02 -04:00
Robert Maynard
4316d4dcfd FindCUDAToolkit: Search all of nvcc implicit includes and library dirs
Improves the handling of CUDA layouts where we have multiple include
and library directories listed in the output of `nvcc -v`. This
updates both when the CUDA language is enabled or not.

Fixes: #24915
2023-09-27 13:28:52 -04:00
Robert Maynard
0744c02e24 FindCUDAToolkit: targets pointing to stubs now use IMPORTED_IMPLIB
This ensures that we don't add rpath entries to the stubs directory
which would cause runtime loading of the wrong libraries.
2023-07-24 14:56:28 -04:00
Brad King
6194193a8a Merge topic 'file-REAL_PATH-relative'
6b5f2dbbfe file(REAL_PATH): resolve symlinks before '..' components

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8605
2023-07-24 08:43:19 -04:00
Brad King
32174571e9 Merge topic 'FindCUDAToolkit-libnvrtc-builtins'
c2601d01d1 FindCUDAToolkit: Fix nvrtc_builtins library name

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robertjmaynard@gmail.com>
Merge-request: !8642
2023-07-21 09:35:10 -04:00
Robert Maynard
6b5f2dbbfe file(REAL_PATH): resolve symlinks before '..' components
Previously REAL_PATH would collapse paths before resolving any symlinks
so if `..` crossed a symlink the output from `REAL_PATH` would be wrong.

It looked like REAL_PATH did this by mistake since it was a side-effect
of ensuring we had an absolute path before resolving symlinks.
2023-07-20 17:02:58 -04:00
Tomoharu Kitawaki
c2601d01d1 FindCUDAToolkit: Fix nvrtc_builtins library name
The lib is named `libnvrtc-builtins.so`, not `libnvrtc_builtins.so`.

Update the change from commit 2a94c762ed (FindCUDAToolkit: Add support
for CUDA::nvrtc_static, 2023-01-20, v3.26.0-rc1~55^2).  Apply a fix
similar to commit 9688a8ebc2 (FindCUDAToolkit: Fix
`nvrtc_builtins_static` library name, 2023-02-03, v3.26.0-rc2~15^2).
2023-07-20 11:34:47 -04:00
Robert Maynard
f9579ffaa6 FindCUDAToolkit: Add cupti nvperf and pcsampling targets 2023-06-07 13:58:09 -04:00
Brad King
76940fecde Merge topic 'FindCUDAToolkit_more_library_root_detection'
587c0443cc FindCUDAToolkit: Support CUDA version extraction from version.json

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8451
2023-05-05 12:34:54 -04:00
Robert Maynard
587c0443cc FindCUDAToolkit: Support CUDA version extraction from version.json
Fixes: #24858
2023-05-04 12:26:04 -04:00
Brad King
3df699544b Merge topic 'update_FindCUDAToolkit_nvrtc_notes'
0e0eb12918 FindCUDAToolkit: Update nvrtc section to clarify a static version exists

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8436
2023-04-28 10:09:40 -04:00