Commit Graph

175 Commits

Author SHA1 Message Date
Raul Tambre
15fda9384a FindCUDA: Improve deprecation guidance wording
Simplified the text regarding adding sources to be more general as there's also
target_sources().

Improved the wording for FindCUDAToolkit to be more explicit of its usecase and
avoid using "superseded" since the common usecase of FindCUDA was superseded by
the language support.

Wording suggestions incopropated from discussion on #22203.
2021-05-22 11:39:19 +03:00
Raul Tambre
e16b06f4b9 FindCUDA: Make the deprecation notice more prominent
FindCUDA is still widely used, but has been superseded by the much more robust
native language support. However the deprecation hasn't been noticed well
enough and real-world experience shows there's still new code written to use
it.

Change this particular notice to a warning to get a hard to miss red box.
We lose the semantic meaning, but we don't want to make all notices like this.
If there are similar cases in the future requiring it would be worth adding a
custom variant of the deprecated directive.

Fixes #22203.
2021-05-22 11:38:52 +03:00
Robert Maynard
5e931c5a97 CUDA: improve regex for CUDA Toolkit root from nvcc verbose output
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
2021-05-06 12:08:24 -04:00
Brad King
9ea66b2d86 CUDA: Capture all nvcc output when extracting toolkit root
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.
2021-02-12 07:23:48 -05:00
Robert Maynard
3cef91a321 CUDA: Always extract CUDA Toolkit root from nvcc verbose output
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.
2021-02-08 12:13:01 -08:00
Rong Ou
fb2afef620 CUDA: Support nvcc symlinking to ccache
Invoke `nvcc -v` to find the real CUDA bin directory.
This is needed if `nvcc` is a symlink to `ccache` or `colornvcc`.

Fixes: #21177
2021-01-11 00:18:04 -08:00
Nikita Nemkin
8fea95319b Help: Add .. versionadded directives to module docs
Issue: #19715
2020-12-02 21:00:30 +05:00
Nikita Nemkin
8634561dca Help: Improve formatting for FindBoost and FindCUDA
* Split large literal blocks into definitions lists.
* Add section headers.
* Add links to standard commands and variables.
* Use inline literals liberally.
* Enable code highlighting in literal blocks.
* Format command signatures according to modern conventions.
2020-12-02 21:00:29 +05:00
janbernloehr
bcdd486bf7 CUDA: Enable support on QNX
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
2020-11-02 09:39:36 -05:00
Robert Maynard
1d9f2f9714 FindCUDA: Do not search for the deprecated nppicom when CUDA >= 11
The nppicom library has been removed in preference of nvjpeg starting
in CUDA 11.

Fixes: #20845
2020-06-22 11:56:51 -04:00
Robert Maynard
b9d67447c3 FindCUDA: Only depend on Threads::Threads on platforms that need it
In commit 46371132b3 (FindCUDA: CUDA_LIBRARIES doesn't contain raw
`-pthread`, 2019-11-11, v3.17.0-rc1~455^2) we introduced use of the
`Threads::Threads` target, but we do not `find_package(Threads)` on all
platforms.  Use the target only if it exists.
2020-02-24 14:14:38 -05:00
Robert Maynard
e2a5d8374f FindCUDAToolkit: Improve usage, library set, and tests
Refined the initial design of FindCUDAToolkit and improve it
by adding more library support, more toolkit information and
tests.
2019-12-16 11:15:12 -05:00
Kyle Edwards
5695b0464b Merge topic 'cmake-e-rm'
2d0100fac7 replace remove and remove_directory with rm in tests
5239fc5c75 cmake -E: Add rm with improved semantics over remove and remove_directory

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3949
2019-11-15 09:57:56 -05:00
Johnny Jazeix
2d0100fac7 replace remove and remove_directory with rm in tests 2019-11-13 18:02:18 -05:00
Robert Maynard
46371132b3 FindCUDA: CUDA_LIBRARIES doesn't contain raw -pthread
If a person tried to pass `CUDA_LIBRARIES` to nvcc compiler it could
fail as it might have `-pthread` which nvcc doesn't support. Instead
we now use the `Threads::Threads` so that nvcc gets the correct
`-Xcompiler -pthread` flag.
2019-11-11 11:52:02 -05:00
Hong Xu
2e9feddf68 FindCUDA: Use find_program instead of find_path when searching for nvcc.
Before this commit, nvcc would not be found if it is in env PATH but a
non-standard location. This commit fixes this issue.
2019-11-04 14:17:20 -08:00
Brad King
f4eebeb447 FindCUDA: Revert "Use find_program instead of find_path to find nvcc"
Revert commit 067ee518f7 (FindCUDA: Use find_program instead of
find_path to find nvcc, 2019-10-31).  It causes `CUDA_TOOLKIT_ROOT_DIR`
to contain the path to nvcc rather than the toolkit directory.
2019-11-04 14:50:04 -05:00
Hong Xu
067ee518f7 FindCUDA: Use find_program instead of find_path to find nvcc
Otherwise nvcc is not found if it is in env PATH but a non-standard
location.
2019-11-01 09:57:11 -04:00
Eyal Rozenberg
421be81413 FindCUDA: Add nvToolsExt and OpenCL libraries
Find these libraries with CUDA 5 and above.

