我已经安装了pyopencl。当我尝试:
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
答案 0 :(得分:2)
clCreateSubDevices是在OCL 1.2中引入的。上次我检查NVIDIA仍然不支持OCL 1.2。也许它最近改变了......更好的检查。
您可以使用class pyopencl.Device
来查询可用的OCL版本。文档here。
答案 1 :(得分:1)
发现这个解决方案由pyopencl男子自己发布:
解决方案:添加
CL_PRETEND_VERSION =“1.1”
到siteconf.py。
问题:如果为CL 1.2提供PyOpenCL标头,然后进行编译 针对没有实现1.2功能的ICD加载器(例如 clCreateSubDevice),然后你得到这个破损。以上修正了 通过强制PyOpenCL忽略1.2。
Andreas
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