OpenCL* for CPU
Ask questions and share information on Intel® SDK for OpenCL™ Applications and OpenCL™ implementations for Intel® CPU.
Announcements
This forum covers OpenCL* for CPU only. OpenCL* for GPU questions can be asked in the GPU Compute Software forum. Intel® FPGA SDK for OpenCL™ questions can be ask in the FPGA Intel® High Level Design forum.
1719 Discussions

Intel OpenCL Platform Disappears in Debug Mode

aaronCuda
Beginner
722 Views

I am using Visual Studio 2017 version 15.4.5 with “Intel SDK for OpenCL for Windows” version 7.0.0.2567.

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:
1) Nvidia
2) AMD
3) Intel

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:
1) Nvidia
2) AMD

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.

0 Kudos
2 Replies
ZHANG__Li1
Beginner
722 Views

I was just hit by the same problem
(Win10 x64, Intel i7 + HD 630, with the latest version of Intel OCL SDK)

0 Kudos
ZHANG__Li1
Beginner
722 Views

The problem disappeared after I switched to the 2019 version.

In the System Studio bundle I only selected the OpenCL tool.

0 Kudos
Reply