简体   繁体   English

CUDA中的双精度浮点

[英]Double precision floating point in CUDA

Does CUDA support double precision floating point numbers? CUDA是否支持双精度浮点数?

Also, what are the reasons for the same? 另外,同样的原因是什么?

If your GPU has compute capability 1.3 then you can do double precision. 如果您的GPU具有计算能力1.3,那么您可以进行双精度。 You should be aware though that 1.3 hardware has only one double precision FP unit per MP, which has to be shared by all the threads on that MP, whereas there are 8 single precision FPUs, so each active thread has its own single precision FPU. 您应该知道,1.3硬件每个MP只有一个双精度FP单元,必须由该MP上的所有线程共享,而有8个单精度FPU,因此每个活动线程都有自己的单精度FPU。 In other words you may well see 8x worse performance with double precision than with single precision. 换句话说,您可能会发现双精度性能比单精度高8倍。

As a tip: 作为提示:

If you want to use double precision you have to set the GPU architecture to sm_13 (if your GPU supports it). 如果要使用双精度,则必须将GPU架构设置为sm_13 (如果您的GPU支持它)。

Otherwise it will still convert all doubles to floats and gives only a warning (as seen in faya's post). 否则它仍然会将所有双打转换为浮点数并仅发出警告(如faya的帖子中所示)。 (Very annoying if you get a error because of this :-) ) (如果你因为这个问题得到错误,非常烦人:-))

The flag is: -arch=sm_13 标志是: -arch=sm_13

Following on from Paul R's comments, Compute Capability 2.0 devices (aka Fermi) have much improved double-precision support, with performance only half that of single-precision. 根据Paul R的评论,Compute Capability 2.0设备(又名Fermi)具有更高的双精度支持,性能仅为单精度的一半。

This Fermi whitepaper has more details about the double performance of the new devices. 这篇Fermi白皮书详细介绍了新设备的双重性能。

As mentioned by others, older CUDA cards don't support the double type. 正如其他人所说,旧的CUDA卡不支持double类型。 But if you want more precision than the one your old GPU provides you can use the float-float solution which is similar to the double-double technique. 但是如果你想要比你的旧GPU提供的更精确,你可以使用类似于双重双重技术的float-float解决方案。 For more information about that technique read 有关该技术的更多信息,请阅读

Of course on modern GPUs you can also use double-double to achieve an accuracy larger than double. 当然,在现代GPU上,你也可以使用双倍来实现大于两倍的精度。 double-double is also used for long double on PowerPC 在PowerPC上, double-double也用于long double

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM