OpenCL code to work with AMD / Nvidia

Can anyone tell if it is possible, after compilation, to get OpenCL code that works with both AMD and Nvidia cards, and what is the general procedure for doing this? Do I need to install both OpenCL SDKs (AMD / Nvidia) and with an "if" structure do different code for each case (AMD device or Nvidia device)? If you could just clear things up, some headlines will appreciate it. Thank.

+3


source to share


1 answer


Yes, it might be the goal of OpenCL over CUDA (which only works with NVIDIA hardware). Basically, you make your kernels for writing C99 code, which will then be compiled into intermediate "vendor independent" code. This last code will be interpreted by your card (AMD or Nvidia) at runtime. Generally there is no reason why you should write different codes for certain cards, don't use a different SDK (but ok ... I'm on Max OS 10.7, which is possibly different from another environment)



+4


source







All Articles