Determine whether ATI/NVIDIA are used for compilation

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

Sure, I do something like that. See section 5.4.3, Build Options. They are passed in with clBuildProgram(). You might have an options argument like:

“-D USING_NVIDIA_COMPILER” or

“-D HAS_DOUBLE_PRECISION_SUPPORT” or

“-D USING_NVIDIA_COMPILER -D HAS_DOUBLE_PRECISION_SUPPORT” or

“”

You will have to query your device at runtime in order know which options arg to pass.