1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-05-12 08:05:28 +08:00

10 Commits

Author SHA1 Message Date
Brad King
cf92fd9ae9 Merge branch 'cuda-filter-device-link-items' into cuda-thread-flags 2018-10-24 10:14:32 -04:00
Robert Maynard
e768d96c74 CUDA: Filter out host link flags during device linking
Since commit v3.12.0-rc1~278^2 (CUDA: Pass more link libraries to device
linking, 2018-03-27) we consider every link item during device linking.
However, items that start in `-` may be host-specific link flags that
nvcc will not understand during device linking.  Filter such items using
a white list.

In particular, this allows `-pthread` to be used for host linking while
not polluting the device link line.

Issue: #18008
2018-10-24 09:54:25 -04:00
Robert Maynard
fd0523a215 CUDA: Properly de-duplicate libs when doing device linking
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.
2018-07-17 10:42:57 -04:00
Robert Maynard
41eab150a8 CUDA: Pass more link libraries to device linking
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
2018-03-28 09:38:43 -04:00
Pavel Solodovnikov
7d5095796a Meta: modernize old-fashioned loops to range-based for.
Changes done via `clang-tidy` with some manual fine-tuning
for the variable naming and `auto` type deduction
where appropriate.
2017-09-12 16:22:47 +03:00
Daniel Pfeifer
b1ec5deaf1 Pass large types by const&, small types by value 2017-06-04 00:48:21 +02:00
Robert Maynard
493671a521 CUDA: Static libraries can now explicitly resolve device symbols
If a static library has the property CUDA_RESOLVE_DEVICE_SYMBOLS enabled
it will now perform the device link step. The normal behavior is
to delay calling device link until the static library is consumed by
a shared library or an executable.
2017-04-26 16:18:25 -04:00
Daniel Pfeifer
ee72803e9f fix some include-what-you-use diagnostics 2017-02-17 22:12:21 +01: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
Robert Maynard
ae05fcc63f CUDA: Add LinkLineComputer that computes cuda dlink lines. 2016-11-14 16:40:48 -05:00