Skip to content

cyl_bessel_j functions (on device) #308

Open
@ax3l

Description

@ax3l

In ECP WarpX, we would like to use the cylindrical Bessel function of the first kind on device.

They are defined in the C++17 standard:
https://en.cppreference.com/w/cpp/numeric/special_functions/cyl_bessel_j

But compiling with those device functions errors as of the latest oneAPI/DPC++ compiler out with:

/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/tr1/bessel_function.tcc:495:14: error: SYCL kernel cannot call an undefined function without SYCL_EXTERNAL attribute
        std::__throw_domain_error(__N("Bad argument "
             ^
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/functexcept.h:66:3: note: '__throw_domain_error' declared here
  __throw_domain_error(const char*) __attribute__((__noreturn__));
  ^
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/tr1/bessel_function.tcc:492:5: note: called by '__cyl_bessel_j<float>'
    __cyl_bessel_j(_Tp __nu, _Tp __x)
    ^
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/tr1/bessel_function.tcc:207:14: error: SYCL kernel cannot call an undefined function without SYCL_EXTERNAL attribute
        std::__throw_runtime_error(__N("Argument x too large in __bessel_jn; "
             ^
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/functexcept.h:82:3: note: '__throw_runtime_error' declared here
  __throw_runtime_error(const char*) __attribute__((__noreturn__));
  ^
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/tr1/bessel_function.tcc:138:5: note: called by '__bessel_jn<float>'
    __bessel_jn(_Tp __nu, _Tp __x,
    ^
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/tr1/bessel_function.tcc:264:18: error: SYCL kernel cannot call an undefined function without SYCL_EXTERNAL attribute
            std::__throw_runtime_error(__N("Bessel y series failed to converge "
                 ^
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/functexcept.h:82:3: note: '__throw_runtime_error' declared here
  __throw_runtime_error(const char*) __attribute__((__noreturn__));
  ^
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/tr1/bessel_function.tcc:138:5: note: called by '__bessel_jn<float>'
    __bessel_jn(_Tp __nu, _Tp __x,
    ^
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/tr1/bessel_function.tcc:315:18: error: SYCL kernel cannot call an undefined function without SYCL_EXTERNAL attribute
            std::__throw_runtime_error(__N("Lentz's method failed "
                 ^
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/functexcept.h:82:3: note: '__throw_runtime_error' declared here
  __throw_runtime_error(const char*) __attribute__((__noreturn__));
  ^
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/tr1/bessel_function.tcc:138:5: note: called by '__bessel_jn<float>'
    __bessel_jn(_Tp __nu, _Tp __x,

It seems there is a similar error for jn/jnf as defined here: https://software.intel.com/content/www/us/en/develop/documentation/oneapi-dpcpp-cpp-compiler-dev-guide-and-reference/top/optimization-and-programming-guide/intel-math-library/math-functions/special-functions.html

I cannot spot jn(f) in the sycl:: namespace here: https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/C-CXX-StandardLibrary/C-CXX-StandardLibrary.rst

$ dpcpp --version
Intel(R) oneAPI DPC++ Compiler 2021.1.2 (2020.10.0.1214)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/intel/oneapi/compiler/2021.1.2/linux/bin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions