Community
cancel
Showing results for 
Search instead for 
Did you mean: 
nnain1
New Contributor I
218 Views

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

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

Tags (1)
0 Kudos
10 Replies
AbhishekD_Intel
Moderator
218 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.

AbhishekD_Intel
Moderator
218 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

 

GouthamK_Intel
Moderator
218 Views

Hi Nyan,

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

 

Regards

Goutham

nnain1
New Contributor I
218 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?

AbhishekD_Intel
Moderator
218 Views

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

nnain1
New Contributor I
218 Views

I'm using 2021.1-beta03 this version.

AbhishekD_Intel
Moderator
218 Views

Hi,

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

Thank you

-Abhishek

Alina_S_Intel
Employee
218 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

Jens_B_Intel
Employee
218 Views

Can you try COMPILE instead of BUILD

 

set CL_CONFIG_USE_NATIVE_DEBUGGER=1

set SYCL_PROGRAM_COMPILE_OPTIONS=-g -cl-opt-disable  

Alina_S_Intel
Employee
218 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! 

Reply