View Full Version : how to use math.h functions in __kernel

sayush

12-01-2009, 09:15 PM

How do you evaluate fuctions like sqrt() in a __kernel function? I did a straightforward implementation but that does not work. Like:

__kernel void Calc(int *a, int *b){

b[0] = sqrt(a[0]);

}

is anything extra required?

matrem

12-02-2009, 01:37 AM

What is the problem?

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

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.

Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.