Hello friends,

I'm awed and in love with pyopencl!  Many thanks to Andreas & all
contributors.

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
import pyopencl.algorithm
from pyopencl.algorithm import *


ctx = cl.create_some_context()
q = cl.CommandQueue(ctx)
mf = cl.mem_flags

knl = cl.algorithm.GenericScanKernel(
        ctx, np.int32,
        arguments="__global int *ary, __global int *out",
        input_expr="(ary[i] > 300) ? 1 : 0",
        scan_expr="a+b", neutral="0",
        output_statement="""
            if (prev_item != item) out[item-1] = ary[i];
            """)

out = a.copy()
knl(a, out)

a_host = a.get()
out_host = a_host[a_host > 300]

assert (out_host == out.get()[:len(out_host)]).all()
###################
_______________________________________________
PyOpenCL mailing list
[email protected]
http://lists.tiker.net/listinfo/pyopencl

Reply via email to