Access violation in clGetPlatformIDs

Hello,
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?

Thanks.

@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 30.0.101.1338 dated 1/20/22
  • NVIDIA Quadro P620 - driver version 31.0.15.1654 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.