Developer Guide for Intel® SDK for OpenCL™ Applications
To enable debugging mode in the Intel® OpenCL™ Runtime for compiling OpenCL code using Intel® SDK for OpenCL™ Applications - Debugger plug-in for Microsoft Visual Studio* IDE, do the following:
- Add the -g flag to the build options string parameter in the clBuildProgram function.
- Specify full path to the file in the build options string parameter to the clBuildProgram function accordingly (including the CL file name):
-s <full path to the OpenCL source file>
If the path includes spaces, enclose the entire path with double quotes.
err = clBuildProgram( g_program, 0, NULL, "-g -s \"<path_to_opencl_source_file>\"", NULL, NULL);
Relative path to the CL file is not supported.
According to the OpenCL standard, work-items execute OpenCL kernels simultaneously. The Debugger requires setting the global ID of the work-item to debug before the debugging session starts. The Debugger stops on breakpoints in OpenCL code only when the pre-set work-item reaches them.
To work with the Intel SDK for OpenCL Applications - Debugger plug-in for Microsoft Visual Studio* IDE, the OpenCL kernel code must exist in a text file, separate from the code of the host. Debugging OpenCL code that appears only in a string embedded in the host application is not supported. Create your OpenCL project with the Intel® Code Builder for OpenCL™ API plug-in for Microsoft Visual Studio* to get seamless integration with the Debugger.