Fixes: #19386
2019-06-18 08:56:34 -04:00
Kitware Robot
932dcce1e6 Modules: Consistently use 2 space indentation 2019-05-14 15:26:46 -04:00
Brad King
83dab0c123 FindThreads: Drop IRIX-specific options and results
We do not need to support IRIX anymore, so drop relevant parts.  In
particular, the `CMAKE_THREAD_PREFER_PTHREAD` is frequently confused
with `THREADS_PREFER_PTHREAD_FLAG`.

Also remove references to the IRIX-specific options and results
from other modules and tests.
2018-12-07 13:33:01 -05:00
Joachim Wuttke (o)
19998d7b3c Help: Use 'deprecated' template, and date deprecation of modules 2018-10-25 12:23:33 +02:00
Kitware Robot
df4ed1e9ff Help: Convert remaining modules to block-style comments 2018-10-22 11:09:34 -04:00
Brad King
9964808108 Merge topic 'FindCUDA-ccbin-env'
8085799ce3 FindCUDA: Add option to set CUDA_HOST_COMPILER via environment

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2391
2018-09-20 09:35:45 -04:00
peterjc123
8085799ce3 FindCUDA: Add option to set CUDA_HOST_COMPILER via environment
Re-use the `CUDAHOSTCXX` environment variable from the first-class
CUDA language support to specify the host compiler for FindCUDA.
2018-09-18 11:41:47 -04:00
Nikolaus Wittenstein
6209434b44 FindCUDA: Fix "alphabetical" typo 2018-09-14 14:53:03 -04:00
Kenta Kubo
bdf1f36135 FindCUDA: Do not find cublas_device on CUDA >= 9.2
The `cublas_device` has been deprecated and will be removed in
future versions of CUDA.

Issue: #18290
2018-08-23 14:49:46 -04:00
luz.paz
be28106880 Fix misc. typos
Found via `codespell` and `grep`
2018-06-04 10:32:49 -04:00
Brad King
d54796cbd9 Merge topic 'FindCUDA-sccache'
53ffff2277 FindCUDA: Add support for sccache

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2050
2018-05-11 09:22:01 -04:00
Will Feng
53ffff2277 FindCUDA: Add support for sccache
When `CMAKE_C_COMPILER` is `sccache`, pass plain `cl` as the host
compiler to `nvcc`.  Otherwise, `nvcc` does not accept it.
2018-05-09 08:24:22 -04:00
Brad King
6ab7267d2a Merge topic 'FindCUDA-revert-sepcomp-cublas'
9a66345752 FindCUDA: Fix regression in separable compilation without cublas

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2048
2018-05-08 08:26:46 -04:00
Brad King
9a66345752 FindCUDA: Fix regression in separable compilation without cublas
Revert commit v3.11.0-rc1~274^2 (FindCUDA: Add cublas device library to
separable compilation, 2017-11-03).  It breaks targets that do not link
to cublas.  Another solution will be needed to solve the original
problem in a more compatible way.

Fixes: #17965
2018-05-07 11:30:21 -04:00
Edward Z. Yang
2da3698447 FindCUDA: Add support for clcache
When `CMAKE_C_COMPILER` is `clcache`, pass plain `cl` as the host
compiler to `nvcc`.  Otherwise, `nvcc` does not accept it.

Signed-off-by: Edward Z. Yang <ezyang@fb.com>
2018-04-06 11:21:34 -04:00
Edward Z. Yang
23119366e9 FindCUDA: Make nvcc configurable via CUDA_NVCC_EXECUTABLE env var
This is useful if, for example, you want ccache to be used
for nvcc.  With the current behavior, cmake always picks up
/usr/local/cuda/bin/nvcc, even if there is a ccache nvcc
stub in the PATH.  Allowing for CUDA_NVCC_EXECUTABLE lets
us work around the problem.

