Using NVCC/GCC 5.0 in existing GCC 6 code base

I’m quite certain that I’m about to describe is a familiar problem and I’m looking for guidance in order to choose the more/most appropriate solution.

I’ve got a large C++ code base that’s currently compiled with GGC 6 (hoping to move to GCC 7 soon) and now I am planning to implement some new modules in CUDA for hardware acceleration on NVIDIA GPUs. The problem that the CUDA 8.0 compiler nvcc requires GCC 5.

I’d like to compile my (existing) non-CUDA code with GCC 6/7 but compile the CUDA code with NVCC and GCC 5. Specifically, I’m considering creating a C-wrapper for the CUDA parts of the code. What I’m concerned about is possible linkage issues due to ABI differences in the GCC 5 and 6.

I’d appreciate advise on how to introduce CUDA modules that require GCC 5 while to compile my existing C++ code base with GCC 6.

BTW, I’d like to use CUDA C++ instead of CUDA C because I plan to make heavy use of use thrust.

  1. cuda9 beta will probably arrive in a few months
  2. you can use dlls on windows to combine code from different compilers. this probably works on linux too?

CUDA is in the C++ family and has been for a long time. The name “CUDA C” came about because a C compiler frontend was used at the very origin of the CUDA project. About 10 years ago, the CUDA toolchain was switched to C++ and since about 2014 it includes C++11 support. So the name “CUDA C” is simply a historical artifact at this point.