OpenACC + CUDA + CMake
We would like to use C with OpenACC pragmas and CUDA kernels in some hotspots.
With make
everything is fine. However we would like to build with CMake.
We started with this repo:
https://github.com/jefflarkin/openacc-interoperability
We needed to remove <LINK_LIBRARIES>
from CMAKE_CUDA_LINK_EXECUTABLE
because it tries to link cuda libraries in the nvc++
link step, causing errors at runtime. This way however we can not link external libraries, which we want to do.
The CMake line with added LINK_LIBRARIES
:
set(CMAKE_CUDA_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
It would be preferable to have an elegant solution work, without the cmake list mangling for example. Is it possible?
Edited by Brad King