Now that both nVidia and AMD implementation export clean undecorated (cdecl calling convention) functions, it could be possible with dynamic loading of wanted implementation library. Take a look at dynamic loading with dlopen on Linux, that is LoadLibrary on Windows. Don’t know if anyone tried this by now.
The whole platform layer needs to be worked out between the vendors for good interop. Until that’s finished (and they all ship compatible versions) you’re on your own. If you want interop today you should try Mac OS X as it natively supports AMD/Nvidia GPUs and Intel CPUs.
The one platform on OS X supports all devices, so you do not need multiple platforms. If you have a machine with supported AMD and Nvidia GPUs you’ll see two devices of type CL_DEVICE_TYPE_GPU and one CPU device.
Yes you’re right if the platform support all existing devices, there is no really use for multiple platforms.
But we can imagine there will exists other devices that wont be supported by Apple platform, but only by the device provider implementation.
For example an open source software implementation (for debugging purpose).
So I hope Apple thought about managing multiple platforms :).
As for dynamically loading the OpenCL dll, I have implemented that in a “compiler” tool I recently posted on sourceforge: http://clcc.sourceforge.net
The reason for this is that currently there seem to be some problems between the nVidia and AMD opencl import libraries on windows, which causes problems when you link with one but want to use the other.
just to make sure I got it right:
Does that mean you can compile your kernel for the NVidia CUDA architecture using the NVidia compiler, compile a kernel for your (Intel or AMD) CPU using the AMD compiler and then use the binaries in a single OpenCL program to run kernels on both CPU and NVidia GPU?
How stable is your tool? Do you know if it works on Linux?