Answer the question
In order to leave comments, you need to log in
Error when starting PyOpenCL - what to do?
I installed OpenCL, PyOpenCL, AMD APP SDK on Ubuntu, all dependencies - in theory, it should work.
I'm running a test case from here :
import numpy as np
import pyopencl as cl
a_np = np.random.rand(50000).astype(np.float32)
b_np = np.random.rand(50000).astype(np.float32)
ctx = cl.create_some_context()
queue = cl.CommandQueue(ctx)
mf = cl.mem_flags
a_g = cl.Buffer(ctx, mf.READ_ONLY | mf.COPY_HOST_PTR, hostbuf=a_np)
b_g = cl.Buffer(ctx, mf.READ_ONLY | mf.COPY_HOST_PTR, hostbuf=b_np)
prg = cl.Program(ctx, """
__kernel void sum(__global const float *a_g, __global const float *b_g, __global float *res_g) {
int gid = get_global_id(0);
res_g[gid] = a_g[gid] + b_g[gid];
}
""").build()
res_g = cl.Buffer(ctx, mf.WRITE_ONLY, a_np.nbytes)
prg.sum(queue, a_np.shape, None, a_g, b_g, res_g)
res_np = np.empty_like(a_np)
cl.enqueue_copy(queue, res_np, res_g)
# Check on CPU with Numpy:
print(res_np - (a_np + b_np))
print(np.linalg.norm(res_np - (a_np + b_np)))
Traceback (most recent call last):
File "test.py", line 10, in <module>
ctx = cl.create_some_context()
File "/usr/lib/python2.7/dist-packages/pyopencl/__init__.py", line 767, in create_some_context
platforms = get_platforms()
pyopencl.LogicError: clGetPlatformIDs failed: platform not found khr
sudo apt-get -f install
to satisfy lost dependenciessudo apt-get install linux-headers-generic fglrx fglrx-amdcccle
to install the AMD driver from the turnip, since the driver from the site did not get up, apparently due to disagreements with the fglrx versionsudo apt-get install python-pyopencl
Answer the question
In order to leave comments, you need to log in
The problem may be that your OpenCL is not hooked, for example. Does the video card support it?
The easiest way to check is to install darktable (it should pull up from the repositories without problems) and run "sudo darktable -d opencl". If there are no errors, then the problem is still somewhere in Python. There will also be information about all devices that support OpenCL. If he swears at something, OpenCL is probably not hooked.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question