繁体   English   中英

pycuda失败; Theano和Anaconda

[英]pycuda fail; Theano with Anaconda

我正在使用Anaconda在MacOSX(Mavericks 10.9)上安装Theano,就像这篇文章解释的那样:“ 如何使Theano在Mac Lion上运行?

theano.test()

该命令给出与上述文章相同的错误。 它也会在Ubuntu 14.1和System 76上出现该错误。

我能够从Theano导入命令; 但我仍然想了解theano.test()为何失败。 在运行之前已经安装了CUDA和Boost软件包。

(参考:请参见“ 测试安装 ”一节: http://deeplearning.net/software/theano/install.html

正如文章所暗示的那样,我认为此修复程序将来自安装XCode命令行,自制程序和pycuda。 前两个安装得很好。 但是pycuda失败了:

pip安装pycuda

....给出以下错误:

    > src/cpp/cuda.cpp -o build/temp.macosx-10.5-x86_64-3.4/src/cpp/cuda.o
    >     In file included from src/cpp/cuda.cpp:1:

> 
>     src/cpp/cuda.hpp:14:10: fatal error: 'cuda.h' file not found
>     #include <cuda.h>

>              ^
>     1 error generated.
>     error: command 'gcc' failed with exit status 1
>  


    >    Command "//anaconda/bin/python3 -c "import setuptools,

    >tokenize;__file__='/private/var/folders/5b/5g1stsns34x_7mgynxhhvf1h0000gn/T/pip-build-4raihcb4/pycuda/setup.py';exec(compile(getattr(tokenize,
    > 'open', open)(__file__).read().replace('\r\n', '\n'), __file__,
    > 'exec'))" install --record
    > /var/folders/5b/5g1stsns34x_7mgynxhhvf1h0000gn/T/pip-kr_3ws22-record/install-record.txt



    >> --single-version-externally-managed --compile" failed with error code 1 in

    > /private/var/folders/5b/5g1stsns34x_7mgynxhhvf1h0000gn/T/pip-build-4raihcb4/pycuda

似乎第一个错误(gcc失败)是编译器未找到gcc。 (再次注意:我安装了MacOSX命令行工具)

我跑

which gcc 

这给出了usr / bin / gcc

我也尝试过:

python configure.py --cuda-root=/usr/local/cuda
--cuda-inc-dir=/Developer/NVIDIA/CUDA-5.5/include --cudart-lib-dir=/Developer/NVIDIA/CUDA-5.5/lib

那也没有用。

有没有其他人在安装pycuda时遇到困难,可以在这里提出建议? 谢谢。

第一个错误并不表示找不到gcc ,而是表示gcc报告了一个错误,该错误是找不到文件cuda.h

该错误表明您未安装CUDA工具包。 您需要先安装此软件,然后才能安装PyCUDA。 CUDA工具包可从NVIDIA网站下载

PyCUDA网页表明它具有以下先决条件:BOOST,CUDA和Numpy。

我通过结合以下两种方法解决了同一问题:

  1. 确保nvcc在您的PATH似乎可以解决编译错误。 如果然后遇到以下链接错误:

    ld: file not found: @rpath/CUDA.framework/Versions/A/CUDA for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

  2. 我修复了将libcuda.dylib中的@rpath引用更改为绝对路径的问题:
    install_name_tool -change @rpath/CUDA.framework/Versions/A/CUDA \\ /Library/Frameworks/CUDA.framework/CUDA \\ /usr/local/cuda/lib/libcuda.dylib

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM