Skip to main content
QUICK REVIEW

[论文解读] An Efficient Multiway Mergesort for GPU Architectures

Henri Casanova, John Iacono|arXiv (Cornell University)|Feb 26, 2017
Parallel Computing and Optimization Techniques参考文献 29被引用 3
一句话总结

本文提出了一种新型的GPU多路归并排序算法——GPU多路归并排序(MMS),通过一种新的并行划分技术,实现了全局内存访问次数的渐近最优,并消除了共享内存银行冲突。MMS在冲突敏感型输入上显著优于最先进的库(如Thrust和MGPU),分别实现了最高44.3%和37.6%的加速比,得益于其无银行冲突的设计和I/O效率。

ABSTRACT

Sorting is a primitive operation that is a building block for countless algorithms. As such, it is important to design sorting algorithms that approach peak performance on a range of hardware architectures. Graphics Processing Units (GPUs) are particularly attractive architectures as they provides massive parallelism and computing power. However, the intricacies of their compute and memory hierarchies make designing GPU-efficient algorithms challenging. In this work we present GPU Multiway Mergesort (MMS), a new GPU-efficient multiway mergesort algorithm. MMS employs a new partitioning technique that exposes the parallelism needed by modern GPU architectures. To the best of our knowledge, MMS is the first sorting algorithm for the GPU that is asymptotically optimal in terms of global memory accesses and that is completely free of shared memory bank conflicts. We realize an initial implementation of MMS, evaluate its performance on three modern GPU architectures, and compare it to competitive implementations available in state-of-the-art GPU libraries. Despite these implementations being highly optimized, MMS compares favorably, achieving performance improvements for most random inputs. Furthermore, unlike MMS, state-of-the-art algorithms are susceptible to bank conflicts. We find that for certain inputs that cause these algorithms to incur large numbers of bank conflicts, MMS can achieve up to a 37.6% speedup over its fastest competitor. Overall, even though its current implementation is not fully optimized, due to its efficient use of the memory hierarchy, MMS outperforms the fastest comparison-based sorting implementations available to date.

研究动机与目标

  • 设计一种GPU排序算法,以最小化全局内存访问次数并消除共享内存银行冲突。
  • 解决现有GPU排序库因数据依赖的银行冲突导致的性能下降问题。
  • 基于GPU架构的并行外部内存(PEM)模型,设计一种理论基础扎实、I/O高效的排序算法。
  • 证明在现代GPU上,多路归并排序方法在实际应用中可优于标准的两两归并排序。
  • 识别并优化初始MMS实现中的性能瓶颈,特别是归并阶段的线程通信问题。

提出的方法

  • 该算法采用一种新颖的并行划分方法,将输入数据分布到多个线程,暴露适合GPU执行的高层并行性。
  • 基于最小块堆(minBlockHeap)结构,采用多路归并策略,高效合并多个已排序的子数组。
  • 设计确保所有全局内存访问均为合并访问,且访问次数渐近最优,与PEM模型中的理论下界一致。
  • 通过精心设计的数据访问模式,避免同时访问同一银行,从而在不产生银行冲突的情况下使用共享内存。
  • 在 warp 内部使用位序归并网络来归并小规模子数组(每个32个元素),但该组件被识别为性能瓶颈。
  • 在三种现代GPU架构上实现并评估该算法,与高度优化的库(如Thrust和MGPU)进行比较。

实验结果

研究问题

  • RQ1能否为GPU设计一种多路归并排序算法,使其既I/O最优又无共享内存银行冲突?
  • RQ2与高度优化的两两归并排序库(如Thrust和MGPU)相比,一种I/O最优且无银行冲突的排序算法性能如何?
  • RQ3现有GPU排序库中的银行冲突在非均匀输入分布下对性能的损害程度如何?
  • RQ4所提出的MMS实现中的主要性能瓶颈是什么,如何加以解决?
  • RQ5MMS的理论I/O效率在不同GPU架构和输入类型下能否转化为实际的性能提升?

主要发现

  • MMS实现了渐近最优的全局内存访问次数,与并行外部内存(PEM)模型中的理论下界一致。
  • 该算法完全消除了共享内存银行冲突,因此其性能不受输入排列模式的影响。
  • 在随机输入下,MMS与Thrust和MGPU的性能相当,吞吐量相似或略优。
  • 在冲突密集型输入下,MMS在Gibson GPU平台上相较于Thrust和MGPU分别实现了最高44.3%和37.6%的加速比。
  • 划分阶段耗时不足总执行时间的2%,表明主要性能瓶颈存在于归并阶段,尤其是minBlockHeap结构中的线程通信。
  • 归并阶段的性能瓶颈归因于使用位序归并网络的32线程warp之间存在较高的通信开销,表明优化该组件可带来显著的性能提升。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。