openCL math functions on osx

Hi!

Thanks for this library, it is really easy to use. I encountered a problem while writing a kernel - I tried to use the sin() function, but when running the program, I got this error:

Exception in thread “main” org.jocl.CLException: CL_BUILD_PROGRAM_FAILURE
kernel referenced an external function __sind, that could not be found.

if I remove the sin function, it compiles and runs perfectly…

I also tried sinpi() which gives me the same result, and native_sin, which gave me this:

:32:33:{32:33-32:43}: error: more than one matching function found in __builtin_overload

Any ideas?
Thanks!

btw. the same code works perfectly on an other computer with an ATI card, on windows…

Hello

I have never encountered this error, and unfortunately I can not run tests on MacOS myself. But according to the error message, it seems like you’re trying to call ‘sin’ with a double value, for example
sin(123.0);
You may using a float value instead:
sin(123.0f);
or try casting it to float explicitly
sin((float)(theOriginalDoubleValue));

Otherwise… maybe you are including another header which defines a ‘sin’ function (for example, “math.h”) ? Just a guess…

bye
Marco

Typecasting actually worked, thanks a lot!
Its wierd that on one platform it works, on the other it doesnt. Perhaps opencl 1.1 can calculate it for doubles too (as os x only has 1.0)…

Hello

As far as I know, the Compilation of the actual kernel code has some subtle differences on AMD and NVIDIA platforms. Some compilers report the use of ‘double’ only as a “Warning”, and some bail out with strange error messages… Regardless of that, maybe I’ll add some mechanism to print compiler warnings by default (currently, only errors are reported as a CLException)

bye
Marco