doubt about ICD model


can I compile a .exe with the NVIDIA OpenCL SDK and then run that exe with a non-NVIDIA card(like ATI)? Is not the ICD for that?
Well… I don’t like the idea to have to compile 10 different .EXEs, one for each OpenCL implementation…

I ask this because, with a .exe compiled using the NVIDIA OpenCL SDK and an ATI card, Windows crashes when I call the clGetPlatformIDs() function…
Shouldn’t I be able to enumerate all the platforms and devices in my computer from other vendors too?


You should be. How does “Windows crash” on this call? If it crashes (BSOD?), how do you know the instruction within the program that’s to blame?

Generally you make one .exe that’s linked to OpenCL.dll (requires its presence on the system to run). It’s likely to be sitting in windows/system32. This OpenCL.dll is a not vendor-specific and it serves as a “router” to vendor-specific .dlls that are supplied via ICDs. ICDs register their .dlls so that the system-wide OpenCL.dll is able to find them.

My program just hangs indefinitely, showing an error in the Output Window ( Invalid access 0xC000007 ).

Which version of NVIDIA’s GPU SDK are you using? Which drivers?
Same question for AMD stuff - which SDK and what drivers.

Could you paste the code snippet where you call clGetPlatformIDs?

Have you tried your code with an NVIDIa GPU?

Can your program locate OpenCL.dll? 0xC000007 sounds like a failure with initializing the app, which suggests a missing .dll.

Are you linking to the proper .lib? (32 vs 64 bits)

Latest official ones: CUDA 3.0 + GPU computing SDK.


ATI Stream SDK 2.1 with Catalyst 10.5.

Yes, with NVIDIA works perfectly.

cl_uint l_uiNumPlatforms(0);

	if ( clGetPlatformIDs ( NULL, NULL, &l_uiNumPlatforms )!=CL_SUCCESS ) //BOOM here


		throw std::runtime_error("Cannot retrieve the OpenCL platforms");


Yep I link with the proper x86/x64 libs.

I think the problem is that ATI does not install OpenCL.dll with their Catalyst drivers, which I’ll never understand why.

I don’t think it is legal to call clGetPlatformIDs with a NULL platform anymore.

Hopefully we can call this function without passing any platform, because it’s the function that permits to get platform ids :)
By the way the cl_platform_id * is just taken for output not for input.

OpenCL.dll is the ICD entry point that’ll get the right platform function pointer from dll located in a place described in your registrey key : HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\OpenCL\Vendors.

nVidia and AMD install this OpenCL.dll which should be the same for the two vendors.

You’re thinking of creating a context with nulll platform, which was once legal and isn’t anymore.

clGetPlatformIDs should work fine with a null there. In fact, when you pass a null, the function effectively serves to count the number of platforms available. A common use case is to run clGetPlatformIDs twice, once to get the number of platforms to allocate a big enough platform array, and again to fill this newly allocated array with valid ids.

santyhyammer, try to run your app in debugging mode, VS will list all loaded .dlls in the output window. See if it actually loads OpenCL.dll.

Also try running your app without VS and see if you get an error popup about a missing dll.

Confirmed. ATI simply decided not to install OpenCL with their Catalyst drivers… so there is no OpenCL.dll for ATI. they told me to install the SDK… so figure my 50Kb app with a 2x 250Mb deployment, LOL…