Bessel functions in CUDA Fortran


Are Bessel functions available while programming with CUDA Fortran (especially using them implicitly in device subroutines). I am in need of BesselK0 and BesselK1, and I used them earlier by integrating a mathematical approximation for it in the device subroutine (which yields a lot of deficiencies at mass calculations).

Could I also have a device subroutine call a device function, that will include the Bessel functions if necessary? Are there any examples of that if available, of a thread executing a kernel that calls a function inside of it?

Thank you in advance.



Any ideas?
Should I clarify my question further?

Thank you for your attention


Hi Ahmed,

I added a feature request for these (TPR#20705). While it should be straight forward to add the j0, j1, jn, y0, y1, and yn functions since they are part of the CUDA C math libraries, the K0 and K1 functions may be a longer term project.

  • Mat

Hello Mat,

How about if I make a function subroutine on the device that is called from the kernel subroutine device. Is that possible? So that each thread would call the same function? Is that already a feature?


Hi Ahmad,

No, unfortunately you can’t just call these routines. We need to do some compiler work in order to get them recognized.

  • Mat