Access violation in clGetPlatformIDs

I am a student working to get some older OpenCL code running. It is an application that uses Matlab mex functions to call some C++. A Matlab script compiles the C++ code, then runs it to get the OpenCL stuff going.

The first OpenCL function called is

err = clGetPlatformIDs(0, 0, &nplatforms);

My understanding is that this should put the number of platforms in nplatforms, but I get an access violation instead. What should I be checking for?


@rgillen, why did you copy/paste your post from a year ago as a new thread here?

After a year, do you really have the exact same question? You didn’t provide any additional info (GPU, OpenCL driver, what you’ve tried, etc.). So it’s unclear why you think this post should generate anything useful.

Please see The Forum Posting Guidelines for tips on composing a post that is more likely to net you the information you’re looking for.

Have you tried any of the solutions in the archives for folks having exactly the same problem?

The jist of it is you probably don’t have your graphics drivers installed properly.

I realize now that my post looks like a low-effort attempt at help with homework – I will do better.

I do in fact have the same question from a year ago. The previous thread was closed after nobody felt like responding, so thank you for the feedback. I read all of the posts you linked before my original post and decided the circumstances were different enough that I would start over.

Here is what I know: I am running Windows 10 on a Dell Precision 3541 laptop. The Device Manager shows 3 display adapters:

  • Intel(R) UHD Graphics 630 - driver version dated 1/20/22
  • NVIDIA Quadro P620 - driver version dated 6/22/22
  • Plugable UD-3900 - (DisplyLink) driver version 10.1.2875.0 dated 8/11/21

Under Driver Details for the first two I see C:\WINDOWS\system32\OpenCL.dll in the list.

I honestly don’t know what it means for a graphics driver to be installed improperly. Your first linked thread resolved a known issue (in 2016) with a reinstall of the driver and my drivers appear to be much newer than that.

I am using the NVIDIA SDK, but the fact that there are other things besides the NVIDIA device on this list shouldn’t break anything, right? I believe the NVIDIA device is working - I have been able to point other (custom) software to it and see it listed under “GPU engine” in the Task Manager.

This is the university’s computer and if I need to ask them to do something to it, I just want to be as specific as possible.

Thank you.

Well, that last linked issue indicated that they needed to go forceably cleanup some stuff left over by the Intel graphics driver. No clue if that’s needed nowadays. I have no experience with OpenCL on a laptop.

There’s also the fun of dualing GPUs, which one you’re running on (“preferred graphics processor” = “High-performance NVIDIA processor”), and whether the Intel owns the display+scan-out and just farms out offscreen rendering to the NVIDIA.

Here’s another similar clGetPlatformIDs() crash on dual Intel/NVIDIA GPU system that mentions a few solutions, including:

Looks like a great lead - thank you. I do not have any of the lingering files from the third link in your original post.

Didn’t occur to me to check Intel forums when my target is NVIDIA. I will experiment with disabling devices and come back.

Update: After jumping through the hoops to get admin access on the laptop, I tried the following things which did not work:

  • disable the Intel graphics device in Windows
  • disable the NVIDIA graphics device in Windows
  • force Matlab to use the NVIDIA device via the NVIDIA Control Panel

Apparently you cannot disable graphics devices via the BIOS on this laptop. Some Dells have something called “switchable graphics” in their BIOS, but not this one.

I suppose the next step would be to (try to) actually uninstall the Intel device via Windows. Would that do the same thing as disabling in the BIOS? Will the system just reinstall it?

Yep. Dual GPU laptops (Intel + NVIDIA) instigate lots of fun for realtime graphics too. Not only is it an issue of whether the NVIDIA’s going to be tasked to (or allowed to) do the hard-core 3D rendering. But also whether the NVIDIA GPU’s wired in so it can scan-out the final display frame on the video output directly, …or whether it instead has to route the resulting rendered frame through the Intel GPU because the Intel’s the only one wired up to the video scan-out hardware (e.g. Optimus MUXless).

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.