gpt4 book ai didi

c++ - 将 CUDA 与 Eigen 一起使用时找不到 math_functions.hpp

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:25:39 45 4
gpt4 key购买 nike

我有一些严重依赖 Eigen 的代码。我想用 CUDA 优化它,但是当我编译时我得到:

[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

我认为 math_functions.hpp 是来自 CUDA 的文件。谁能帮我弄清楚为什么 nvcc 找不到它?

编辑:我使用的是 CUDA 5.5 和 Eigen 3.3,除了链接 Eigen 和 fftw3 库之外,我没有使用任何其他标志(正如您从我的代码中看到的那样)。

最佳答案

我在使用 Cuda 9.1 构建 TensorFlow 1.4.1 时遇到了这个问题,奇怪的是 math_functions.hpp 只存在于 include/crt 中。

创建从 cuda/include/math_functions.hppcuda/include/crt/math_functions.hpp 的符号链接(symbolic link)解决了这个问题:

ln -s /usr/local/cuda/include/crt/math_functions.hpp /usr/local/cuda/include/math_functions.hpp

关于c++ - 将 CUDA 与 Eigen 一起使用时找不到 math_functions.hpp,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43113508/

45 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com