Debugging problem in Visual Studio 2017


#1

I am the very beginner in OpenCL programming. My problem occurs when I try to debug OpenCL kernels in Visual Studio 2017. Debugger don’t stop on breakpoints in kernel code but works fine in the Main function. I have installed Intel System Studio 2019.

I build context in this way:


cl_int platform_id = 0;
cl_int device_id = 0;
cl_context_properties contextProps[3] = {
    CL_CONTEXT_PLATFORM,
    (cl_context_properties)(platformList[platform_id])(),
    0
};

cl::Context context(CL_DEVICE_TYPE_GPU, contextProps, NULL, NULL, &errorState);

I try to build program with debugging options:


cl::Program program(context, source);
errorState = program.build(devices, "-g -s C:/OpenCL_Intel/OpenCL_Intel/multiply.cl");

After this I set parameters for kernel function and run the kernel:


cl::Kernel kernel(program, "multiply", &errorState);
kernel.setArg(0, inA);
kernel.setArg(1, inB);
kernel.setArg(2, outCL);
kernel.setArg(3, arraySize);

cl::Event event;
errorState = queue.enqueueNDRangeKernel(kernel, cl::NullRange,
    cl::NDRange(arraySize), cl::NDRange(1), NULL, &event);
checkErr(errorState, "ComamndQueue::enqueueNDRangeKernel()");

event.wait();
errorState = queue.enqueueReadBuffer(outCL, CL_TRUE, 0, sizeof(int) * arraySize, out);
checkErr(errorState, "ComamndQueue::enqueueReadBuffer()");

My debugging options in my OpenCL project:

[ATTACH=CONFIG]1966[/ATTACH]

I have also set some options in Code Builder:

[ul]
[li]API Debugger -> Enable OpenCL Tools API Debugger -> True
[/li][li]GPU Kernel Debugger -> Enable Debugging -> True
[/li][/ul]

Thank you in advance