Signed-off-by: Edward Z. Yang <ezyang@fb.com>
2018-03-29 10:48:02 -04:00
luz.paz
193082a3c8 MAINT: Misc. typos
Found via `codespell -q 3 -I ../cmake-whitelist.txt`.
2018-02-13 11:24:30 -05:00
Brad King
9f74aaeb7d FindCUDA: Fix regression in per-config flags
Changes in commit 48f7e2d300 (Unhardcode the CMAKE_CONFIGURATION_TYPES
values, 2017-11-27) accidentally left `CUDA_configuration_types`
undefined, but this is used in a few places to handle per-config flags.
Restore it.

Fixes: #17671
2018-01-30 08:18:11 -05:00
luz.paz
d91b2d9158 MAINT: Misc. typos
Found via `codespell`
2018-01-10 12:34:14 -05:00
Brad King
d08f3f551f Merge topic 'unhardcode-configuration-types'
1f4d7a07 Help: Add references and backticks in LINK_FLAGS prop_tgt
48f7e2d3 Unhardcode the CMAKE_CONFIGURATION_TYPES values

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1345
2018-01-10 10:35:04 -05:00
Brad King
5fbfa18fad Merge topic 'FindCUDA-deduplicate-c+std-host-flags'
ff41a4b8 FindCUDA: de-duplicates C++11 flag when propagating host flags.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1628
2018-01-09 09:26:51 -05:00
Brad King
bc88329e5b Merge topic 'msvc2017-findcuda'
fab1b432 FindCUDA: Update to properly find MSVC 2017 compiler tools

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !1631
2018-01-09 09:26:20 -05:00
Beren Minor
48f7e2d300 Unhardcode the CMAKE_CONFIGURATION_TYPES values
This removes duplicated code for per-config variable initialization by
providing a `cmake_initialize_per_config_variable(<PREFIX> <DOCSTRING>)`
function.

This function initializes a `<PREFIX>` cache variable from `<PREFIX>_INIT`
and unless the `CMAKE_NOT_USING_CONFIG_FLAGS` variable is defined, does
the same with `<PREFIX>_<CONFIG>` from `<PREFIX>_<CONFIG>_INIT` for every
`<CONFIG>` in `CMAKE_CONFIGURATION_TYPES` for multi-config generators or
`CMAKE_BUILD_TYPE` for single-config generators.
2018-01-08 21:15:14 +01:00
Aaron Bray
fab1b432eb FindCUDA: Update to properly find MSVC 2017 compiler tools
An implementation that handles the different installation locations of
visual studio compiler tools
2018-01-08 11:35:36 -05:00
Brad King
f7f34a46e6 Merge topic 'use_generator_is_multi_config'
3c413e2a GENERATOR_IS_MULTI_CONFIG: Use for multi-config checks in Modules
c267ea1c GENERATOR_IS_MULTI_CONFIG: Use for multi-config checks in Tests

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1627
2018-01-08 11:14:16 -05:00
David Hirvonen
ff41a4b817 FindCUDA: de-duplicates C++11 flag when propagating host flags. 2018-01-06 17:00:09 -05:00
Luz Paz
3ab7bf8285 Various typo fixes
Some are user-facing. Others are source comments.
2018-01-04 06:52:01 +11:00
Craig Scott
3c413e2a31 GENERATOR_IS_MULTI_CONFIG: Use for multi-config checks in Modules 2017-12-30 09:35:56 +11:00
Brad King
21806e6f5f Merge topic 'findcuda-separable-compilation-fix'
3726ded1 FindCUDA: Add cublas device library to separable compilation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Reviewed-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !1446
2017-11-30 07:55:59 -05:00
Jamil Appa
3726ded116 FindCUDA: Add cublas device library to separable compilation
Add cublas libraries to separable compilation device link line to
resolve missing symbols when using cublas device library.
2017-11-29 11:44:42 -05:00
Christian Pfeiffer
a62d50ec56 Modules: Replace coded PATHS with PATH_SUFFIXES
Some modules assume that `/usr` and `/usr/local` are the only
`CMAKE_PREFIX_PATH` entries and explicitly enumerate all paths instead
of using `PATH_SUFFIXES` and relying on the dynamic set of prefix paths.
This commit attempts to rectify that behavior.
2017-11-20 16:29:25 +01:00
luzpaz
777e87ae00 Fix trivial typos in text
Some are user facing.

Found using

    codespell -q 3 --skip="./Utilities" -I .cmake-whitelist.txt`

whereby the whitelist contained:

    ans
    dum
    helpfull
    emmited
    emmitted
    buil
    iff
    isnt
    nto
    ot
    pathes
    substract
    te
    todays
    upto
    whitespaces
2017-11-03 10:25:05 -04:00