arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1505.05571math.NAcs.DCcs.NAstat.CO
收藏

利用小和大超累加器实现快速精确求和

Fast exact summation using small and large superaccumulators

University of Toronto(多伦多大学)

Radford M. Neal

AI总结:

本文提出两种新方法,通过精确求和并正确四舍五入,提高浮点数求和精度,适用于数据均值计算。方法利用超累加器概念,通过小和大超累加器组合实现高效精确求和,比简单求和更快且结果一致。

摘要:

我提出了两种新的方法,用于精确求和一组浮点数,并正确四舍五入到最近的浮点数。在许多应用中,比简单求和(每次加法后四舍五入)更高的精度是重要的,例如计算数据的样本均值。精确求和也保证了并行和串行实现的结果相同,因为精确的总和与顺序无关。新的方法使用超累加器概念的变种——超累加器是一种大固定点数,可以精确表示任何合理数量的浮点数之和。一种方法使用一个具有67个64位块的小超累加器,每个块与下一个块有32位的重叠,允许进位传播很少发生。当求和少量项时,单独使用小超累加器。对于大规模求和,还使用了大超累加器。它由4096个64位块组成,每个块对应可能的指数位和符号位的每一个组合,加上需要转移到小超累加器的块的计数。将项加到大超累加器时,只需更新一个块及其相关的计数,如果仔细实现,这需要非常少的指令。在现代64位处理器上,使用这种大和小超累加器组合精确求和一个大型数组的时间不到简单、不精确、有序求和时间的两倍,具有串行实现。使用少量处理器核心的并行实现可以预期能够以达到内存带宽限制的速度进行大型数组的精确求和。因此,一些试图在不精确的情况下提高精度的常见方法可能在至少对于大规模求和来说是无用的,因为它们比计算精确的总和要慢。

英文摘要:

I present two new methods for exactly summing a set of floating-point numbers, and then correctly rounding to the nearest floating-point number. Higher accuracy than simple summation (rounding after each addition) is important in many applications, such as finding the sample mean of data. Exact summation also guarantees identical results with parallel and serial implementations, since the exact sum is independent of order. The new methods use variations on the concept of a "superaccumulator" - a large fixed-point number that can exactly represent the sum of any reasonable number of floating-point values. One method uses a "small" superaccumulator with sixty-seven 64-bit chunks, each with 32-bit overlap with the next chunk, allowing carry propagation to be done infrequently. The small superaccumulator is used alone when summing a small number of terms. For big summations, a "large" superaccumulator is used as well. It consists of 4096 64-bit chunks, one for every possible combination of exponent bits and sign bit, plus counts of when each chunk needs to be transferred to the small superaccumulator. To add a term to the large superaccumulator, only a single chunk and its associated count need to be updated, which takes very few instructions if carefully implemented. On modern 64-bit processors, exactly summing a large array using this combination of large and small superaccumulators takes less than twice the time of simple, inexact, ordered summation, with a serial implementation. A parallel implementation using a small number of processor cores can be expected to perform exact summation of large arrays at a speed that reaches the limit imposed by memory bandwidth. Some common methods that attempt to improve accuracy without being exact may therefore be pointless, at least for large summations, since they are slower than computing the sum exactly.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