Hello everyone,
I'm currently thinking of adopting the Python-opencl package on the Arch
Linux community repositories. I noticed that there are no tarball
signatures or signed tags for the sources.
Is this intentional? I'd be more than convenient security-wise to have a
(or a set) key that I could trust when building the package :)
Thanks!
-Santiago
On Wed, 14 Nov 2018 16:30:15 -0200
V Amo BTS <gisele.lima.camargo(a)gmail.com> wrote:
> Hello to all,
>
> I got an import error after installing nvidia toolkit and cuda, using
> spyder:
>
>
> *ImportError: /usr/local/cuda-10.0/targets/x86_64-linux/lib/libOpenCL.so.1:
> version `OPENCL_2.1' not found (required by
> /usr/lib/python3/dist-packages/pyopencl/_cffi.abi3.so
> <http://cffi.abi3.so>)*
>
> Spyder 4.0.0b1
>
> *Python 3.6.6 64bits, Qt 5.9.3, PyQt5 5.9.2 on Linux *
>
>
> Since I have no experience installing these programs. Can anyone help me,
> please?
Hi all,
I guess this is related to the version 1.2 of the libopencl from CUDA.
Probably your system provides a libOpenCL version 2.1 and pyopencl has
been installed to use it.
Recently, you installed cuda which changes the order library are
chosen (probably using the LD_LIBRARY_PATH) and the one from cuda gets
selected, but it is less advanced then the one from your system.
There is a simple "solution": try to move away the one from cuda and check if it fixes the issue, like:
```
sudo mv /usr/local/cuda-10.0/targets/x86_64-linux/lib/libOpenCL.so.1 /usr/local/cuda-10.0/targets/x86_64-linux/lib/libOpenCL.so_from_cuda_do_not_use
```
and check if it works.
Cheers,
--
Jérôme Kieffer
Dear Gisele,
> Le 14 nov. 2018 à 19:30, V Amo BTS <gisele.lima.camargo(a)gmail.com> a écrit :
> I got an import error after installing nvidia toolkit and cuda, using spyder:
>
> ImportError: /usr/local/cuda-10.0/targets/x86_64-linux/lib/libOpenCL.so.1: version `OPENCL_2.1' not found (required by /usr/lib/python3/dist-packages/pyopencl/_cffi.abi3.so <http://cffi.abi3.so/>)
>
> Spyder 4.0.0b1
> Python 3.6.6 64bits, Qt 5.9.3, PyQt5 5.9.2 on Linux
>
> Since I have no experience installing these programs. Can anyone help me, please?
This probably means that you have OpenCL headers advertising version 2.1, but a CUDA driver which only supports 1.2.
What Linux version are you using ?
What is the source for the CUDA 10 installation ?
What are the OpenCL packages installed ?
See a bug report (now closed) from a few months ago:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=889287 <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=889287>
Best wishes,
—
Vincent Favre-Nicolin
Hello to all,
I got an import error after installing nvidia toolkit and cuda, using
spyder:
*ImportError: /usr/local/cuda-10.0/targets/x86_64-linux/lib/libOpenCL.so.1:
version `OPENCL_2.1' not found (required by
/usr/lib/python3/dist-packages/pyopencl/_cffi.abi3.so
<http://cffi.abi3.so>)*
Spyder 4.0.0b1
*Python 3.6.6 64bits, Qt 5.9.3, PyQt5 5.9.2 on Linux *
Since I have no experience installing these programs. Can anyone help me,
please?
Thank you,
Gisele Camargo
First, the cl_khr_fp16 extension is supported and has been enabled on the device Intel GPU.
When I run the code as follows on the device 'Intel(R) HD Graphics', which uses 16-bit half-precision float instead of 32-bit float, it gets the error : loading directly from pointer to type 'const __global half' is not allowed.
But the device 'Intel(R) HD Graphics' supports half data types for OpenCL.
'''
Build on <pyopencl.Device 'Intel(R) HD Graphics' on 'Intel(R) OpenCL' at 0x1cd1a10>:
1:6:16: error: loading directly from pointer to type 'const __global half' is not allowed
res_g[gid] = a_g[gid] + b_g[gid];
^
(options: -I /usr/lib/python3/dist-packages/pyopencl/cl)
'''
How can I fixed the code?
'''
from future import absolute_import, print_function
import numpy as np
import pyopencl as cl
a_np = np.random.rand(50000).astype(np.float16)
b_np = np.random.rand(50000).astype(np.float16)
ctx = cl.create_some_context()
queue = cl.CommandQueue(ctx) # Create a command queue with your context
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 half *a_g, __global const half *b_g, __global half *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)
print(res_np)
print(res_np - (a_np + b_np))
print(np.linalg.norm(res_np - (a_np + b_np)))
'''
Finally, how can it correct my code?
Hi Andreas,
I think I found a small quirk when doing data copies involving rectangular subareas.
Documentation of enqueue_copy states that the arguments buffer_pitches/host_pitches and src_/dst_pitches are optional, however an error is raised if they are omitted:
TypeError: _enqueue_read_buffer_rect(): incompatible function arguments.
It seems pybind11 checks if the arguments are a sequence, but this fails with None as default value, as defined here:
https://github.com/inducer/pyopencl/blob/1e850da761797c70aa0b2580845585c240…
I checked that replacing the default arguments by an empty tuple, replacing py::none() by py::tuple() resolves this issue.
Also just filed an issue, https://github.com/inducer/pyopencl/issues/253
best
Gregor