Intel® oneAPI Data Parallel C++
Support for Intel® oneAPI DPC++ Compiler, Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and GDB*
Announcements
The Intel sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.

Using printf inside kernel code

student4
Beginner
335 Views

Hi,

 

This screenshot is taken from Intel oneAPI Programming Guide(pg 44).

student4_0-1649406899056.png

 

According to the documentation, printf can be used inside the kernel code for debugging.
But when I used inside my kernel code, it shows an error 'sycl kernel cannot call undefined function'.
q.submit([&](sycl::handler& h){
h.single_task([=]() {
printf
});
});

 

Appreciate your help.

Thank you.

0 Kudos
3 Replies
QM
Employee
317 Views

That's because you are not calling the function with right syntax. printf(...) is in cl::sycl::ext::oneapi::experimental namespace, you need to specify a namespace for an external function. I would recommend using sycl::stream for the ease of use. 

HemanthCH_Intel
Moderator
278 Views

Hi,


We haven't heard back from you. Could you please provide any updates on your issue?


Thanks & Regards,

Hemanth


HemanthCH_Intel
Moderator
260 Views

Hi,


We assume 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,

Hemanth


Reply