I am using Visual Studio 2017 version 15.4.5 with “Intel SDK for OpenCL for Windows” version 22.214.171.12467.
If I launch an OpenCL project from Visual Studio without debugging, clGetPlatformIDs(0, NULL, &n) gives 3 platforms. If I get details on the 3 platforms, they are:
The Intel platform contains the Intel CPU and integrated Intel GPU for this machine.
However, if I launch an OpenCL project from Visual Studio with debugging, clGetPlatformIDs(0, NULL, &n) only gives 2 platforms. The platforms in that case are:
Strangely, the OpenCL API trace view shows that clGetPlatformIDs returned an error code of -1001, but my code sees a return value of CL_SUCCESS. I see that happen even in the simplest possible program:
cl_int clErr = 9999; // Initialize to something invalid cl_uint n; clErr = clGetPlatformIDs(0, NULL, &n); // n is now 2 if running in debug mode, and clErr is now CL_SUCCESS, but // the Trace View says that clGetPlatformIDs returned error code -1001
How does clGetPlatformIDs simultaneously return both CL_SUCCESS and -1001 (CL_PLATFORM_NOT_FOUND_KHR) in a single call?
Why does the Intel OpenCL platform not appear when debugging? I want to debug code that uses the Intel OpenCL platform. I have the same issue even when running Intel’s OpenCL template project, so it does not appear to be a Visual Studio project setting problem.
I have found that if I disable “OpenCL API Debugger” in the Code-Builder plugin in Visual Studio, the Intel platform appears when debugging. However, disabling the OpenCL API debugger seems to defeat the purpose of wanting to debug OpenCL.