【问题标题】:Theano for Keras: Failed to compile cuda_ndarray.cu: libcublas.so.7.5: cannot open shared object file: No such file or directoryKeras 的 Theano:无法编译 cuda_ndarray.cu:libcublas.so.7.5:无法打开共享对象文件:没有这样的文件或目录
【发布时间】:2017-10-26 15:23:29
【问题描述】:

我正在尝试在虚拟环境中使用带有 Theano 后端的 Keras。我得到的错误是:

错误(theano.sandbox.cuda):编译cuda_ndarray.cu失败:libcublas.so.7.5:无法打开共享对象文件:没有这样的文件或目录

此处显示:

(hyperproj) $ python
>> import theano
ERROR (theano.sandbox.cuda): Failed to compile cuda_ndarray.cu: libcublas.so.7.5: cannot open shared object file: No such file or directory

WARNING (theano.sandbox.cuda): The cuda backend is deprecated and will be removed in the next release (v0.10).  Please switch to the gpuarray backend. You can get more information about how to switch at this URL:
 https://github.com/Theano/Theano/wiki/Converting-to-the-new-gpu-back-end%28gpuarray%29

WARNING (theano.sandbox.cuda): CUDA is installed, but device gpu0 is not available  (error: cuda unavailable)

这是我到目前为止所做的:

$ screen
$ conda create -n hyperproj python=2.7 anaconda
$ source activate hyperproj
(hyperproj) $ conda install numpy
(hyperproj) $ conda install keras
(hyperproj) $ conda install theano
(hyperproj) $ cd $HOME
(hyperproj) $ cd .keras/
(hyperproj) $ vim keras.json

这就是keras.json现在的样子(我把tensorflow后端改成了theano后端):

{
    "image_dim_ordering": "th",
    "epsilon": 1e-07,
    "floatx": "float32",
    "backend": "theano"
}

我需要修改(或创建)我的 .theanorc 文件:

(hyperproj) $ vim ~/.theanorc

经过几次教程,看起来是这样的:

[global]
floatX=float32
device=gpu0

[nvcc]
fastmath=True

[cuda]
root = /usr/local/cuda-7.5

有人说我可能需要检查我的 .bashrc 文件并修改我的 $PATH。这是现在的样子(例如,在this 之后):

# Added by Canopy installer on 2016-06-20
# VIRTUAL_ENV_DISABLE_PROMPT can be set to '' to make bashprompt show that Canopy is active, otherwise 1
VIRTUAL_ENV_DISABLE_PROMPT=1 source /mnt/data/user/pkgs/enthought/canopy-1.5.1/bin/activate

# added by Anaconda2 2.5.0 installer
export PATH="/export/mlrg/user/anaconda2/bin:$PATH"

# added by Anaconda2 4.1.1 installer
export PATH="/mnt/data/user/pkgs/anaconda2/bin:$PATH"

#added to fix the theano libcudnn issue
export PATH=/usr/local/cuda/bin:/usr/local/cuda/lib64:$PATH
export LD_LIBRARY_PATH="/usr/local/cuda/lib64/:$LD_LIBRARY_PATH

我有 CUDA 7.5、Ubuntu 14.04、g++ 版本 4.8.4。

我该如何解决这个错误?

【问题讨论】:

    标签: python keras theano theano-cuda


    【解决方案1】:

    奇怪的是,通过注销并重新登录解决了问题。当我登录时,我这样做了:

    $ screen
    $ source activate hyperproj
    (hyperproj) $ which nvcc #gave me /usr/local/cuda/bin/nvcc
    (hyperproj) $ cd /usr/local/cuda/lib64 #checked that I have libcublas.so
    (hyperproj) $ cd $HOME
    (hyperproj) $ python
    Python 2.7.13 |Anaconda custom (64-bit)| (default, Dec 20 2016, 23:09:15) 
    [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    Anaconda is brought to you by Continuum Analytics.
    Please check out: http://continuum.io/thanks and https://anaconda.org
    >>> import keras
    Using Theano backend.
    WARNING (theano.sandbox.cuda): The cuda backend is deprecated and will be removed in the next release (v0.10).  Please switch to the gpuarray backend. You can get more information about how to switch at this URL:
     https://github.com/Theano/Theano/wiki/Converting-to-the-new-gpu-back-end%28gpuarray%29
    
    Using gpu device 0: GeForce GTX TITAN Black (CNMeM is disabled, cuDNN not available)
    

    【讨论】:

      猜你喜欢
      • 2016-07-09
      • 1970-01-01
      • 1970-01-01
      • 2015-04-12
      • 2018-11-26
      • 2019-11-27
      • 2020-02-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多