I am trying to write a CUDA version of a FEM solver that I wrote in C++. Part of the serial code uses the Eigen library (version 3.3). Whenever I compile source file that uses Eigen with nvcc I get the following error:
nvcc -x cu -dc Element.cpp
In file included from /usr/local/cuda-9.0/bin/…//include/common_functions.h:50:0,
from /usr/local/cuda-9.0/bin/…//include/cuda_runtime.h:115,
from :0:
/usr/local/cuda-9.0/bin/…//include/crt/common_functions.h:64:24: error: token ““CUDACC_VER is no longer supported. Use CUDACC_VER_MAJOR, CUDACC_VER_MINOR, and CUDACC_VER_BUILD instead.”” is not valid in preprocessor expressions #defineCUDACC_VER "CUDACC_VER is no longer supported. Use CUDACC_VER_MAJOR, __CUDACC_V
^
/usr/include/eigen3/Eigen/src/Core/util/Macros.h:364:33: note: in expansion of macro ‘CUDACC_VER’ #if defined(CUDACC_VER) && CUDACC_VER >= 70500 && __cplusplus > 199711L
I tried to go to that Macros.h file and replace CUDACC__VER with CUDACC_VER_MAJOR but this replaced the above message with a plethora of Eigen warning messages.
Any idea? I use Eigen for basic linear algebra operations. It’s not used as part of another library. I’m using CUDA 9.0.
Eigen probably needs to be updated for the issue you have here.
In the meantime, one possible suggestion is to put your Eigen code in C/C++ files only, ending in .cpp Put your CUDA code in files ending in .cu Use wrapper functions or whatever else is necessary to tie the two together.
Part of the cuda code that I intended to write would have each thread use Eigen to perform some of the linear algebra operations (matrix inversion and matrix multiplications) that are needed by the FEM at the element level. The matrices each thread would have to work with are like 10*10.
In the meantime, I’ve been trying to write a serial version that doesn’t use Eigen. Is there another simple linear algebra library that would not conflict with cuda?
Another alternative that I have in mind is to precompute all the matrix inverses on the CPU and send them to the GPU who will do the matrix multiplications element by element.
I wrote an Eigen-free version of my serial code. I’m going to review cuda a little more in depth and adjust my serial code before trying to parallelize it. So I haven’t really fixed that bug, sorry.
Eigen has already been updated for CUDA 9, there just hasn’t been an official release since then. Just grab the latest code form the repository that txbob referenced