I have an error in an OpenCL kernel, when I try to use the cl_khr_fp64 extension, the kernel compiles and the build log is empty, but when I call clCreateKernel, I have CL_INVALID_KERNEL_NAME error.
The source that fails:
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
__kernel void simple( __global char *x, __global char *y ){
int id = get_global_id(0);
y[id]=2*x[id];
}
This source compiles right:
__kernel void simple( __global char *x, __global char *y ){
int id = get_global_id(0);
y[id]=2*x[id];
}
I’m using OpenCL 1.0 with a Tesla C1060 that have cl_khr_fp64 in CL_DEVICE_EXTENSIONS, driver 280.13 and CL_PLATFORM_VERSION=OpenCL 1.1 CUDA 4.0.1
The problem was that before call to clCreateProgramWithSource, we remove the newlines from source. E.g: the source:
Becomes:
It causes no problem until we add the preproccessor directive.
It’s the OpenCL preprocessor which actually wants newlines to be there. So, it should be written as: