开发者

CUDA exp() expf() and __expf()

How to 开发者_C百科optimize the exp function in cuda? What are the differences between the following in CUDA??

   exp()
   expf()
   __expf()


The differences are explained in the CUDA C Programming Guide, appendix D.

  • exp() should be used for double precision, although should be overloaded for single
  • expf() should be used for single precision (float)
  • __expf() is the fast-math version, the performance is faster with some loss of precision (dependent on the input value, see the guide for more details).


Generally exp() is for doubles, expf() for floats and both are slightly slower than __exp() which is available as a hardware operation. The performance gain usually comes at the cost of accuracy but unless you are really concerned about accuracy it shouldn't be a problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