Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

math_functions.hpp not found when using CUDA with Eigen

Tags:

c++

cuda

eigen

I have some code that is heavily dependent on Eigen. I would like to optimize it with CUDA, but when I am compiling I get:

[tcai4@golubh4 Try1]$ nvcc conv_parallel.cu -I /home/tcai4/project-cse/Try1 -lfftw3 -o conv.o
In file included from Eigen/Dense:1,
             from Eigen/Eigen:1,
             from functions.h:8,
             from conv_parallel.cu:10:
Eigen/Core:44:34: error: math_functions.hpp: No such file or directory

I think math_functions.hpp is a file from CUDA. Can someone help me figure out why nvcc cannot find it?

edit: I am using CUDA 5.5 and Eigen 3.3, except from linking Eigen and fftw3 library, I did not use any other flags(as you can see from my code).

like image 273
Linda Cai Avatar asked Mar 30 '17 09:03

Linda Cai


2 Answers

I encountered this issue while building TensorFlow 1.4.1 with Cuda 9.1, and strangely math_functions.hpp existed only in include/crt.

Creating a symlink from cuda/include/math_functions.hpp to cuda/include/crt/math_functions.hpp fixed the issue:

ln -s /usr/local/cuda/include/crt/math_functions.hpp /usr/local/cuda/include/math_functions.hpp
like image 157
lyomi Avatar answered Sep 30 '22 15:09

lyomi


The reason nvcc cannot find the file in question is because that file is part of the CUDA Math library, which was introduced in CUDA 6. Your almost 4 year old version of CUDA predates the release of the Math library. Your CUDA version doesn't contain said file.

You should, therefore, assume that what you are trying to do cannot work without first updating to a newer version of the CUDA toolkit.

like image 37
2 revs Avatar answered Sep 30 '22 15:09

2 revs