Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
27 Views

clCreateContext fails on CPU but not on GPU

On a laptop running under Windows 10 64 bits and dual Intel GPU / NVIDIA GPU configuration, my OpenCL program returns a CL_OUT_OF_HOST_MEMORY when creating an OpenCL context with the "Intel (R) OpenCL" platform and a "Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz - OpenCL 2.0 (Build 359)" device while the create context succeeds when I choose the "Intel(R) HD Graphics 530" device on the same platform and same code. Now the strange thing is that with one of the Intel OpenCL sample code, on the same machine and system, the context is created normally in both cases. Under VS 2015, at the time of context creation, heap allocation is only around 3 Mb so it feels weird to read that the host is out of memory!

Does anybody know what could be causing this error when choosing the CPU device under certain conditions?

0 Kudos
2 Replies
Highlighted
Beginner
27 Views

I have found what is causing this but without really understanding why. In fact it is just a clue but not really a complete solution. My project links with two Matlab libraries, libmat.lib / libmx.lib that are interface libraries to two DLLs delivered with Matlab. When I strip down my project by removing any Matlab code dependencies and removing these two libraries from the link... the OpenCL context is created successfully on the CPU. The weird thing is that this happens while the context is created before any Matlab code is called in the program, so there is something probably going on in the Matlab DLLs at initialization time that has an impact on the OpenCL context creation.

0 Kudos
Highlighted
Beginner
27 Views

Here is the conclusion to this bug. Instead of linking to the two Matlab libraries and loading the DLLs implicitely, I've switched to loading them explicitely after creating the OpenCL context. It solved the issue of the context failing when choosing the CPU device. I still have no idea why.

This is also related to this bug on linux Ubuntu.

0 Kudos