3

I have installed pyopencl. When I try :

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

then I have an error :

 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

How can I solve it ?

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 Answers 2

2

clCreateSubDevices was introduced in OCL 1.2. Last time I've check NVIDIA was still not supporting OCL 1.2. Maybe it changed lately... better check.

You can use the class pyopencl.Device to query which version of OCL is available to you. Documentation here.

1

found this solution posted by the pyopencl man himself:

Solution: Add

CL_PRETEND_VERSION = "1.1"

to siteconf.py.

Problem: If you feed PyOpenCL headers for CL 1.2 and then compile against an ICD loader that doesn't implement 1.2 functions (e.g. clCreateSubDevice), then you get this breakage. The above fixes that, by forcing PyOpenCL to ignore 1.2.

Andreas

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

But now I've got another error as well:

  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
1
  • 3
    If someone stumbles upon this and also wonders where to find siteconf.py. You have to get the pyopencl source (clone pyopencl from github), then run python configure.py in the repository and a siteconf.py will be created. After editing it you can run pip install . to install it. The ImportError is due to an outdated version of six, and can be fixed simply by updating it pip install --upgrade six.
    – swenzel
    Jun 12, 2015 at 8:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.