VS: Unable to target "CUDA Linker" -> "Additional Dependencies" project option
If a CUDA target A
depends on a second CUDA target B
which is a static library, and both have relocatable device code enabled (CUDA_SEPARABLE_COMPILATION
). If the CUDA static library is changed, and CUDA target A
is incrementally built. The nvcc -dlink
stage will not be triggered, so compilation will fail with a device link error.
Prior to CUDA 11.2, this could not be fixed (something would need to be changed in target A
, to trick -dlink
into being triggered). However in CUDA 11.2, files listed under CUDA Linker->Additional Dependencies
are treated as dependencies for the -dlink
stage, and if they have been updated will trigger -dlink
and the build succeed.
This is not the same using GCC, based on our project configuration. That has always triggered -dlink
on incremental builds.
Note, in CUDA 11.0, and likely CUDA 11.1. Specifying a library as both a Host and Device dependency would lead to it being passed twice to -dlink
which results in a multiply defined symbols error.
The screenshot below shows the setting we are trying to target.
This is likely a bug with CUDA (which I have been following up with them the past week), as the "Use Host Library Dependencies:Yes" option is not treating host dependencies as actual dependencies. However, it could still be useful in other cases to specify device link targets.
We've attempted things like target_link_libraries(${NAME} $<DEVICE_LINK:flamegpu2>)
, however the DEVICE_LINK
genex is restricted to target_link_options()
, so that doesn't work.
Could you please add support for manually specifying device link dependencies (or clarify the correct way of doing it if it's already possible).
Thanks Robert