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

Support for bessel functions inside a SYCL kernel

RCB1
Novice
1,877 Views

Hello

I am trying to test some SYCL kernels in oneAPI DPC++ that have Bessel  function calls inside the parallel_for loop of the kernel.

If I use either Boost or the Standard library, or the Intel mathimf.h library as shown below, I get compile time errors.

    float f1 = boost::math::cyl_bessel_j(0.0f, 1.0f);
    float f2 = std::cyl_bessel_j(0.0f, 1.0f);

    float f3 = j0f(1.0f);

Is there support for Bessel functions in SYCL kernels.

 

The source file is a modification of vector-add-buffers.cpp in the samples, and the compiler output is attached in errors.txt.

 

Thanks

RCB

0 Kudos
1 Solution
Alex_Y_Intel
Moderator
1,826 Views

For your vector-add-buffers.cpp code, only "float f3 = j0f(1.0f)" can work, but the proper usage is "float f3 = ext::intel::math::j0(1.0f);" and you need to include "#include <sycl/ext/intel/math.hpp>"

View solution in original post

0 Kudos
3 Replies
Alex_Y_Intel
Moderator
1,827 Views

For your vector-add-buffers.cpp code, only "float f3 = j0f(1.0f)" can work, but the proper usage is "float f3 = ext::intel::math::j0(1.0f);" and you need to include "#include <sycl/ext/intel/math.hpp>"

0 Kudos
RCB1
Novice
1,801 Views

Thank you Alex much appreciated - the sycl::ext::intel::math::j0(1.0f) works for me.  Incidentally is it out of the question that the Boost or the STL Bessel functions may work at some point as there is some additional functionality that I am interested in those libraries?

0 Kudos
Alex_Y_Intel
Moderator
1,755 Views

STL Bessel functions only work for host code but not SYCL kernels. We might file Boost and STL functions for feature requests if we get enough inquiries. 

0 Kudos
Reply