Intel® oneAPI DPC++/C++ Compiler
Talk to fellow users of Intel® oneAPI DPC++/C++ Compiler and companion tools like Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and Intel® Distribution for GDB*
718 Discussions

Is it possible to see variables in kernel in debug in Visual Studio?

nnain1
New Contributor I
2,838 Views

As shown in the following image, trying to debug line by line of my source code.

Is it possible to see variable in kernal code? I can set breakpoint, but can't reach to that line in running the code.

Followed all instructions here for Windows using Visual Studio.

https://software.intel.com/en-us/get-started-with-debugging-dpcpp-windows

How can I debug variables in kernel code?

debug.png

0 Kudos
11 Replies
AbhishekD_Intel
Moderator
2,842 Views

Hello Nyan,

Please confirm that you have edited the Registry Editor properly with proper type and value.

I just wanted to share some limitation with you, regarding windows debugger you can find them at this link.

It is possible to see the variables present in Kernel.

For Linux, you can directly use gdb-oneapi to debug ger to debug your code.

0 Kudos
AbhishekD_Intel
Moderator
2,842 Views

Here, I have attached the screenshots showing how you can see variables present inside the Kernel in debugger using Windows and Visual Studio.

-Abhishek

 

0 Kudos
GouthamK_Intel
Moderator
2,848 Views

Hi Nyan,

Could you please let us know if your issue got resolved or not.

 

Regards

Goutham

0 Kudos
nnain1
New Contributor I
2,849 Views

As you can see below, I have set at Registry Editor.

regdedit.png

Then I made sure I have the followings.

Start Microsoft Visual Studio* Project

Run the x64 Native Tools Command Prompt for Microsoft Visual Studio* 2017 or Microsoft Visual Studio* 2019.

In the Microsoft Visual Studio terminal, set environment variables by running the following code:

set CL_CONFIG_USE_NATIVE_DEBUGGER=1

set SYCL_PROGRAM_BUILD_OPTIONS=-g -cl-opt-disable

Run the following command to start Microsoft Visual Studio:

devenv.exe

Build the Application

With Microsoft Visual Studio*, open a DPC++ project and add the sample application array-transform.cpp shipped with this release.

Go to Project > Properties > General and set Platform Toolset to Intel® oneAPI DPC++ Compiler.

Build the solution. In the Output window, verify that the build is successfull.

Setup Project Debugging Properties

Go to Project > Properties > Debugging and add the following value to the Environment field:

SYCL_DEVICE_TYPE=CPU

But I can't stop at line in kernel at A[index] = index[0] * 2 + index[1]; in the following code.

myQueue.submit([&](handler& cgh) {
        // The kernel write a, so get a write accessor on it
        auto A = a.get_access<access::mode::write>(cgh);
        // Enqueue a parallel kernel iterating on a N*M 2D iteration space
        cgh.parallel_for<class init_a>(range<2> {N, M}, [=](id<2> index) {
            A[index] = index[0] * 2 + index[1];
        });
 });

What could be issue?

0 Kudos
AbhishekD_Intel
Moderator
2,848 Views

Can you tell us the version of beta-toolkit you are using?

0 Kudos
nnain1
New Contributor I
2,848 Views

I'm using 2021.1-beta03 this version.

0 Kudos
AbhishekD_Intel
Moderator
2,849 Views

Hi,

We have forwarded your issue to our concerned team, you will get a response soon.

Thank you

-Abhishek

0 Kudos
Alina_S_Intel
Employee
2,849 Views

Hello Nyan,

Thank you for your question. Unfortunately, I confirm this issue for beta5, too. I have reported this case to our Developers.

Kind regards,

Alina

0 Kudos
Jens_B_Intel
Employee
2,848 Views

Can you try COMPILE instead of BUILD

 

set CL_CONFIG_USE_NATIVE_DEBUGGER=1

set SYCL_PROGRAM_COMPILE_OPTIONS=-g -cl-opt-disable  

0 Kudos
Alina_S_Intel
Employee
2,849 Views

In addition to all the settings discussed earlier, please, navigate Tools -> Options -> Debugging and unset Require Source Files.

Jens, thanks again for your help! 

0 Kudos
AbhishekD_Intel
Moderator
2,619 Views

Hi,


As this issue is already resolved, we will no longer monitor this issue. You may post a new thread if you have any other issues.

Please go through the Getting Started Guide for more details:

https://software.intel.com/content/www/us/en/develop/documentation/get-started-with-debugging-dpcpp-windows/top.html



Warm Regards,

Abhishek


0 Kudos
Reply