Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running OpenCL on hardware from mixed vendors

Tags:

gpgpu

opencl

I've been playing with the ATI OpenCL implementation in their Stream 2.0 beta. The OpenCL in the current beta only uses the CPU for now, the next version is supposed to support GPU kernels. I downloaded Stream because I have an ATI GPU in my work machine.

I write software that would benefit hugely from gains by using the GPU. However this software runs on customer machines, I don't have the luxury (as many scientific computing environments have) to choose the exact hardware to develop for, and optimize for that. So my question is, if I distribute the ATI OpenCL implementation with my application, will that mean it will never be able to use e.g. NVidia video cards? And if I use the NVidia OpenCL SDK, that it will never run optimally on AMD chips (considering the ATI/AMD link)?

On other words, who is in the end responsible for providing the OpenCL implementation? Will users be able to e.g. install an OpenCL 'driver' for their NVidia video card, alongside a 'driver' that gives them optimal performance on their AMD CPU?

As an aside, are there any good/active support forums for OpenCL apart from the Khronos message boards, or is that the place to go? I've seen that ATI has a board, and NVidia presumably has their own, where does the OpenCL user/developer community hang out? Has it already consolidated into one place?

like image 507
Roel Avatar asked Sep 07 '09 09:09

Roel


People also ask

Can OpenCL run on CPU?

 OpenCL can use CPUs as a compute device just it can for GPUs.  There is no local memory, CPUs cache is utilized in OpenCL just like any normal CPU program.

Is OpenCL CPU or GPU?

CUDA vs OpenCL – two interfaces used in GPU computing and while they both present some similar features, they do so using different programming interfaces.

How do I know if my graphics card supports OpenCL?

If you have recent drivers for your GPU, you can be sure OpenCL is already supported and you can run OpenCL-capable software. NVidia has support for OpenCL 1.1 since drivers 280.13, so if you need OpenCL 1.1, then make sure you have this version or later.

Does OpenCL run on GPU?

OpenCL™ (Open Computing Language) is a low-level API for heterogeneous computing that runs on CUDA-powered GPUs. Using the OpenCL API, developers can launch compute kernels written using a limited subset of the C programming language on a GPU.


1 Answers

I know this is an old question with old answers above. Thought I would update it with an up to date answer.

Yes, one implementation of OpenCL kernels and code will work on a wide variety of devices today with correctly written platform and device enumeration code. It is pretty easy to write correct platform and device enumeration code, the tricky part is selecting which platform or device. You should probably present a configuration option in your app where the user can select one, or run a microbenchmark against each one and dynamically select one and cache the bench result.

People can and will have more than one platform. For example, my system has GTX 580 SLI, so it has two devices in the NVidia platform. It also has the Intel OpenCL SDK, so my CoreI7 990x Extreme CPU also comes up as a device in the Intel platform.

Yes a binary developed and built using, for example, the NVidia OpenCL SDK, will work on ATI or Intel OpenCL, and vice versa. No need to worry about that anymore.

Obviously, an end user might have no OpenCL whatsoever, so you may need to delay-load or LoadLibrary opencl.dll and dynamic link.

I stronly suggest testing your code against the Intel OpenCL SDK, on NVidia GPUs, AND on AMD GPUs. You will probably find bugs that cause problems on one platform, but works fine on others. You will also probably find that totally fine code mysteriously doesn't give correct results on one of those platforms, due to driver bugs.

like image 90
doug65536 Avatar answered Oct 19 '22 01:10

doug65536