Visible to Intel only — GUID: GUID-569CC758-E3D8-44A3-A67B-29BF18FA56ED
Visible to Intel only — GUID: GUID-569CC758-E3D8-44A3-A67B-29BF18FA56ED
Enabling Debugging in OpenCL™ CPU Compiler and Runtime
To enable the debugging mode in the OpenCL™ CPU Compiler and Runtime, specific options should be passed to the build options string parameter in the clBuildProgram function:
- -g flag enables source-level debug information generation.
NOTE:Passing a -g flag means that no optimizations (such as inlining, unrolling, vectorization) are performed, the same as if a -cl-opt-disable option was passed.
-s /full/path/to/OpenCL/source/file.cl option specifies the full path to the OpenCL™ source file. If the path includes spaces, the entire path should be enclosed with double or single quotes.
This option is required in cases where the source of an OpenCL™ kernel is passed to the clCreateProgramWithSource function as a string.
Only one file can be specified with the -s option. If the file contains one or more #include directives, multiple paths for files with the -s option are not needed.
Consider the following example of using the clBuildProgram function:
err = clBuildProgram( g_program, 0, NULL, "-g -s \"<path_to_opencl_source_file>\"", NULL, NULL);
Instead of passing the -s option to specify a path to an OpenCL source file, you can use one of the following approaches:
Use an Intel® SDK for OpenCL™ Applications - Offline Compiler.
Specifying the -s option is not necessary, as the path to an OpenCL source file is defined by the -input option:
ioc -cmd=build -input=kernel.cl '-bo=-g'
Pass a string with one or more #include directives to clCreateProgramWithSource.
In this case, the paths to included files are detected automatically:
const char* src = "#include kernel.cl"; cl_program program = clCreateProgramWithSource( m_context, 1, &src, NULL, &error);