2014-01-19 23 views
3

我已經安裝了pyopencl。當我嘗試:pyopencl errror:undefined symbol:clCreateSubDevices

python /home/a/pyopencl/examples/benchmark.py 

然後我有一個錯誤:

Traceback (most recent call last): 
File "/home/a/pyopencl/examples/benchmark.py", line 6, in <module> 
import pyopencl as cl 
File "/usr/local/lib/python2.7/dist-packages/pyopencl-2013.3-py2.7-linux- 
x86_64.egg/pyopencl/__init__.py", line 28, in <module> 
import pyopencl._cl as _cl 
ImportError: /usr/local/lib/python2.7/dist-packages/pyopencl-2013.3-py2.7-linux-  
x86_64.egg/pyopencl/_cl.so: undefined symbol: clCreateSubDevices 

我該如何解決呢?

TIA

Python 2.7.5+ (default, Sep 19 2013, 13:48:49) 
[GCC 4.8.1] on linux2 
Linux zalman 3.11.0-15-generiC#23-Ubuntu SMP Mon Dec 9 18:17:04 UTC 2013 x86_64 
x86_64 x86_64 GNU/Linux 
 
+------------------------------------------------------+      
| NVIDIA-SMI 4.304.88 Driver Version: 304.88   |      
|-------------------------------+----------------------+----------------------+ 
| GPU Name      | Bus-Id  Disp. | Volatile Uncorr. ECC | 
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage   | GPU-Util Compute M. | 
|===============================+======================+======================| 
| 0 GeForce GTX 770   | 0000:01:00.0  N/A |     N/A | 
| 25% 29C N/A  N/A/N/A | 7% 149MB/2047MB |  N/A  Default | 
+-------------------------------+----------------------+----------------------+ 

+-----------------------------------------------------------------------------+ 
| Compute processes:            GPU Memory | 
| GPU  PID Process name          Usage  | 
|=============================================================================| 
| 0   Not Supported            | 
+-----------------------------------------------------------------------------+ 
ls /etc/OpenCL/vendors 
nvidia.icd 



locate libOpenCL.so 


/etc/alternatives/x86_64-linux-gnu_libOpenCL.so 
/etc/alternatives/x86_64-linux-gnu_libOpenCL.so_lib32 
/usr/lib/libOpenCL.so 
/usr/lib/x86_64-linux-gnu/libOpenCL.so 
/usr/lib32/libOpenCL.so 

    nvcc --version 
    nvcc: NVIDIA (R) Cuda compiler driver 
    Copyright (c) 2005-2012 NVIDIA Corporation 
    Built on Fri_Sep_21_17:28:58_PDT_2012 
    Cuda compilation tools, release 5.0, V0.2.1221 

回答

2

clCreateSubDevices在OCL 1.2中引入的。上次我檢查NVIDIA仍然不支持OCL 1.2。也許它最近改變了...更好的檢查。

您可以使用class pyopencl.Device來查詢哪個版本的OCL可供您使用。文檔here

1

發現該解決方案張貼在pyopencl他本人:

解決方法:添加

CL_PRETEND_VERSION = 「1.1」

到siteconf.py。

問題:如果你給PyOpenCL標題爲CL 1.2,然後編譯 針對ICD裝載機沒有實現1.2功能(例如 clCreateSubDevice),那麼你得到這個破損。上面的修復表明, 迫使PyOpenCL忽略1.2。

安德烈亞斯

http://comments.gmane.org/gmane.comp.python.opencl/1328

但現在我已經得到了另一個錯誤,以及:

File "/usr/local/lib/python2.7/dist-packages/pytools-2014.3.5-py2.7.egg/pytools/__init__.py", line 5, in <module> 
from six.moves import range, zip, intern, input 
ImportError: cannot import name intern 
+2

如果有人絆倒在這一點,也想知道在哪裏可以找到siteconf.py。您必須從github獲得pyopencl源代碼(clone [pyopencl](https://github.com/pyopencl/pyopencl)),然後在資源庫中運行'python configure.py'並創建一個'siteconf.py' 。編輯完成後,您可以運行'pip install .'來安裝它。 'ImportError'是由於過時版本爲6,並且可以通過更新它'pip install --upgrade six'來修復。 – swenzel