CUDA FORTRAN rsqrt()

Hi All,

Is rsqrt() available in CUDA FORTRAN? I’m using the LibM module in the relevant subroutine and erf(), for example, is available and working. However, when I try to use rsqrt(), I get the following:

PGF90-S-0155-Calls from device code to a host function are allowed only in emulation mode - rsqrt
PGF90-S-0038-Symbol, rsqrt, has not been explicitly declared

I’ve tested it for PGI versions 13.5 through 13.10 and, where available, CUDA 4.2, 5.0 and 5.5.

Please provide a usage example of rsqrt() if it is available.

Cheers,
Kyle

Hi Kyle,

“rsqrt” isn’t in libm nor is it part of Fortran. We’re looking at how we can get these CUDA C extensions (like sincos, rsqrt, shfl) to be recognized in CUDA Fortran, but it’s not in as of yet. Can you change your code to use “1/SQRT(x)” instead?

  • Mat

Hi Mat,

Thanks for clearing that up. I can, and I am, using 1/sqrt() instead. I’m just interested in using rsqrt() because, as far as I know, it will perform better than 1/sqrt().

Cheers,
Kyle

Hi Mat,

I’m resurrecting this post based on your comment in https://forums.developer.nvidia.com/t/bessel-functions-in-cuda-fortran/134183/1

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

Does your comment also hold for rsqrt()?

All the best,
Kyle

Awfully lonely in here…8{

Hi Kyle,

Sorry I missed your post. I was out of the office quite a bit at the end of July.

I added “rsqrt” to TPR#20705. Let see what our engineers can do.

  • Mat

Just a small aside: I haven’t tested rsqrt, but ‘sincos’ is already used as an optimization when sine/cosine is used in consecutive lines with the same argument. (This became apparent when I analysed some generated CUDA C code from OpenACC code about two years ago, where I was surprised about the high performance). Maybe rsqrt can also be generated by the optimizer?

Hey Mat,

Thanks for the reply and no need to apologize…I assumed this one had managed to slip through the cracks. I’ll keep an eye out for TPR#20705.