Hi,
I got some problems when i try to build double precision kernels with OpenCL:
this one works:
const char *gpcAddFloatSrc =
"__kernel void addiere(__global float *gpfA, __global float *gpfB, __global float *gpfC, int iCount)\
{\
int liIDX = get_global_id(0);\
if (liIDX < iCount)\
{\
gpfC[liIDX] = gpfA[liIDX] + gpfB[liIDX];\
}\
}";
this one returns a program build failure:
const char *gpcAddDoubleSrc =
"__kernel void addiere(__global double *gpdA, __global double *gpdB, __global double *gpdC, int iCount)\
{\
int liIDX = get_global_id(0);\
if (liIDX < iCount)\
{\
gpdC[liIDX] = gpdA[liIDX] + gpdB[liIDX];\
}\
}";
Of course I tried to enable the fp64 with
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
My compiler (vc90) reclaims that this pragma is unknown, but that seems to be normal.
A Cuda version of that code (it’s only a test) runs without problems on my gt540m.
Can anyone help me? :(
#pragma OPENCL - it is for OpenCL source code, which is compiled by OpenCL compiler. Generic C(++) compiler cannot do anything with this pragma.
so it has to look like this?:
const char *gpcAddDoubleSrc =
"#pragma OPENCL EXTENSION cl_khr_fp64 : enable\
__kernel void addiere(__global double *gpdA, __global double *gpdB, __global double *gpdC, int iCount)\
{\
int liIDX = get_global_id(0);\
if (liIDX < iCount)\
{\
gpdC[liIDX] = gpdA[liIDX] + gpdB[liIDX];\
}\
}";
I just tested this one…now the clBuildProgram Function says the Kernel name (“addiere”) is invalid …
In case the Compiler compiled the float version before, does the Compiler still remember that and actually claims that the name allready exists?
I don’t know… Maybe you put linefeed (\n) after the whole line with pragma declaration?
I need some Coffee…you’re a lifesaver.
Works<