I'm awed and in love with pyopencl! Many thanks to Andreas & all
I'm left wondering, however, if people are able to run
algorithm.GenericScanKernel(). I'm getting all sorts of errors, from uint
not being recognized to 'module' object has no attribute
'GenericScanKernel'. Can anyone help out? Maybe anyone has a running
example of copy_if()?
The code below cannot even see GenericScanKernel()...
import pyopencl as cl
from pyopencl.algorithm import *
ctx = cl.create_some_context()
q = cl.CommandQueue(ctx)
mf = cl.mem_flags
knl = cl.algorithm.GenericScanKernel(
arguments="__global int *ary, __global int *out",
input_expr="(ary[i] > 300) ? 1 : 0",
if (prev_item != item) out[item-1] = ary[i];
out = a.copy()
a_host = a.get()
out_host = a_host[a_host > 300]
assert (out_host == out.get()[:len(out_host)]).all()
"CRV§ADER//KY" <crusaderky(a)gmail.com> writes:
> Just wondering, what's the performance for initialising a large
> pyopencl.array in PyPy?
Well, to start with 'empty' won't do any initialization at all--that's
the point of it. :)
Next, the number of things PyPy has to do for a PyOpenCL array 'empty'
allocation is independent of the size, so I imagine that the only thing
that would influence allocation speed is the CL implementation you're
> I'm asking because numpy.empty has abysmal performance on PyPy when you get
> to large dimensions:
>>>> timeit('np.empty((5,), dtype=np.float64)', setup='import numpy as np',
>>>> timeit('np.empty((500000,), dtype=np.float64)', setup='import numpy as
> np', number=1e6)
>>>>> timeit('np.empty((5,), dtype=np.float64)', setup='import numpy as np',
>>>>> timeit('np.empty((500000,), dtype=np.float64)', setup='import numpy as
> np', number=1e3)
> PyPy is 2000 times slower than CPython when allocating 4MB worth of memory
That's a bug I'd imagine. I'd suggest you report it--here's the URL:
Bogdan Opanchuk <mantihor(a)gmail.com> writes:
> Hi Andreas,
> On Wed, May 28, 2014 at 4:04 PM, Andreas Kloeckner
> <lists(a)informa.tiker.net> wrote:
>> - PyOpenCL's array and algorithms functionality will be spun off into
>> separate packages ("clarray" and "clalgorithms"?).
> Isn't `compyte` supposed to be the array package (and I remember it
> containing some algorithms as well)? Will its status change somehow?
Compyte has a role across PyCUDA and PyOpenCL. The things I'm describing
here are CL-only.