create Event from cl_event
by Gregor Thalhammer
Dear Andreas,
I am currently working on a cython based wrapper for the OpenCL FFT library from AMD: https://github.com/geggo/gpyfft
For this I need to create a pyopencl Event instance from a cl_event returned by the library. I attached a patch against recent pyopencl that adds this possibility, similar to the from_cl_mem_as_int() method of the MemoryObject class. Could you please add this to pyopencl.
Thanks for your help
Gregor
6 years, 4 months
Array.base_data vs Array.buffer
by Andreas Kloeckner
Hi all,
I'm having some second thoughts on the name
Array.base_data
that was introduced in 2013.1. It gives access to the buffer that backs
a PyOpenCL array. I introduced this because of I added Array.offset,
which permits arrays to start at an offset from their backing buffer,
with the idea that Array.data, which previously served this purpose,
would fail if offset != 0. Array.base_data always returns the buffer,
and the user must then take care to also inspect offset and add it if
needed.
I'm now wondering whether
Array.buffer
would have been a better name, to keep the proposed GPU buffer interface
somewhat sane:
https://gpu-buffer-interface.readthedocs.org/en/latest/spec.html
The 'base_data' name does OK in reminding the user that there might be
something else needed on besides looking in 'data' to get the Array's
data, so it's not all bad. I'm a bit torn. We could also keep both
names, but I'm not sure I like that. ('base_data' would be deprecated
gently, so no need to worry.)
Opinions?
Andreas
6 years, 4 months
cumulative sum in pyopencl
by Alex Nitz
I am having some difficulties with the cumulative sum operation in
pyopencl. It appears that it is using a bit too much shared memory for the
devices I want to run on (gtx 580 and tesla M2090). I get the following
error.
File "<string>", line 2, in get_cumsum_kernel
File
"/home/ahnitz/local/pycl/lib64/python2.6/site-packages/pyopencl-2013.2-py2.6-linux-x86_64.egg/pyopencl/tools.py",
line 114, in first_arg_dependent_memoize
result = func(cl_object, *args)
File
"/home/ahnitz/src/pc10/pycbc/build/lib.linux-x86_64-2.6/pycbc/types/array_opencl.py",
line 129, in get_cumsum_kernel
neutral="0", preamble=complex_headers)
File
"/home/ahnitz/local/pycl/lib64/python2.6/site-packages/pyopencl-2013.2-py2.6-linux-x86_64.egg/pyopencl/scan.py",
line 1509, in __init__
options=options, preamble=preamble, devices=devices)
File
"/home/ahnitz/local/pycl/lib64/python2.6/site-packages/pyopencl-2013.2-py2.6-linux-x86_64.egg/pyopencl/scan.py",
line 1031, in __init__
self.finish_setup()
File
"/home/ahnitz/local/pycl/lib64/python2.6/site-packages/pyopencl-2013.2-py2.6-linux-x86_64.egg/pyopencl/scan.py",
line 1112, in finish_setup
k_group_size=k_group_size)
File
"/home/ahnitz/local/pycl/lib64/python2.6/site-packages/pyopencl-2013.2-py2.6-linux-x86_64.egg/pyopencl/scan.py",
line 1250, in build_scan_kernel
prg = cl.Program(self.context, scan_src).build(self.options)
File
"/home/ahnitz/local/pycl/lib64/python2.6/site-packages/pyopencl-2013.2-py2.6-linux-x86_64.egg/pyopencl/__init__.py",
line 176, in build
options=options, source=self._source)
File
"/home/ahnitz/local/pycl/lib64/python2.6/site-packages/pyopencl-2013.2-py2.6-linux-x86_64.egg/pyopencl/__init__.py",
line 216, in _build_and_catch_errors
raise err
RuntimeError: clBuildProgram failed: invalid binary -
Build on <pyopencl.Device 'GeForce GTX 580' on 'NVIDIA CUDA' at 0x1a7a360>:
ptxas error : Entry function 'scan_scan_intervals' uses too much shared
data (0xcccc bytes, 0xc000 max)
(options: -I
/home/ahnitz/local/pycl/lib64/python2.6/site-packages/pyopencl-2013.2-py2.6-linux-x86_64.egg/pyopencl/cl)
(source saved as /usr1/ahnitz/tmpEGfj6x.cl)
Has anyone else noticed this? I might try to figure out a fix, unless
someone more experienced wants to take a look. This is not an issue for
single precision float operations, but for double and complex types.
The generated kernel source is also attached (it is quite long).
6 years, 4 months
Re: [PyOpenCL] __getitem__ for pyopencl array
by Andreas Kloeckner
Alex Nitz <alex.nitz(a)ligo.org> writes:
> Thanks Andreas,
>
> This is working quite nicely for me, and seems to work fine with my
> elementwise stuff!
>
> As I am also looking to use the reduction kernel class, I took a stab at
> adding in offset support there, using your elementwise changes as a
> template.
Applied with a test and minor fixes, thanks!
> On a separate note, it seems that the 'copy' kernel fails to copy between
> mixed complex precisions. I've attached a short patch that simply adds the
> needed typecast for this case.
Also applied, thanks!
Andreas
6 years, 4 months
Re: [PyOpenCL] __getitem__ for pyopencl array
by Andreas Kloeckner
Hi Alex,
Alex Nitz <alex.nitz(a)ligo.org> writes:
> I am mostly a pycuda user, but am investigating trying to use some of my
> codes with pyopencl. My codes make heavy use of the numpy-like array. I
> noticed that there doesn't seem to yet be a "__getitem__" function yet
> defined, although the buffer objects themselves have one.
>
> My needs are basically met by the version that is in pycuda, so I have
> created a short patch to add the same behavior to pyopencl. It is fairly
> limited in that it only supports 1-dimensional, non-strided slices. Is a
> more comprehensive functionality already in the works? If not, would it be
> possible to get this patch applied?
First of all, thanks for your contribution! I'm a bit hesitant to apply
this patch, because sub-buffers (which your patch implicitly uses, see
clCreateSubBuffer in the CL spec) are allowed to have alignment
requirements that make this routine fail. The better way to implement
this is to use the original buffer and store an offset to the intended
beginning of the data. I'll introduce this after the 2013.1 release,
which is due soon. (as soon as I sort out the current Mac trouble)
Andreas
6 years, 4 months
Re: [PyOpenCL] Windows 8 and PyOpenCL missing pytools
by Andreas Kloeckner
"=?UTF-8?Q?marcus.desto?=" <marcus.desto(a)o2.pl> writes:
> in the debug file in the attachment you will find the debug of the simple import pyopencl command
Try renaming .pyd to .dll. That's what the Python interpreter is looking
for.
Andreas
6 years, 4 months
★ Pyopencl, Rene Bon Ciric te ha dejado un mensaje
by Badoo
Rene Bon Ciric te ha dejado un mensaje
Este mensaje es personal. Sólo tú y su remitente tenéis acceso a él y te recordamos que lo puedes eliminar en cualquier momento. Si quieres responder puedes hacerlo desde el chat. Para leer tu mensaje, haz clic en el siguiente enlace:
http://us1.badoo.com/renich/in/bTdGnzcBUW4/?lang_id=7&g=57&m=21&mid=51e14...
Otras personas de tu zona están en Badoo
Marioo (Guadalajara, México)
Antonella (Guadalajara, México)
http://us1.badoo.com/renich/in/bTdGnzcBUW4/?lang_id=7&g=57&m=21&mid=51e14...
Si al hacer clic en el enlace de este mensaje no funciona, copia y pégalo en la barra de tu navegador.
Este email es parte del proceso de entrega del mensaje enviado por Rene Bon Ciric. Si has recibido este email por error, por favor ignóralo. En un breve periodo de tiempo será eliminado del sistema.
¡Divértete!
El Equipo de Badoo
Has recibido este email de Badoo Trading Limited (dirección postal a continuación).
Si no desea recibir futuras comunicaciones por parte de Badoo, haz clic aquí para desactivarlas:
https://us1.badoo.com/impersonation.phtml?lang_id=7&email=pyopencl%40tike...
Badoo Trading Limited es una sociedad de responsabilidad limitada registrada en Inglaterra y Gales con número 7540255 y domicilio en Media Village, 131 - 151 Great Titchfield Street, Londres, W1W 5BB.
6 years, 4 months
Re: [PyOpenCL] Restrictions in PyOpenCL?
by Andreas Kloeckner
Hi Marcus,
"=?UTF-8?Q?marcus.desto?=" <marcus.desto(a)o2.pl> writes:
> I have been reading your documentation of pyopencl and I am wondering,
> whether it is possible to pass a list of structs to a gpgpu device
> using pyopencl or whether the possibility of passing lists of structs
> does not exist in pyopencl.
Wrote a howto for you, since I agree that that area of PyOpenCL is
somewhat underdocumented:
http://documen.tician.de/pyopencl/howto.html
> I tried to pass structs in several ways, but I failed. I was wondering pythons struct did not accept a list of tuples (see example), meaning it expected more elements to pack.
>
> Example (no code):
> A list containing two 2-tuples elements (x,y) and (a,b) has to be packed. Assume x,a are strings with length 10 and y,b are integers - so struct.Struct('10sI'*len(ourlist)) should be used. But as python starts packing the *list using pack_into(), the function says, it expected 4 arguments, but 2 are given - which actually are four: [(x,y),(a,b)].
>
> Maybe I am wrong or not smart enough, I do not know.
>
> It is easy to pass one struct as ctype string buffer, but since lists of structs could improve speed of applications, which need lot of data managed in custom data types, it might be a good idea to add a feature, if there is no way to pass a list of struct to the devices using pyopencl.
>
> What about?
Also, next time, please ask questions like this on the PyOpenCL list [1],
which I've cc'd on my reply.
[1] http://lists.tiker.net/listinfo/pyopencl
Andreas
6 years, 4 months