3

This is a very strange situation. Why do I get error

CL_PLATFORM_NOT_FOUND_KHR

when I'm calling this function:

clGetPlatformIDs(0, NULL, &platformCount);

Earlier this error was not. I have installed the driver and SDK from Intel and Nvidia. Are there any suggestions?

3 Answers3

4

Here is explained why such error can occur. clGetPlatformIDs returns CL_SUCCESS if the function is executed successfully and there are a non-zero number of platforms available. Otherwise it can return CL_PLATFORM_NOT_FOUND_KHR if the cl_khr_icd extension is enabled and no platforms are found.

2

You are in luck. Well sort of... Seeing this is 3 years later.

Disclaimer: I HAVE NO CLUE WHY THIS WORKS:

Machine: x64 windows 10.

Graphics Card: Geforce GTX 960

Total Failure To Load Library : LoadLibraryA( "OpenCL64.dll" )

WRONG (but loads) : LoadLibraryA( "C:/Program Files/NVIDIA Corporation/OpenCL/OpenCL64.dll" )

WRONG (but loads) : LoadLibraryA( "C:/Program Files/NVIDIA Corporation/OpenCL/OpenCL.dll" )

CORRECT: LoadLibraryA( "OpenCL.dll" )

Here is the really insideous thing: Both of my "WRONG" answers will let you grab function pointers, but when you call clGetPlatformIDs the return status will be 0xFFFFFC17 ( CL_PLATFORM_NOT_FOUND_KHR ).

Then you'll be examining your function call correctness. Maybe you'll even look at the calling convention. Maybe you'll check the header files and make sure there are not any typos there. And yet, you are looking in all the wrong places because the original problem happened more steps back than you think.

Because of this problem, I build into my programs code that reads a file: "OPEN_CL_SEARCH_PATHS.TXT" so the user of the software can change what DLL file the program attempts to load.

While I am here, I would also like to add that there seems to be a bug with the driver that makes it so OpenCL <==> OpenGL sharing is NOT a zero-copy share and is incredibly laggy. Now I've got to go figure out Vulkan to make my fractal rendering engine even though OpenCL's abstraction better suits the problem.

It is probably important to note that I am NOT using an SDK or any validation layers. In fact, I am not even using windows.h. I wrote assembly code to grab the address of GetProcAddress and LoadLibrary by navigating the PEB file. I am also not using cl.h or cl_platform.h. I reconstruct the structs I need from the documentation. I am also not bothering with prototypes for function signatures either. For example, I call "clGetPlatformIDs" by casting it to type "F_03" and then calling it that way.

typedef void* (F_03)( void, void*, void* );

KANJICODER
  • 3,611
  • 30
  • 17
0

My machine doesn't have GPU and so had to use hashcat with OpenCL for CPU alone. My machine was Intel core i3, so I have downloaded the OpenCL softwares from Intel website and installed manually and the error gone.

Source: https://youtu.be/AieYqNQ6ADM

Anonymous Platypus
  • 1,242
  • 4
  • 18
  • 47