After further investigation, the real problem is not about how link options are specified by MPI
module but rather how options are forwarded to the underlying compiler (in your case gcc
).
To propagate the options, CMake
use the prefix -Xcompiler
. Unfortunately, the options contains options with prefix -Wl
and the option -Xcompiler
cannot be used in this case.
To handle -Wl
prefix, the option -Xlinker
must be used instead (i.e. -Wl,opt1,opt2
must be transformed in -Xlinker=opt,opt2
). To support this, It is required to re-work how CMake
generates link options for CUDA
compiler.
Now, for MPI
module, I think the correct approach is to update the module to wrap link options inside $<HOST_LINK:...>
genex to avoid propagating them to device link step. But I am not an expert of CUDA
environments.
So you can create an issue for MPI
module describing the problem and add reference to this discussion. CUDA
experts will be able to comment and validate (or not) my fix suggestion.
I will manage the creation of another issue for device link handling.