Is there a way inside a .cl file to know whether the compiler is provided by NVIDIA or ATI? via a define. Also, is there a way to query which extensions are available from within a .cl file?
I am thinking something like
#ifdef USING_NVIDIA_COMPILER
#if HAS_DOUBLE_PRECISION_SUPPORT
#define Real_t double
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
#else
#define Real_t float
#endif
#else
#i HAS_DOUBLE_PRECISION_SUPPORT
#define Real_t double
#pragma OPENCL EXTENSION cl_amd_fp64 : enable
#else
#define Real_t float
#endif
Thank you
Other use for that can be to avoid local memory's bank conflicts on NVIDIA cards.
1. parse CL_PLATFORM_VENDOR string for Nvidia AMD and pass define manualy via -D option in clBuildProgram()
2. then it shoul work
#ifdef cl_khr_fp64
// code which use doubles
#else
// single code
#endif
but if IIRC nvidia has problem with this statestment. so you maybe must again manualy parse CL_DEVICE_EXTENSION and pass own #define via -D
so, if everything works,
#ifdef cl_khr_fp64
should tell me whether I can use the cl_khr_fp64 extension?
yes read end 9.1 in OpenCL specification.