Cannot dynamically load a shared library containing both OpenACC and CUDA code

Hi Olli,

Same answer as your first question, compile the C++ code with “-gpu=nordc”. However this one’s a bit more tricky in that in order to call the CUDA device routine, you need RDC enabled so the device linker can resolve the symbol.

What I’d try is merging the cuda.cu file in with the directives.cpp file so the routine can be inlined instead of called thus removing the need for the link step. While not fully supported, nvc++ can compile CUDA code. However since nvc++ is a single pass compiler, it cannot not support “__CUDA_ARCH__”. Instead we’ve added a constexpr “if target(nv::target::is_device)” which can be evaluated at compile time to mimic the behavior.

Normally I’d write an example for you, but my home internet is currently down and I can’t get VPN to work through my tethered cell phone so can’t get to my systems. Once back, I’ll post a follow-up with an example. Though in the mean time, you can see an example if posted HERE.

-Mat