#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
#define FLOAT double
#elif defined(cl_amd_fp64)
#pragma OPENCL EXTENSION cl_amd_fp64 : enable
#define FLOAT double
#else
#define FLOAT float
#endif
kernel void FLOAT#_test(global FLOAT* a, global float* b)
{
b[get_global_id(0)] = convert_float(a[get_global_id(0));
}
One devices that support doubles, this kernel will convert all doubles to single precision floats, and on devices that don't support doubles, it does a copy.
Message was edited by: Micah Villmow
Fixed typo from cl_khr_fp64 to the correct cl_amd_fp64.