PDA

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



OpenCLFAN
05-02-2011, 09: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

david.garcia
05-02-2011, 03: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.