Debugging OpenCL™ Kernels

This topic demonstrates how to use the Intel® SDK for OpenCL™ Applications - GPU Kernel Debugger to debug an OpenCL™ sample application on a Microsoft Windows* OS.

To debug your OpenCL kernels on GPU using Intel SDK for OpenCL Applications - GPU Kernel Debugger on a Microsoft Windows* OS, perform the following steps:

  1. On the target machine, launch the Remote Debugger:

    Note

    Make sure that the version of the Visual Studio Remote Debugger you run on the target machine, matches the version of the Visual Studio IDE you use on the host machine. For example, if you are using Visual Studio 2015 on the host, you should use Visual Studio 2015 Remote Debugger on the target machine.

  2. On the host machine, start Microsoft Visual Studio* 2015/2017, go to Tools > Options > Code Builder > GPU Kernel Debugger, set Enable Debugging to True and change the Server field to the name of the target machine (localhost in this example):

  3. Add the OpenCL kernel file to your project (if it is not part of the project yet), and set breakpoints where needed.
  4. Build your project and copy the executable and .cl files to the working directory on your target machine.
  5. Configure your project for remote C++ Debugging:
    1. Right click on your project, choose Properties, open Configuration Properties > Debugging and select Remote Windows Debugger in the Debugger to launch list:

    2. Set Remote Command to the full path to your executable on the target machine.
    3. Set Working Directory to the directory where the binary file is located.
    4. Set Remote Server name to be the host name of your target machine.
    5. Click OK:

  6. After the dialog is closed, click on Remote Windows Debugger, or press F5:

  7. If you configured the project properly, the debugger stops execution at the breakpoints you have set:

For more complete information about compiler optimizations, see our Optimization Notice.