Is there any way to optimize sincos calls in CUDA?

情到浓时终转凉″ 提交于 2019-12-02 02:04:49

问题


I'm writing a program in CUDA that makes a huge amount of calls to the sincos() function, using double precision. I'm afraid this is one of the biggest bottlenecks of the code, and I cannot reduce the number of calls to the function.

Is there any decent approximation to sincos in CUDA or in a library I can import? I am also quite concerned with the accuracy, so the better the approximation is, the happier my code will be.

I've also thought about building a lookup table or approximating the values with their taylor series, but I want some opinions before going down that road.


回答1:


A pretty fast and accurate sincos function is available in the CUDA math api. Just include math.h. Or use sincosf (here) if that will work for you. (I'm aware that you said double precision in your question. Just pointing some things out.)

If you can use sincospif instead of sincosf, @njuffa has worked his magic here, which may interest you.

This question and this question may also interest you.



来源:https://stackoverflow.com/questions/39176708/is-there-any-way-to-optimize-sincos-calls-in-cuda

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!