View Full Version : Coding : opencl information when program starts ....

04-28-2011, 07:16 AM

I have developped an small program using OpenCl. I know the user has to have Opencl drivers installed on his machine depending his graphic card. I have two questions :

1) I would like to developp a method (C++ or C) that will inform if Opencl can be supported in the machine. This information has to be done even when none driver is installed.
This would be useful to inform the user if he has to let down or download the latest drivers for his platform.

2) As my program asks opencl.dll on startup if not present, I've included a default opencl.dll file taken from my nvidia cards driver.
Is there another solution (other than GetProcAddress(...) ) to avoid opencl.dll message box as my program has to start even if openCl isn't supported ?

Thank you


04-28-2011, 09:52 AM
You can load any library dynamically using dlopen() on unix-like systems or LoadLibrary() on Windows systems.

If loading "OpenCL.dll" dynamically fails then you know that the system does not have OpenCL installed.

04-29-2011, 05:58 AM
Hi David ,
Thank you for your reply.
But opencl.dll missing doesn't mean that the machine won't support opencl.
For instance, if the user has a recent PC that can handle OpenCL but with outdated drivers, is this possible to tell him that his PC physically supports OpenCL.
Have I to ship default opencl dll in my setup to allow this process ?

GPU Caps viewer for instance allows to detect openCL capabilities even if no drivers installed (I think).

Thank you,

04-29-2011, 08:39 AM
I'd imagine you'd have to query the hardware and lookup in a table.

If(GPUDeviceName == SomethingInMyDatabase)
Tell User to Get Newer Drivers; point in the right direction


Of course this requires that your program be updated along with newer hardware. You'd have to do GPU and CPU, too. And if you wanted to do linux and windows, you'd have to do it differently, I'd imagine.

I suppose you could also query the driver version, but that's probably even more messy than querying the hardware. I'm not sure if OpenCL itself is of any help here, other than possibly trying to load the DLL and prevent having to go through the above steps.

Note: I've not tried doing anything like this before, so I could be completely wrong, but I don't forsee any 'easy' ways to do this.