2017-05-25 103 views
0

我試圖在虛擬環境中使用Keras和Theano後端。我得到的錯誤是:Theano for Keras:無法編譯cuda_ndarray.cu:libcublas.so.7.5:無法打開共享對象文件:無此文件或目錄

ERROR(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版本。

如何解決該錯誤?

回答

0

奇怪的是,問題是通過註銷並重新登錄來解決的。當我登錄時,我這樣做了:

$ 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) 
相關問題