| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
For NVCC the compiler takes care of device linking when passed the "-dlink"
flag.
Clang doesn't support such magic and requires the buildsystem to do the work
that NVCC does behind the scenes.
The implementation is based on Bazel's device linking documentation:
https://github.com/tensorflow/tensorflow/blob/7cabcdf073abad8c46e9dda62bb8fa4682d2061e/third_party/nccl/build_defs.bzl.tpl#L259
Closes: #20726
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Also re-ordered the code to avoid testing flags for other compilers, since
we know the vendor before full detection.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If an user specified a host compiler we should fail if we are unable to perform
compiler detection with it.
Previously we would try without and likely succeed and continue. Then we'd fail
during ABI detection and compiler testing since we'd still try to use it.
This is particularly problematic when crosscompiling since we extract the host
linker from the compiler detection link line. This would result in the wrong
host linker being used and a linking error due to architecture mismatch during
ABI detection where other necessary flags may already be present to make the
host compiler work. See #21076 for an example.
Fix this by adding CMAKE_<LANG>_COMPILER_ID_REQUIRE_SUCCESS to
CMakeDetermineCompilerId, which throws a fatal error if executing the compiler
results in a non-zero exit code.
Fixes #21120.
|
|
|
|
|
|
|
|
|
|
|
| |
Capture CMAKE_<LANG>_COMPILER_ARG1 from CMAKE_<LANG>_COMPILER in the
same fashion that it is from $ENV{<LANG>}.
Since get_filename_component() returns a single string of all the
arguments from $ENV{<LANG>}, a single string of arguments will be
constructed from the items contained in CMAKE_<LANG>_COMPILER.
Fixes #20089
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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,\
"
```
|
|
|
|
|
|
|
| |
Need to surround it with quotes otherwise the different bits are passed as
separate arguments.
Fixes #20954.
|
|
|
|
|
|
|
|
|
|
| |
When using a Visual Studio generator, we do not know the path to
`CMAKE_CUDA_COMPILER` until after the compiler id detection project
extracts it. However, based on the VS toolchain configuration we know
that the compiler id will be NVIDIA, so use that to drive the CUDA
architecture flag logic. After the main compiler id step we know
`CMAKE_CUDA_COMPILER`, so `CMAKE_CUDA_COMPILER_TOOLKIT_ROOT` can then be
computed.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
The result variable was `CUDAToolkit_NVCC_EXECUTABLE` instead of
`_CUDA_NVCC_EXECUTABLE`, which the rest of the code used. Also, we can
simply `set()` the `_CUDA_NVCC_EXECUTABLE` value without searching.
Fixes: #20847
|
|
|
|
|
|
| |
Supporting compiling on Windows is more complicated than initially expected, so
it won't make it into CMake 3.18.
Add a helpful error for users.
|
|\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
ec59fb6c31 CUDA: Determine CUDA toolkit location for NVCC
0a056246a1 CUDA: Pass toolkit path to Clang
9c43972127 FindCUDAToolkit: Avoid unnecessary temporary variable computing binary dir
9eebb5b8b2 FindCUDAToolkit: Remove unnecessary checks around searches
8f01fe7bf1 FindCUDAToolkit: Use list(SORT) to sort in natural order
8c144fe9ad FindCUDAToolkit: Compute CUDAToolkit_INCLUDE_DIR instead of searching
403f8d31e3 FindCUDAToolkit: Add CUDAToolkit_LIBRARY_ROOT
6636693134 FindCUDAToolkit: Re-unify with Internal/CUDAToolkit
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4828
|
| |
| |
| |
| |
| | |
Similar to how we already do for Clang. Avoids a lot of redundant work in
FindCUDAToolkit.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| | |
find_*() don't search if the result variable is already set.
Remove the if()s around such cases.
|
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|/
|
|
|
|
|
|
|
|
| |
The ability to disable adding architectures completely for packaging purposes
and cases requiring passing the architectures flags explicitly has been
requested.
Support a false value for CUDA_ARCHITECTURES and CMAKE_CUDA_ARCHITECTURES
for this purpose.
Implements #20821.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We don't distinguish real/virtual architectures during compiler detection.
If the user passes -DCMAKE_CUDA_ARCHITECTURES="70-virtual" we'll test with only
the real architecture.
If it works "architectures" will end up as "70". We check equality using
strings, so this fails and we incorrectly throw an error.
Fix this by comparing against CMAKE_CUDA_ARCHITECTURES with the specifiers
stripped.
We need to deduplicate tested_architectures for the same reason in case the
user specified something like "70-real;70-virtual".
|
|
|
|
|
|
|
|
|
|
|
| |
Extend the improved error message added for Clang by commit 19cc5bc296
(CUDA: Throw error if user-specified architectures don't work,
2020-05-26) to cover NVCC as well.
Also fix the error incorrectly being thrown if the user-specified list
differed in order to the architectures parsed from the compiler output.
Implements: #20757
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously if an user specified CMAKE_CUDA_ARCHITECTURES and they didn't
work we would end up erroring during compiler testing. Instead check if
the architectures we successfully compiled with are the same as the
user-specified (if any). If they don't match, then throw a more helpful
error than compiler testing would.
Additionally, to make this work correctly I made it try all
user-specified architectures at once instead of each separately.
Implements: #20756
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The purpose of `CMAKE_CUDA_HOST_IMPLICIT_LINK_*` is to capture the
extra link libraries and directories that the CUDA compiler passes
when invoking the host linker. We need this when using NVCC because
CMake drives the host linker directly rather than through NVCC.
However, this is not needed with Clang because:
* Clang does not pass any CUDA libraries automatically.
* We drive linking with the Clang compiler anyway.
Drop the detection logic for Clang because it only gives the normal C++
runtime libraries which we do not need here.
|
|
|
|
|
| |
The CUDA runtime library names may have a `.lib` suffix.
Exclude those too.
|
|
|
|
|
|
| |
Filter CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES just after it is
computed. Re-use the same exclusion list for filtering
CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES to avoid duplication.
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Since commit 0d0145138f (CUDA: Add abstraction for cuda runtime
selection, 2019-11-29, v3.17.0-rc1~83^2) we add CUDA runtime library
selection flags by default.
To maintain backwards compatibility the default CUDA runtime
library needs to be computed based on what libraries are found
on the initial compiler invocation. For example a toolchain
could establish initial flags that have all CUDA compilations
using the runtime version, and if we don't detect this we will
try to link to both the static and shared runtime.
Co-Author: Brad King <brad.king@kitware.com>
Fixes: #20708
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When crosscompiling we pass the sysroot.
We need to try various architecture flags. Clang doesn't automatically
select one that works. First try the ones that are more likely to work
for modern installations:
* <=sm_50 is deprecated since CUDA 10.2, try sm_52 first for
future compatibility.
* <=sm_20 is removed since CUDA 9.0, try sm_30.
Otherwise fallback to Clang's current default. Currently that's `sm_20`,
the lowest it supports.
Separable compilation isn't supported yet.
Fixes: #16586
|
|\ \
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
21131ca60c CUDA: Add CudaOnly.CompileFlags test
f0931b0790 CUDA: Convert tests to use CUDA_ARCHITECTURES
e98588aaba CUDA: Add CUDA_ARCHITECTURES target property
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Patrick Stotko <stotko@cs.uni-bonn.de>
Merge-request: !4568
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Simplifies CUDA target architecture handling.
Required for Clang support as Clang doesn't automatically select a supported architecture.
We detect a supported architecture during compiler identification and set CMAKE_CUDA_ARCHITECTURES to it.
Introduces CMP0104 for backwards compatibility with manually setting code generation flags with NVCC.
Implements #17963.
|
|/ / |
|
| | |
|
|/
|
|
| |
The code is specific to nvcc.
|
|
|
|
|
|
| |
Fixes #18733
Correct an oversight where the MSVC generators didn't populate
CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES.
|
|
|
|
|
|
|
| |
The `PROMPT` environment variable affects nvcc's output. Fix
our parsing of that output to tolerate square brackets.
Fixes: #19089
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Users can create it through an explicit command-line option if desired.
Initializing the variable as an empty cache entry can wipe out a normal
variable of the same name that may have been set by a toolchain file.
Since commit v3.8.0-rc1~261^2~11 (CUDA: Use the host compiler for
linking CUDA executables and shared libs, 2016-09-19) we save the value
of `CMAKE_CUDA_HOST_COMPILER` persistently in the compiler information
file as a normal variable.
Fixes: #17935
|
|
|
|
| |
This generator has been deprecated since CMake 3.9. Remove it.
|
|
|
|
|
|
|
|
| |
The switch was not considering some languages, such as `ASM`.
Instead of memorizing the list of languages in the condition,
use a language specified by the includer.
Fixes: #17510
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When no explicit `CMAKE_CUDA_HOST_COMPILER` is specified by the user
then we do not pass `-ccbin` to `nvcc`. In this case, nvcc's link line
we extract during the compiler identification step may not have the
absolute path to the host compiler it uses to drive linking. If it is
not absolute, use the `PATH=` from nvcc's output to search for it since
that is the one `nvcc` would use.
This fixes our internal `CMAKE_CUDA_HOST_LINK_LAUNCHER` value used to
construct link lines when using `CUDA` as the linker language. It needs
to match the host compiler `nvcc` uses internally during compilation.
Fixes: #17323
|
|
|
|
| |
This generator has been deprecated since CMake 3.6. Remove it.
|
|
|
|
|
| |
Teach `CMakeDetermineCompilerId` how to generate a vcxproj file using
the `CMAKE_VS_PLATFORM_TOOLSET_CUDA`.
|
| |
|
|
|
|
|
| |
The `nvcc -v` output provides what include directories need to be added
to use the CUDA toolkit from other languages ( C/C++ ).
|
|
|
|
|
| |
The `nvcc -v` output on Windows uses response files, so load the one we
need to extract the full link line.
|
|
|
|
|
| |
On Windows the host link launcher is just `link.exe`. Find and use that
instead of trying to extract the launcher from the `nvcc -v` output.
|
| |
|