Segfault smells like having more workers than elements to me.
You must either pass the length of those two vectors and check i that gid
doesn't exceed it, or have the length be always exactly divisible by the
work group size. (the former is much more robust)
On 11 Sep 2014 16:38, "Gus Peterson" <[email protected]> wrote:

> Oh boy,
> Yes.  My mistake.  Now I'm getting a seg fault.
>
> Thanks for catching this.  Too little sleep.
>
> -Gus
>
> On Thu, Sep 11, 2014 at 7:21 AM, Bogdan Opanchuk <[email protected]>
> wrote:
>
>> Hi Gus,
>>
>>  Did you mean to write "target[gid] = tanh(matrix[gid]);"?
>>
>> On Fri, Sep 12, 2014 at 12:15 AM, Gus Peterson <[email protected]>
>> wrote:
>>
>>> Hi all -
>>>
>>> I'm building a small set of OpenCL executable math functions with some
>>> friends.  I'm having a hard time getting the "tanh" function to come out.
>>>  When I compile the following code:
>>>
>>> *# OpenCL (C99) kernel code, compiled*
>>> *prg = cl.Program(ctx, """*
>>> *__kernel void ApplyTanh(__global const float *matrix, __global float
>>> *target) {*
>>> * int gid = get_global_id(0);*
>>> * target[gid] = tanh(matrix);*
>>> *}*
>>> *""").build()*
>>>
>>> I get this error:
>>>
>>> *"/tmp/OCL7750T1.cl", line 4: error: no instance of overloaded function
>>> "tanh"*
>>> *          matches the argument list*
>>> *            argument types are: (const __global float *)*
>>> *  target[gid] = tanh(matrix);*
>>>
>>> What on earth can I do to get the OpenCL kernel code to execute a
>>> hyperbolic tangent?
>>>
>>> Thanks,
>>> Gus
>>>
>>> _______________________________________________
>>> PyOpenCL mailing list
>>> [email protected]
>>> http://lists.tiker.net/listinfo/pyopencl
>>>
>>>
>>
>
> _______________________________________________
> 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