C++ functions comp_ellint_1, comp_ellint_2, comp_ellint_3 on a GPU?


I am just getting started with GPUs and CUDA programming. My interest is to accelerate a code in which the complete elliptic integrals of first, second, and third kind are repeatedly computed for different values. There are c++ standard functions for these integrals but I need to make them faster for my purposes. Can I do that with CUDA on a GPU?

Any help is highly appreciated.

Best Joerg

For background: What’s the general application area of the code in question? Astronomy?

To my knowledge, complete elliptic integrals are not part of the CUDA math library, but I would suggest double checking the documentation. If you can’t find them in the docs, you might want to file an enhancement request with NVIDIA for adding them. An enhancement request will not guarantee that they will materialize any time soon, but without an enhancement request it is pretty much guaranteed they will not do so.

These functions were added in C++2017, and I am generally not sure where NVIDIA is with C++2017 support in CUDA. It is likely still a work in progress. Does the Boost library have GPU support? If so, that may be your your best bet for getting elliptic integrals to work in device code.

Looking at the Wikipedia description of these functions, it looks like creating accurate and robust implementations of these functions would take a considerable amount of work (man months).


I had a quick look at the boost webpage. Concerning GPU support I found the following:

[i]What compute devices (e.g. GPUs) are supported?

Any device which implements the OpenCL standard is supported. This includes GPUs from NVIDIA, AMD, and Intel as well as CPUs from AMD and Intel and other accelerator cards such as the Xeon Phi. [/i]

Does this mean that I have to use OpenCL?

Best Joerg

Bummer. I am heavily biased in favor of CUDA. That said, I couldn’t recommend in good conscience that someone pursue OpenCL at this point in time.

thank you very much for your help. The application is actually for fMRI. I would like to compute magnetic fields and these integrals are involved. Could I ask you for a very last favor with my last questions?

Do I place the enhancement request under the following link?


Do you mean the following webpage with documentation of the CUDA math library or is there another more development oriented documentation?


For feature requests, please use the bug reporting form and prefix the synopsis with “RFE:” to mark it as a “request for enhancement”, rather than a functional bug.

For CUDA math library documentation, see https://docs.nvidia.com/cuda/cuda-math-api/index.html

Great thanks!