PDA

View Full Version : Accesing both Amd/nVidia OpenCL



matrem
12-01-2009, 03:52 AM
Is it possible to access both OpenCL platform in one executable, with current AMD and nVidia implementation?

I tried to use both OpenCL.dll, but in each case I only got the .dll provider platform.

configuration:
Vista 64
nVidia gtx 275, 195.62
intel core i7
amd ati stream sdk 2 beta 4

jbasic
12-01-2009, 07:11 AM
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.

matrem
12-01-2009, 09:57 AM
Thanks.

So I must dynamically load OpenCL_ati.dll and OpenCL_nvidia.dll, and implement a platform manager myself from the dll name...

I was thinking OpenclCL implementation should manage it automatically ... (is GetplatformList useless? ).

dbs2
12-01-2009, 10:05 AM
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.

matrem
12-01-2009, 11:09 AM
So it's just a matter of time.
I can wait, I'm just testing what is/will be possible with OpenCL, and writting a c++ wrapper.

I tried mac os X 10.6.2, and even if it support multiple device, there is only one platform (called "Apple").

In fact I never see a host which support multiple platforms.

thanks.

dbs2
12-02-2009, 05:04 AM
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.

matrem
12-02-2009, 07:54 AM
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 :).

george_vv
12-10-2009, 07:30 AM
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.

George

dominik
01-29-2010, 02:12 AM
Hi George,

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?

Cheers
Dominik