I suspect PyOpenCL is innocent. With your code I'm sometimes getting
completely random results, sometimes a segfault in amdocl64.dll on Windows
7/64 bit, Python 3.3.2, PyOpenCL 2013.2, and the latest catalyst drivers.
The culprit definitely looks to be printf(). Everything works fine if you
comment it out.
By the way, you would get the same result if you removed the buffer
altogether and set the workgroup size to (1,).
Looks to me like a bug in the catalyst drivers.




On 5 May 2015 at 19:08, Antonio Beamud <[email protected]> wrote:

> I've created this simple test
>
> #!/usr/bin/env python
> #-*- coding: utf-8 -*-
>
> import pyopencl as cl
> import numpy as np
>
> ELEMENTS = 257
>
> KERNEL = """
> __kernel void test(__global const int *a,
>                    const int asize
>                   )
> {
>     int agid = get_global_id(0);
>     if (agid==0)
>         for(int i=0; i < asize; i++)
>             printf("agid:%u, i:%i, asize:%u\\n", agid, i, asize);
> }
> """
>
> a = np.random.randint(-1595081346, 1595081346, ELEMENTS).astype(np.int32)
>
> for platform in cl.get_platforms():
>     for device in platform.get_devices():
>         if cl.device_type.to_string(device.type) == 'GPU':
>             ctx = cl.Context([device])
>             queue = cl.CommandQueue(ctx)
>             mf = cl.mem_flags
>             a_buf = cl.Buffer(ctx, mf.READ_ONLY | mf.COPY_HOST_PTR,
> hostbuf=a)
>             prg = cl.Program(ctx, KERNEL).build()
>             exec_evt = prg.test(queue, (ELEMENTS,), None, a_buf,
> np.int32(a.size))
>             exec_evt.wait()
>
> The tail output is:
>
> agid:0, i:252, asize:257
> agid:0, i:253, asize:257
> agid:0, i:254, asize:257
> agid:0, i:0, asize:4294374642
>
> I'm running pyopencl 2014.1, with an R7 260x.
> Why cannot process the 255 value? (with the CPU works fine) Is a problem
> with the work group size?
>
> Thanks
>
> _______________________________________________
> PyOpenCL mailing list
> [email protected]
> http://lists.tiker.net/listinfo/pyopencl
>
>
_______________________________________________
PyOpenCL mailing list
[email protected]
http://lists.tiker.net/listinfo/pyopencl

Reply via email to