2017-04-23 37 views
0

我試圖運行this script測試Theano的使用我的GPU,並出現以下錯誤:加載庫gpuarray與Theano

ERROR (theano.gpuarray): Could not initialize pygpu, support disabled 
Traceback (most recent call last): 
    File "/home/me/anaconda3/envs/py35/lib/python3.5/site- 
packages/theano/gpuarray/__init__.py", line 164, in <module> 
    use(config.device) 
    File "/home/me/anaconda3/envs/py35/lib/python3.5/site- 
packages/theano/gpuarray/__init__.py", line 151, in use 
    init_dev(device) 
    File "/home/me/anaconda3/envs/py35/lib/python3.5/site- 
packages/theano/gpuarray/__init__.py", line 60, in init_dev 
    sched=config.gpuarray.sched) 
    File "pygpu/gpuarray.pyx", line 614, in pygpu.gpuarray.init 
(pygpu/gpuarray.c:9419) 
    File "pygpu/gpuarray.pyx", line 566, in pygpu.gpuarray.pygpu_init 
(pygpu/gpuarray.c:9110) 
    File "pygpu/gpuarray.pyx", line 1021, in 
    pygpu.gpuarray.GpuContext.__cinit__ (pygpu/gpuarray.c:13472) 
pygpu.gpuarray.GpuArrayException: Error loading library: -1 

我需要使用nvidia-381驅動程序,因爲我的GPU是1080 Ti和與nvidia-375不兼容。我不確定是否重要,但安裝nvcc會覆蓋381,如果我在設置nvcc後重新安裝381,導致一些錯誤,所以我不能使用nvcc

我可以導入pygpu沒有錯誤,但如果我跑pygpu.test()我碰到下面的錯誤,我不知道如何在不nvcc指定DEVICE變量。

====================================================================== 
ERROR: Failure: RuntimeError (No test device specified. Specify one using the DEVICE or GPUARRAY_TEST_DEVICE environment variables.) 
---------------------------------------------------------------------- 
Traceback (most recent call last): 
    File "/home/me/anaconda3/envs/py35/lib/python3.5/site-packages/nose/failure.py", line 39, in runTest 
    raise self.exc_val.with_traceback(self.tb) 
    File "/home/me/anaconda3/envs/py35/lib/python3.5/site-packages/nose/loader.py", line 418, in loadTestsFromName 
    addr.filename, addr.module) 
    File "/home/me/anaconda3/envs/py35/lib/python3.5/site-packages/nose/importer.py", line 47, in importFromPath 
    return self.importFromDir(dir_path, fqname) 
    File "/home/me/anaconda3/envs/py35/lib/python3.5/site-packages/nose/importer.py", line 94, in importFromDir 
    mod = load_module(part_fqname, fh, filename, desc) 
    File "/home/me/anaconda3/envs/py35/lib/python3.5/imp.py", line 234, in load_module 
    return load_source(name, filename, file) 
    File "/home/me/anaconda3/envs/py35/lib/python3.5/imp.py", line 172, in load_source 
    module = _load(spec) 
    File "<frozen importlib._bootstrap>", line 693, in _load 
    File "<frozen importlib._bootstrap>", line 673, in _load_unlocked 
    File "<frozen importlib._bootstrap_external>", line 665, in exec_module 
    File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed 
    File "/home/me/.local/lib/python3.5/site-packages/pygpu-0.6.2-py3.5-linux-x86_64.egg/pygpu/tests/test_tools.py", line 5, in <module> 
    from .support import (guard_devsup, rand, check_flags, check_meta, check_all, 
    File "/home/me/.local/lib/python3.5/site-packages/pygpu-0.6.2-py3.5-linux-x86_64.egg/pygpu/tests/support.py", line 32, in <module> 
    context = gpuarray.init(get_env_dev()) 
    File "/home/me/.local/lib/python3.5/site-packages/pygpu-0.6.2-py3.5-linux-x86_64.egg/pygpu/tests/support.py", line 29, in get_env_dev 
    raise RuntimeError("No test device specified. Specify one using the DEVICE or GPUARRAY_TEST_DEVICE environment variables.") 
RuntimeError: No test device specified. Specify one using the DEVICE or GPUARRAY_TEST_DEVICE environment variables. 

---------------------------------------------------------------------- 
Ran 7 tests in 0.003s 

FAILED (errors=7) 
<nose.result.TextTestResult run=7 errors=7 failures=0> 
+0

發生這種情況時,可能是因爲pygpu無法找到正確版本的Cuda。我相信pygpu 0.6.2到0.6.4的版本看起來Cuda 7.5,而0.6.8以上的版本適用於Cuda 8。0 – Overdrivr

回答

2

警告:它完全有可能的,這是完全錯誤的,併爲您的問題的實際原因,其實是 - 當你懷疑 - 你的GPU驅動程序。


我有同樣的問題與gpuarray在Windows 10 最後我解決它通過:

  1. 完全卸載蟒蛇
  2. 安裝CUDA 8.0(含5.1 cudnn)
  3. 安裝anaconda
  4. 通過anaconda安裝theano:

    conda install theano pygpu 
    

當你使用Linux:此錯誤消息基本上意味着它沒有工作,不要問我爲什麼而且大多表示如果有事情和你的設置是錯誤的(例如用於編譯Python和theano,或不兼容CUDA版本)不同的編譯器

我會建議更新到CUDA 8.0及以上蟒蛇(以防萬一)

在一個側面說明重新安裝Python環境:我測試從實況和至少你的示例腳本是工作....


Windows用戶注意事項:切勿在您路徑中有空格......一切看起來都一個位置安裝蟒蛇罰款...直到theano開始無法找到和編譯薄GS。


關於pygpu.test()注:

通常你只要設置環境變量:

windows: set DEVICE=cuda 
linux: export DEVICE=cuda 

測試有說你沒有指定,如果一個設備的習慣庫無法加載...

+0

這確實最終與我的司機有關。 'libcuda.so.1'不存在'nvidia-381',但是安裝'nvidia-378'讓我得到這個文件,並且與我的GPU保持兼容。感謝您花時間寫出這些內容! – Chris

+0

我打算讓它在那裏。 'pygpu.gpuarray.GpuArrayException沒有很多谷歌搜索結果:加載庫出錯:-1'也許有人在尋找解決方案恰好找到了這篇文章。 –

+0

對我有意義。它很可能解決了某人的問題。 – Chris