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*
713 Discussions

Beginner: Cannot set breakpoint when debugging DPC++ project in Visual Studio 2022

CHEN__PENGJU
Novice
1,641 Views

Hello,

 

I'm just a beginner of  DPC++ prgramming. (Previously I worked with Intel oneTBB and C++ threads). I have a "stupid" question:

 

when debugging the DPC++ code, I cannot set breakpoint after parallel_for, could anyone explain it? Thanks so much.

 Below is the code example from DPC++ book. 

___________________________

const int size = 16;
std::array<int, size> data;

sycl::property_list properties{ sycl::property::queue::enable_profiling() };
sycl::queue Q(sycl::cpu_selector_v);
sycl::buffer B(data);

//see selected devices
sycl::device divece_ = Q.get_device();
auto info = divece_.get_info<sycl::info::device::name>();
std::cout << "Selected device: " << info << std::endl;

Q.submit([&](sycl::handler& h) {
sycl::accessor A{ B, h };
h.parallel_for(size,
[=](auto& idx) {
A[idx] = idx; }
);
});
sycl::host_accessor A(B);

for (int i = 0; i < size; i++) {
std::cout << "data[" << i << "] = " << A[i] << std::endl; //FOR EXAMPLE, CANNOT STOP HERE
}

return;

_______________________________

Visual Studio shows the message "the breakpoint will not be hit, no executable code is associated with this line of code." 

my understanding is that the for loop after host_accessor is run on host, and should be stopped.

Could anyone help me point out where I'm wrong...

Thanks!

 

 

 

 

 

0 Kudos
2 Replies
CHEN__PENGJU
Novice
1,610 Views

Please close this post. I'm just notified to use Intel distribution for GBD......Sorry for making trouble.

0 Kudos
NoorjahanSk_Intel
Moderator
1,595 Views

Hi,

 

Thanks for posting in Intel Communities.

 

You can set the breakpoint by changing the below settings in Visual Studio:

Uncheck the option “Require source files to exactly match the original version” in Tools > Options > Debugging before you start debugging

 

Please refer to the below link for more details:

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

 

>>Please close this post

Glad to know that your issue is resolved. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.

 

Thanks & Regards,

Noorjahan.

 

0 Kudos
Reply