Intel® oneAPI Data Parallel C++
Support for Intel® oneAPI DPC++ Compiler, Intel® oneAPI DPC++ Library, Intel ICX Compiler , Intel® DPC++ Compatibility Tool, and GDB*

Using printf inside kernel code

student4
Beginner
538 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
520 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. 

0 Kudos
HemanthCH_Intel
Moderator
481 Views

Hi,


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


Thanks & Regards,

Hemanth


0 Kudos
HemanthCH_Intel
Moderator
463 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


0 Kudos
Reply