View Full Version : How to use sqrt/cos/.. in kernel

05-02-2011, 10:52 AM
I try to use the function sqrt(5) or cos(5) like this:

__kernel void hello(__global float *input, __global float *output)
size_t id = get_global_id(0);

float squareroot = cos(5);

When i do this, clBuildProgram is != CL_SUCCESS and i got an error.
if (clBuildProgram(program, 0, NULL, NULL, NULL, NULL) != CL_SUCCESS)

Why i can't use these functions?
Thanks for help

05-02-2011, 04:37 PM
Which error code was returned? Also, have you tried looking at the build log? Use clGetProgramBuildInfo() with CL_PROGRAM_BUILD_LOG to get the compilation error messages.