summaryrefslogtreecommitdiffstats
path: root/Tests/CudaOnly
Commit message (Collapse)AuthorAgeFilesLines
* Tests: Fix CudaOnly.SeparateCompilationPTX test project nameBrad King2022-02-161-1/+1
| | | | | | | | | | | | Fix the test added by commit 61b9764b03 (CUDA: Allow both CUDA_SEPARABLE_COMPILATION and CUDA_PTX_COMPILATION, 2021-09-17, v3.23.0-rc1~516^2) to have a `project()` name matching what is passed to CTest's `--build-project` option. Otherwise, on VS builds, MSBuild warns: MSBUILD : error MSB1009: Project file does not exist. Other CUDA tests use a matching project name already.
* CUDA: Generic all and all-major supportRaul Tambre2022-02-011-34/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* CUDA: Visual Studio Generator propagates definitions for PTX filesunknown2021-12-143-0/+8
| | | | | | | | From CUDA 9.0 to CUDA 11.4 the CUDA Visual Studio integration defines omitted user defines from PTX generation. With CUDA 11.5 this has been resolved, so we backport the fix to allow for consistent behavior when using CMake
* CUDA: Support nvcc 11.5 new -arch=all|all-major flagsRobert Maynard2021-11-013-0/+49
|
* CUDA: Allow both CUDA_SEPARABLE_COMPILATION and CUDA_PTX_COMPILATIONRobert Maynard2021-10-206-1/+97
| | | | | | The target properties `CUDA_SEPARABLE_COMPILATION` and `CUDA_PTX_COMPILATION` now aren't mutually exclusive and can now be used together on the same target.
* CUDA/Clang: Fix separable compilation in non-root directories with Makefilesroot2021-07-294-21/+22
| | | | | | | | Seems the relative paths were wrong basically all around such that only compiling files in the top-level directory would work. I've modified CudaOnly.SeparateCompilation to cover this. Fixes #22482.
* FindCUDAToolkit: Robust version checks when CUDA lang is not enabledRobert Maynard2021-02-094-0/+39
| | | | | | Previously if you set `CMAKE_CUDA_COMPILER` but hadn't enabled the CUDA language, FindCUDAToolkit would not correctly compute the version information.
* CUDA: Fix tests with CUDAARCHS setRaul Tambre2020-11-302-1/+6
| | | | | | | With CUDAARCHS there's the possibility of tests being run with multiple architectures or having CMAKE_CUDA_ARCHITECTURES set with NVCC despite CMP0104 being OLD. Fix a few tests to work properly in such cases.
* CUDA: Clang separable compilationRaul Tambre2020-09-241-19/+17
| | | | | | | | | | | | 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
* Tests: Don't unnecessarily set CUDA_ARCHITECTURESRaul Tambre2020-09-219-28/+14
| | | | | | | | | | | | | | Architecture 30 was removed with CUDA 11, so most of the CUDA tests fail with it. Remove setting the architecture and bump the minimum version to 3.18, so CMP0104 takes effect and we can rely on the default architecture, which is guaranteed to be compilable. Use of __ldg() in ProperLinkFlags was removed as it only affects performance and is available only on sm_35 and above. Testing the functionality of CUDA_ARCHITECTURES is already covered by CudaOnly.Architecture and CudaOnly.CompileFlags.
* 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,\ " ```
* CudaToolkit: Update for new/removed libraries in CUDA 11Robert Maynard2020-06-181-2/+15
|
* Tests: Fix CudaOnly.StaticRuntimePlusToolkit build rpathRobert Maynard2020-06-161-0/+6
|
* CUDA: Add support for disabling CUDA_ARCHITECTURESRaul Tambre2020-06-151-2/+12
| | | | | | | | | | 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.
* Tests: add CUDA labels to tests which are affected by CUDABen Boeckel2020-06-111-15/+24
|
* Merge branch 'backport-cuda-default-runtime' into cuda-default-runtimeBrad King2020-05-223-0/+22
|\
| * CUDA: Compute CMAKE_CUDA_RUNTIME_LIBRARY default from toolchainRobert Maynard2020-05-213-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Tests: Restore NVCC-specific CUDA testsBrad King2020-05-202-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit a653ca9504 (Tests: Update CUDA tests to work with Clang, 2020-03-27) some tests were conditioned using `CMAKE_CUDA_COMPILER_ID`. That is not defined when configuring CMake itself, so it accidentally turned off NVCC-specific CUDA tests altogether. Convert the conditions to check `CMake_TEST_CUDA` for `Clang` instead. That option is added explicitly to builds where we want the tests to run, so we can set it to a value indicating the CUDA compiler vendor. In commit a653ca9504 (Tests: Update CUDA tests to work with Clang, 2020-03-27) the NVCC-specific `CudaOnly.GPUDebugFlag` test was accidentally broken by removing a space when appending `-G` to the CUDA flags. This was covered by the test not running. Restore the space. Fixes: #20727
* | Tests: Update CUDA tests to work with ClangRaul Tambre2020-05-157-39/+44
| |
* | CUDA: Add CudaOnly.CompileFlags testRaul Tambre2020-04-153-0/+33
| | | | | | | | Covers passing compile flags explicitly for both NVCC and Clang.
* | CUDA: Convert tests to use CUDA_ARCHITECTURESRaul Tambre2020-04-157-21/+7
| |
* | CUDA: Add CUDA_ARCHITECTURES target propertyRaul Tambre2020-04-153-0/+15
|/ | | | | | | | | | | 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.
* CUDA: Add abstraction for cuda runtime selectionRobert Maynard2020-01-2722-3/+722
| | | | | Fixes #17559 Replace our hard-coded default of cudart=static with a first-class abstraction to select the runtime library from an enumeration of logical names.
* CUDA: MSVC + NVCC support --compiler-options compiler flagRobert Maynard2020-01-021-1/+1
| | | | Fixes #20164
* FindCUDAToolkit: correct searches for Toolkit componentsRobert Maynard2019-12-161-11/+1
|
* FindCUDAToolkit: Improve usage, library set, and testsRobert Maynard2019-12-163-0/+63
| | | | | | Refined the initial design of FindCUDAToolkit and improve it by adding more library support, more toolkit information and tests.
* CUDA: Add cuda meta-features (e.g. ``cuda_std_11``) supportRobert Maynard2019-12-106-6/+33
|
* Revise include order using clang-format-6.0Kitware Robot2019-10-012-3/+4
| | | | | Run the `clang-format.bash` script to update our C and C++ code to a new include order `.clang-format`. Use `clang-format` version 6.0.
* CUDA: static lib device linking computes required static libsRobert Maynard2019-09-056-44/+42
| | | | | | Previously the CMake didn't compute the required set of libraries needed to properly device link a static library when CUDA_RESOLVE_DEVICE_SYMBOLS was enabled.
* CUDA: Support CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS global variableRobert Maynard2019-08-061-1/+1
|
* CUDA: Support compiler id and version generator expressionsRobert Maynard2019-03-112-0/+10
| | | | | Introduce the CUDA_COMPILER_ID and CUDA_COMPILER_VERSION generator expressions.
* CUDA: Honor CUDA_RESOLVE_DEVICE_SYMBOLS for more target typesRobert Maynard2019-02-055-0/+151
| | | | | | | `CUDA_RESOLVE_DEVICE_SYMBOLS` can be used with shared, module, and executable target types. This relaxation is to allow for better interoperability with linkers that automatically do CUDA device symbol resolution and have no way to disable it.
* CUDA: Add test for device linking when host linking uses threadsRobert Maynard2018-10-243-99/+0
| | | | | | | | | Convert the `CudaOnly.LinkSystemDeviceLibraries` test to a new `Cuda.ProperDeviceLibraries` test. The former covered only the `cublas_device` library which is removed by CUDA 10. Extend the new test to also cover various cases of using threads. Issue: #18008
* Tests: Fix Cuda test project namesBrad King2018-10-109-9/+9
| | | | | Make them match what `ADD_TEST_MACRO` gives to ctest as the project name to build so that the `.sln` file will be found.
* Merge topic 'cuda-no-cublas_device'Brad King2018-08-241-0/+6
|\ | | | | | | | | | | | | 122c79748c CUDA: Avoid using deprecated cublas_device to identify device lib dirs Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2296
| * CUDA: Avoid using deprecated cublas_device to identify device lib dirsRobert Maynard2018-08-231-0/+6
| | | | | | | | | | | | | | Use `curand_static` to identify directories containing device libraries because `cublas_device` is deprecated and will be removed in the future. Issue: #18290
* | CUDA: Properly de-duplicate libs when doing device linkingRobert Maynard2018-07-171-2/+1
| | | | | | | | | | | | | | | | The nvcc device linker is designed so that each static library with device symbols only needs to be listed once as it doesn't care about link order. If you provide the same static library multiple times it will error out. To make sure this occurs we find the unique set of link items.
* | CUDA: Add a test to verify device linking can handle circular depsRobert Maynard2018-07-176-0/+61
|/
* Revise C++ coding style using clang-format-6.0Kitware Robot2018-06-013-18/+18
| | | | | | | | | | | | Run the `clang-format.bash` script to update all our C and C++ code to a new style defined by `.clang-format`. Use `clang-format` version 6.0. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit.
* VS: Add workaround for CUDA compiler PDB locationBrad King2018-04-134-0/+37
| | | | | | | | | The CUDA Toolkit Visual Studio Integration does not honor the `ClCompile.ProgramDataBaseFileName` field when telling `nvcc` how to invoke `cl`. Work around this problem by passing `-Xcompiler=-Fd...` ourselves through `AdditionalOptions`. Fixes: #17647
* CUDA: Pass more link libraries to device linkingRobert Maynard2018-03-283-0/+93
| | | | | | | | | | | | | | | | | Previously we dropped non-target items from the device link line because nvcc rejects paths to shared library files, and only with target items do we know the kind of library. However, this also prevents projects from linking to system-provided libraries like `cublas_device` that contain device code. Fix this by passing more link items to device linking. Items that are not file paths, such as `-lfoo`, can simply be passed unconditionally. Items that are targets known to be shared libraries can still be skipped. Items that are paths to library files can be passed directly if they end in `.a`. Otherwise, pass them using `-Xnvlink` to bypass nvcc's front-end. The nvlink tool knows to ignore shared library files. Issue: #16317
* Tests: Add missing error check in CudaOnly.GPUDebugFlagBrad King2018-02-011-0/+5
| | | | If `cudaMallocManaged` fails then later use of `has_debug` is not valid.
* Merge topic 'msvc_cuda_8_explicitly_specify_cuda_language'Brad King2018-01-182-9/+2
|\ | | | | | | | | | | | | 46abfedb CUDA: MSVC will now state files are cuda files when needed Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1658
| * CUDA: MSVC will now state files are cuda files when neededRobert Maynard2018-01-122-9/+2
| | | | | | | | | | | | | | | | The MSVC CUDA build customizations before CUDA 9 would not explicitly add the -x cu option when building. This caused .cpp and .c files invoked with CudaCompile to be compiled as host code and not cuda. Now when we detect CUDA < 9 we will explicitly add this option to correct this bug.
* | Merge topic 'extend-compile-language-genex'Brad King2018-01-163-8/+33
|\ \ | |/ |/| | | | | | | | | | | | | | | | | 506fda1c Genex: Enable COMPILE_LANGUAGE for INCLUDE_DIRECTORIES with VS and Xcode c2f79c98 Genex: Enable COMPILE_LANGUAGE for COMPILE_DEFINITIONS with VS and Xcode 0795d25b cmVisualStudio10TargetGenerator: Factor out include dir computation 1ab4d186 cmLocalVisualStudio7Generator: Clarify variable name of compiled language 07e1a743 cmLocalVisualStudio7Generator: Clarify condition for target that compiles Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1657
| * Genex: Enable COMPILE_LANGUAGE for INCLUDE_DIRECTORIES with VS and XcodeBrad King2018-01-123-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The set of compile flags used for a target's C and C++ sources is based on the linker language. By default this is always the C++ flags if any C++ sources appear in the target, and otherwise the C flags. Therefore we can define the `COMPILE_LANGUAGE` generator expression in `INCLUDE_DIRECTORIES` to match the selected language. This is not exactly the same as for other generators, but is the best VS and Xcode can do. It is also sufficient for many use cases since the set of include directories for C and C++ is frequently similar but may be distinct from those for other languages like CUDA. Fixes: #17435
| * Genex: Enable COMPILE_LANGUAGE for COMPILE_DEFINITIONS with VS and XcodeBrad King2018-01-122-8/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The set of compile flags used for a target's C and C++ sources is based on the linker language. By default this is always the C++ flags if any C++ sources appear in the target, and otherwise the C flags. Therefore we can define the `COMPILE_LANGUAGE` generator expression in `COMPILE_DEFINITIONS` to match the selected language. This is not exactly the same as for other generators, but is the best VS and Xcode can do. It is also sufficient for many use cases since the set of definitions for C and C++ is frequently similar but may be distinct from those for other languages like CUDA. Issue: #17435
* | Merge topic 'cuda_allow_G_to_device_debugging_on_msvc'Brad King2018-01-123-1/+91
|\ \ | |/ |/| | | | | | | | | dcc606ad CUDA: Allow -G to control device debuging on MSVC. Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1619
| * CUDA: Allow -G to control device debuging on MSVC.Robert Maynard2018-01-113-1/+91
| | | | | | | | Fixes #17551
* | CUDA: gencode signature that list multiple code types now supported.Robert Maynard2018-01-102-2/+3
|/ | | | Fixes #17263