Reputation: 11
I have a software that used OpenCL on the core for optimization purposes , and everything are running fine, and now i´m packaging this software to be installed on other machines.
Now , i´m confused, becouse for example, on the machine where the software was build, there is a CPU and two GPU´s and the software works detecting all the devices returned by the OpenCL initialization...so...i need distribute all the OpenCL Dll´s and libraries for all different vendors?
Anyone here have an idea what is the best way to distribute a software that uses type of system?
Any help will be much appreciated!
Kind Regards.
Upvotes: 1
Views: 361
Reputation: 141
OpenCL vendor libraries are now part of each GPU vendor's graphics driver package. They also install and register the common OpenCL.dll when they install the graphics driver so you don't have to distribute OpenCL or its vendor libraries.
This works for AMD/ATI, nVidia and Intel GPUs. But may not work with other GPU vendors. Unfortunately, this only applies to reasonably new GPUs and recent drivers, let's say the last 12-18 months. You have to investigate the following scenarios:
In all cases the user has to install the latest GPU driver, or if none is available then usually OpenCL isn't available anyway. This is a scenario that has to be done by some installer logic/interaction.
Two problems remain. First, the Intel CPU (with a C) OpenCL package has to be installed manually, if a CPU with SIMD (SSE2/AVX) is to be used as OpenCL platform. This task is similar to installing a GPU driver and this scenario also has to be dealt with by some installer logic. I discourage distributing vendor DLLs from Intel and suggest the proper OpenCL CPU package installer from Intel.
The second problem is if there is no OpenCL installed by any vendor or driver package, then usually the OpenCL.dll is missing as well. Almost always this library is linked dynamically and not on-demand (GetProcAddress) so any application using OpenCL will not load and stop with a DLL not found message box. There is not even a change for the application to report or provide help. The best solution for this is to use load-delay (just specify the OpenCL.lib as load-delay in linker settings) and then perform a generic is-dll-installed-on-system check in the application before the first OpenCL API is called. Then provide reasonable user interaction and support.
Additionally, all 3 mayor vendors have end-user OpenCL distribution packages. Although I still suggest installing the latest driver instead.
Upvotes: 2
Reputation: 36313
Your code will be compiled JIT on the target machine. You need to take care that you dispatch your kernels only on available devices. So at runtime your kernels will execute only on those devices which support OpenCL. Of course that means: only machines with OpenCL-aware devices will take advantage of your optimization.
Upvotes: 1