cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

Otterz
Journeyman III

Enable extensions based on platform

And I have yet another question.

 

I am cross compiling/running my code on both AMD and Nvidia hardware. And I have an annoyance. On AMD 64bit is enabled by cl_amd_fp64, and on Nvidia it is enabled using cl_khr_fp64.

Are there any defines that allow me to know which vendor I am using? I noticed on the Khronos site, they have some files that use __APPLE__ to identify apple products.

Are there things like __AMD__ or __NVIDIA__?

Right now, I have to remember to edit each kernel file manually and comment out one of the extension enables

0 Likes
3 Replies

The method for handling this is as follows:
#ifdef cl_amd_fp64
#pragma OPENCL EXTENSION cl_amd_fp64 : enable
#endif

#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
#endif

The extensions should be defined if they are available so it is possible to know what extensions are available without knowing the platform or vendor.
0 Likes

Thank you very much!

 

Do you know where in the docs/khronos site/AMD pdfs I can find this type of info? I searched high and low and didn't spot it, but I wasn't even sure what to search for.

 

Thanks again, you made my life less annoying

0 Likes

Please see Appendix A.4 from our programming guide.
0 Likes