Commit Graph

35 Commits

Author SHA1 Message Date
Robert Maynard
7cc815a2a6 CUDAToolkit: Detect CUDA SDK that don't have nvcc
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
2020-07-30 15:56:52 -04:00
Jean-Christophe Fillion-Robin
207373802e Fix typos identified using codespell
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,\
"
```
2020-07-22 12:44:47 -04:00
Kitware Robot
496ec6036f Help: Add Sphinx 'versionadded' directives to each top-level document
Run the `Utilities/Sphinx/update_versions.py` script to add initial
markup to every top-level document and find module.

Issue: #19715
2020-07-06 10:23:20 -04:00
Robert Maynard
b284a3c764 CudaToolkit: Update for new/removed libraries in CUDA 11 2020-06-18 08:52:58 -04:00
Raul Tambre
ec59fb6c31 CUDA: Determine CUDA toolkit location for NVCC
Similar to how we already do for Clang. Avoids a lot of redundant work in
FindCUDAToolkit.
2020-06-12 23:13:57 +03:00
Raul Tambre
0a056246a1 CUDA: Pass toolkit path to Clang
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.
2020-06-12 21:50:05 +03:00
Raul Tambre
9c43972127 FindCUDAToolkit: Avoid unnecessary temporary variable computing binary dir 2020-06-12 21:49:15 +03:00
Raul Tambre
9eebb5b8b2 FindCUDAToolkit: Remove unnecessary checks around searches
find_*() don't search if the result variable is already set.
Remove the if()s around such cases.
2020-06-12 21:49:15 +03:00
Raul Tambre
8f01fe7bf1 FindCUDAToolkit: Use list(SORT) to sort in natural order
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.
2020-06-12 21:49:15 +03:00
Raul Tambre
8c144fe9ad FindCUDAToolkit: Compute CUDAToolkit_INCLUDE_DIR instead of searching
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.
2020-06-12 21:49:15 +03:00
Raul Tambre
403f8d31e3 FindCUDAToolkit: Add CUDAToolkit_LIBRARY_ROOT
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.
2020-06-12 21:49:15 +03:00
Raul Tambre
6636693134 FindCUDAToolkit: Re-unify with Internal/CUDAToolkit
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.
2020-06-12 21:49:15 +03:00
Raul Tambre
7e2f86461a FindCUDAToolkit: Fix cudart not found status message
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.
2020-06-08 07:56:31 -04:00
Raul Tambre
dc2eae1f91 FindCUDAToolkit: Factor out discovery code into a separate file
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`.
2020-05-15 17:46:51 +03:00
Brad King
d93ce24b0f Merge topic 'FindCUDAToolkit-search-stubs'
4f1e24efa0 FindCUDAToolkit searches stub location last

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4589
2020-04-15 09:36:25 -04:00
Robert Maynard
4f1e24efa0 FindCUDAToolkit searches stub location last
Fixes #20252
2020-04-14 09:39:46 -04:00
Raul Tambre
d86fcc6359 CUDAToolkit: Deduce toolkit binary directory from compiler path only for NVCC
This assumption doesn't hold for Clang.
When crosscompiling this causes X86 libraries to be used and thus linker errors.
2020-04-07 09:33:26 -04:00
Robert Maynard
a7cf574417 CUDAToolkit: Mark find queries as advanced variables
Fixes #20435
2020-03-10 13:27:16 -04:00
Robert Maynard
27b0d908d4 CUDAToolkit: Add support for cupti library
Fixes: #20318
2020-02-06 09:41:24 -05:00
Robert Maynard
c3d7f2e43b CUDAToolkit: Correct location of OpenCL doc link 2020-02-06 09:40:30 -05:00
Robert Maynard
60bb7a54d5 CUDAToolkit: Add required static runtime library dependencies
CUDAToolkit now adds the correct libraries that are required by the
static runtime.
2020-01-30 10:18:21 -05:00
Rodolfo Lima
916d54dfb3 FindCUDAToolkit: Fix behavior on multiple calls
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
2020-01-28 14:21:24 -05:00
Rodolfo Lima
b452e2bd6a FindCUDAToolkit: Fix CUDA::* target guard logic
Issue: #20282
2020-01-28 14:21:24 -05:00
Robert Maynard
45d21dd5d4 CUDAToolkit: Use CMAKE_FIND_ROOT_PATH for all sdk lib searches 2020-01-27 13:42:18 -05:00
Robert Maynard
e357772f20 CUDAToolkit: Use HINTS as it has higher precedence for searches 2020-01-24 15:31:53 -05:00
Robert Maynard
c6ec51c625 CUDAToolkit: functions names now use CMake's reserved namespace 2020-01-24 15:31:36 -05:00
Robert Maynard
48bd2e0630 CUDAToolkit: Make sure to also search 'stubs' directory
Fixes #20252
2020-01-23 13:07:21 -05:00
Robert Maynard
69fcad9332 CUDAToolkit: Add support for cross-compiling
CUDAToolkit now searches the correct targets folder based on
what platform we are cross-compiling for.

Fixes: #20232
2020-01-23 12:51:29 -05:00
Robert Maynard
6e474364d1 CUDAToolkit: No targets now depend on the CUDA runtime
It is not a requirement to have shared|static consistent across your
CUDA libraries (e.g curand, nppc ) and your CUDA runtime library.
It is entirely allowable to use a static nppc and a shared runtime.
2020-01-14 13:50:37 -05:00
Robert Maynard
907bb7df57 CUDAToolkit: Gracefully handle missing SDK components 2020-01-06 09:11:16 -05:00
Robert Maynard
e500eb80cd CUDAToolkit: add_cuda_link_dependency correctly sets dependencies 2020-01-03 16:42:16 -05:00
Robert Maynard
d484a3c4d8 FindCUDAToolkit: correct searches for Toolkit components 2019-12-16 14:35:03 -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
Stephen McDowell
29560bf07b FindCUDAToolkit: Import targets for toolkit libraries 2019-12-16 10:31:43 -05:00
Stephen McDowell
2c0ff263b4 FindCUDAToolkit: Add module to find the CUDA Toolkit 2019-12-16 10:31:43 -05:00