pycuda --“未设置 CUDA_ROOT,并且 nvcc 不在路径中。”

发布于 2024-12-19 11:48:55 字数 198 浏览 1 评论 0原文

虽然我已经安装了 pycuda 并使用它,但它开始(不做某事)不起作用。所以,我尝试再次安装,但是当我正在做的时候

python configure.py --cuda-root=/usr/local/cuda/bin

它给了我标题中的错误。

nvcc 文件位于上述目录中。

Although i had installed pycuda and using it ok,it started (without doing sth) not to work.So,i i tried to do the install again ,but when i am doing

python configure.py --cuda-root=/usr/local/cuda/bin

it gives me the error in the title.

The nvcc file is in the above directory.

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

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

发布评论

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

评论(3

橙味迷妹 2024-12-26 11:48:55

pycuda 没有找到 nvcc。您是否尝试将 /usr/local/cuda/bin 添加到您的 env PATH 变量中?这就是我的设置方式。

编辑:

据我所知,configure.py 不会调用 nvcc 编译器,它只是创建 makefile。我认为当您运行 sudo -c "make install" 调用 setup.py 时会发生此问题。

有几件事值得尝试。确保您已设置 CUDA_ROOT:

echo $CUDA_ROOT

如果它为空,请设置它:

export CUDA_ROOT=/usr/local/cuda/bin

尝试再次运行 make 命令。现在使用 -E 来保留您的环境:

sudo -E sh -c "make install"

pycuda is not finding nvcc. Did you try adding /usr/local/cuda/bin to your env PATH variable? That's the way I have this setup.

Edit:

As far as I can tell the configure.py doesn't call nvcc compiler it just creates the the makefile. I take that this problem happens when you run sudo -c "make install" which calls setup.py.

A couple of things to try. Make sure that you have CUDA_ROOT set:

echo $CUDA_ROOT

If it's empty, set it with:

export CUDA_ROOT=/usr/local/cuda/bin

Try running the make command again. Now with the -E to preserve your env:

sudo -E sh -c "make install"
眉目亦如画i 2024-12-26 11:48:55

我在 Slackware64 13.37 上遇到了同样的问题。

安装命令 su -c "make install" 切换到 root (0bv10u5Ly),因此应在 root 的配置文件中设置 CUDA_ROOTCUDA_ROOT 不是环境变量,它由 setup.py 使用。将 /usr/local/cuda/bin 添加到 PATH 并定义 CUDA_ROOT=/usr/local/cuda/bin 然后尝试再次安装。

这是一种快速而肮脏的方法,但如果上面的方法都不适合像我这样的你,那么下面的方法肯定会起作用。 (:

删除

nvcc_path = search_on_path(["nvcc", "nvcc.exe"])
if nvcc_path is None:
    print("*** CUDA_ROOT not set, and nvcc not in path. Giving up.")
    sys.exit(1)

并设置。然后尝试 su -c "make install"

cuda_root_default = "/usr/local/cuda/bin"

在 setup.py 文件中

I encountered the same issue on a Slackware64 13.37.

Install command su -c "make install" switches to root (0bv10u5Ly) thus CUDA_ROOT should be set in the root's profile. CUDA_ROOT is not an environment variable, it's used by the setup.py. Add /usr/local/cuda/bin to PATH and define CUDA_ROOT=/usr/local/cuda/bin then try to install again.

This is the quick and dirty way but if none of above worked out for you like me, below will definitely work. (:

Remove

nvcc_path = search_on_path(["nvcc", "nvcc.exe"])
if nvcc_path is None:
    print("*** CUDA_ROOT not set, and nvcc not in path. Giving up.")
    sys.exit(1)

and set

cuda_root_default = "/usr/local/cuda/bin"

in setup.py file. Then try su -c "make install".

A君 2024-12-26 11:48:55

就我而言,我必须设置 CUDA_ROOT=/usr/local/cuda 因为使用 /usr/local/cuda/bin 路径,无法找到包含文件夹并且它因错误而失败,找不到 cuda.h。

In my case, I had to set CUDA_ROOT=/usr/local/cuda because with /usr/local/cuda/bin path, it was not able find include folder and it was failing with error didn't find cuda.h.

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