Results 1 to 3 of 3

Thread: how to use math.h functions in __kernel

  1. #1
    Junior Member
    Join Date
    Oct 2009

    how to use math.h functions in __kernel

    How do you evaluate fuctions like sqrt() in a __kernel function? I did a straightforward implementation but that does not work. Like:
    Code :
    __kernel void Calc(int *a, int *b){
         b[0] = sqrt(a[0]);
    is anything extra required?

  2. #2
    Senior Member
    Join Date
    Nov 2009

    Re: how to use math.h functions in __kernel

    What is the problem?
    You want to test opencl sqrt function, or use native kernel and test the C sqrt function?

  3. #3
    Senior Member
    Join Date
    Jul 2009
    Northern Europe

    Re: how to use math.h functions in __kernel

    The OpenCL spec lists all the math functions that are included. You can find this on the Khronos site. To use them you simply call them with the appropriate arguments. There is no need to include/use math.h as these are built-in.

Similar Threads

  1. Cannot use math functions
    By iassael in forum OpenCL
    Replies: 10
    Last Post: 12-05-2010, 07:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts