通过“easy_install”安装时,PyOpenCL 找不到包含文件。

发布于 2024-11-15 19:50:54 字数 570 浏览 8 评论 0原文

所以我已经下载了 nVidia CUDA 库并将它们放在默认位置:

/usr/local/cuda

当我去运行这个时:

sudo easy_install pyopencl

它给了我这个错误:

In file included from src/wrapper/wrap_cl.cpp:1:0:
src/wrapper/wrap_cl.hpp:20:19: fatal error: CL/cl.h: No such file or directory

但是,我可以验证上述文件确实是否存在与其他几个头文件:

/usr/local/cuda/include/CL/cl.h

我什至尝试设置 LD_LIBRATH_PATH:

export LD_LIBRARY_PATH=/usr/local/cuda/lib

但它似乎没有任何效果。

任何帮助表示赞赏!

so I've downloaded the nVidia CUDA libraries and put them in the default location:

/usr/local/cuda

When I go to run this:

sudo easy_install pyopencl

It gives me this error:

In file included from src/wrapper/wrap_cl.cpp:1:0:
src/wrapper/wrap_cl.hpp:20:19: fatal error: CL/cl.h: No such file or directory

I can, however, verify that the above file does exist along with several other header files:

/usr/local/cuda/include/CL/cl.h

I've even tried setting the LD_LIBRATH_PATH:

export LD_LIBRARY_PATH=/usr/local/cuda/lib

But it doesn't seem to have any effect.

Any help is appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笑梦风尘 2024-11-22 19:50:54

您的编译器的包含路径可能不包含/usr/local/cuda/include/。环境变量 LD_LIBRARY_PATH 实际上是告诉编译器/运行时环境在哪里可以找到共享对象文件。有两种方法(已知)可以解决此问题:

1)大多数编译器接受一个标志,该标志指定添加到包含路径中;对于 gcc,它是 -I,因此

gcc -I /usr/local/cuda/include [code files, more options, etc]

将告诉 gcc 除了系统包含路径之外,还在 /usr/local/cuda/include 中查找包含内容

2) 将 OpenCL 头文件链接到系统包含路径(通常为 /usr/include /)。
像这样的东西:

# ln -s /usr/local/cuda/include/CL CL

从目录 /usr/include 中执行应该可以工作。

如果解决此问题后,您遇到如下问题:

/usr/bin/ld: cannot find -lOpenCL

那么您可能需要查看 这个问题

Your compiler's include path probably doesn't include /usr/local/cuda/include/. The environment variable LD_LIBRARY_PATH is actually there to tell the compiler/runtime environment where to find shared object files. There are two ways (that know of) to fix this:

1) Most compilers accept a flag that specifies an addition to the include path; for gcc, it's -I, so

gcc -I /usr/local/cuda/include [code files, more options, etc]

will tell gcc to look for includes in /usr/local/cuda/include, in addition to the system include path

2) Link the OpenCL header files into your system include path (usually /usr/include/).
Something like:

# ln -s /usr/local/cuda/include/CL CL

executed from within the directory /usr/include should work.

If after fixing this problem, you have a problem like the following:

/usr/bin/ld: cannot find -lOpenCL

then you might want to look at this question.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文