Commit Graph

25 Commits

Author SHA1 Message Date
Raul Tambre
f75bea1071 CUDA: Abstract language flag to compiler modules
Separate this detail out into compiler-specific modules.
Required for Clang support, as it uses slightly different language flags.
2020-03-11 21:30:09 +02:00
Brad King
b2634d639b Merge topic 'cuda_updates_for_10.2'
5341f5e4a1 CUDA: get header deps from compiler invocation when possible
7f15c99851 CUDA: forward unknown flags to host compiler when possible.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4099
2019-12-09 11:21:58 -05:00
Ben Boeckel
6f48c59257 launcher: support setting a compiler launcher through the environment
This makes it much easier to use a launcher for all CMake projects in an
environment rather than having to remember to pass the setting to every
CMake build.
2019-12-05 14:25:36 -05:00
Robert Maynard
5341f5e4a1 CUDA: get header deps from compiler invocation when possible
Before CUDA 10.2 `nvcc` didn't support providing header dependency
information while compiling.
2019-11-29 14:21:35 -05:00
Robert Maynard
7f15c99851 CUDA: forward unknown flags to host compiler when possible.
Starting with CUDA 10.2 the nvcc compiler has gained support
to automatically forward unknown flags to the host compiler.

This behavior is highly desired as projcts that mix CUDA, C, C++
run into situation where flags such as `-pthread` which aren't
supported by nvcc, are being applied to all source files and
therefore break CUDA compilation.
2019-11-29 14:21:35 -05:00
Robert Maynard
a233e4e7d9 CUDA: Compilers can now state they don't require a device linking step 2019-08-06 15:44:15 -04:00
Robert Maynard
122c79748c CUDA: Avoid using deprecated cublas_device to identify device lib dirs
Use `curand_static` to identify directories containing device libraries
because `cublas_device` is deprecated and will be removed in the future.

Issue: #18290
2018-08-23 14:43:31 -04:00
Brad King
edf0ea9bb2 CUDA: Drop unused/broken platform link flags placeholder
The `<CMAKE_CUDA_LINK_FLAGS>` placeholder in CUDA rule variables comes
from the `<CMAKE_CXX_LINK_FLAGS>` placeholder from which the CUDA rule
variables were originally derived.  It is not a public interface for
adding link flags so no projects should be using it.  It is needed for
platform information modules to specify platform-specific link flags for
the language.  None of our platform modules set it, so it is unused.

Furthermore, it is broken as currently implemented.  Some of the
contexts in which it is used need `-Xlinker` and some do not.
Therefore it is not possible to use the placeholder at all.

Simply remove it for now.  If some need for platform-specific CUDA link
flags arises a new solution will be needed.
2018-05-25 10:03:03 -04:00
Gregor Jasny
84f9f63fcc Modules: Introduce CMAKE_EFFECTIVE_SYSTEM_NAME to lookup compiler info
Create a `CMAKE_EFFECTIVE_SYSTEM_NAME` variable to use for looking
up compiler information modules instead of using `CMAKE_SYSTEM_NAME`
directly.  This will allow multiple platforms to share the same set
of compiler information modules without spelling out all of them.

Issue: #17870
2018-04-18 07:41:25 -04:00
Brad King
88c7abb740 CUDA: Pass host linker directories to device linker
In some environments, libraries containing device code are installed in
directories searched by the host linker but not passed by nvcc to
nvlink.  Make these libraries available by explicitly passing the
host linker search directories during device linking.

Issue: #16317
2018-03-28 09:38:43 -04: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
Maikel van den Hurk
fe45d13a0e CUDA: Pass host compiler to nvcc while device linking 2017-08-15 14:46:11 -04:00
Robert Maynard
712af07e47 CUDA: CMAKE_EXPORT_COMPILE_COMMANDS now works with CUDA and Ninja
Fixes: #17061
2017-07-13 11:23:16 -04:00
Robert Maynard
7368ade250 CUDA: When linking device code suppress CUDA 8.0+ deprecation warnings
The CUDA compiler automatic deprecation warnings are pure noise when
doing device linking, and should be suppressed to reduce the amount of
confusion from users.
2017-06-13 09:15:19 -04:00
Brad King
1c60231ca5 CUDA: Link to standard system libraries when linking as CUDA
On Windows with MSVC-like host compilers we must honor the standard
libraries chosen by the `Platform/Windows-MSVC` module.  Otherwise C
code linked into the CUDA binary that expects to have these libraries
available may not link.
2017-02-14 10:34:15 -05:00
Robert Maynard
8d1f9e5b85 CUDA: Now pass correct FLAGS when device link cuda executables.
Previously we had a two issues when building cuda executables
that required separable compilation. The first was that we didn't
propagate FLAGS causing any -arch / -gencode flags to be dropped, and
secondly generators such as ninja would use the CXX language flags
instead of CUDA when the executable was mixed language.
2017-01-12 15:13:36 -05:00
Brad King
d470cb7007 CUDA: Use .obj object file extension on Windows 2017-01-12 10:39:02 -05:00
Brad King
945dd207b6 CUDA: Allow platform files to set device linking rules
Condition the default settings on the rule variables not already being
set.
2017-01-12 10:39:02 -05:00
Robert Maynard
5dec403103 CUDA: Refactor CMakeCUDAInformation to prepare for separable compilation. 2016-11-14 11:36:45 -05:00
Robert Maynard
489c52ce68 CUDA: Use the host compiler for linking CUDA executables and shared libs. 2016-11-14 11:36:44 -05:00
Robert Maynard
bbaf243410 CUDA: add support for specifying an explicit host compiler. 2016-11-14 11:36:44 -05:00
Robert Maynard
a92f8d9616 CUDA: Enable header dependency scanning. 2016-11-14 11:36:44 -05:00
Robert Maynard
4f5155f6ab CUDA: We now properly perform CUDA compiler identification. 2016-11-14 11:36:43 -05:00
Robert Maynard
bf326ebb76 CUDA: Explicitly state all source files are cuda sources.
This way you can mark a .C/.CPP files as a cuda source file and
have nvcc build it as a cuda file.
2016-11-14 11:36:43 -05:00
Robert Maynard
f8aac21947 CUDA: Add basic CUDA language support for *NIX systems. 2016-11-14 11:36:42 -05:00