[论文解读] Parallel Quicksort without Pairwise Element Exchange
本文提出了一种无需交换的并行快速排序变体,通过仅分发枢纽元素而非成对元素交换来消除递归过程中的元素交换,将总通信量从$O(n\log p)$降低至$O(n)$。该方法使用MPI集体操作进行枢纽分发,并仅在递归底部执行一次元素重分布,使得在1024个进程上实现高达650倍的加速,当每个进程的元素数超过50万时,弱扩展性能比标准变体快1.3倍。
Quicksort is an instructive classroom approach to parallel sorting on distributed memory parallel computers with many opportunities for illustrating specific implementation alternatives and tradeoffs with common communication interfaces like MPI. The (two) standard distributed memory Quicksort implementations exchange partitioned data elements at each level of the Quicksort recursion. In this note, we show that this is not necessary: It suffices to distribute only the chosen pivots, and postpone element redistribution to the bottom of the recursion. This reduces the total volume of data exchanged from $O(n\log p)$ to $O(n)$, $n$ being the total number of elements to be sorted and $p$ a power-of-two number of processors, by trading off against a total of $O(p)$ additional pivot element distributions. Based on this observation, we describe new, \emph{exchange-free} implementation variants of parallel Quicksort and of Wagar's HyperQuicksort. We have implemented the discussed four different Quicksort variations in MPI, and show that with good pivot selection, Quicksort without pairwise element exchange can be significantly faster than standard implementations on moderately large problems.
研究动机与目标
- 消除分布式内存并行快速排序中的成对元素交换,以减少通信量并提升可扩展性。
- 探索在并行排序中,增加枢纽分发与减少元素交换之间的权衡。
- 仅使用MPI集体操作设计并实现无交换的快速排序和超快速排序变体。
- 在大规模集群上评估性能,并与标准的基于交换的实现进行比较。
- 结合基于交换和无交换的变体,实现在不同问题规模下的平滑扩展。
提出的方法
- 用MPI_Alltoallv和MPI_Allreduce进行枢纽选择,将递归中的成对元素交换替换为全局枢纽分发。
- 将实际元素重分布推迟到递归底部,高层级步骤仅使用枢纽信息。
- 在递归基底执行单次重分布,每个进程根据枢纽边界对其本地集合进行排序。
- 实现两种变体:一种用于标准快速排序,一种用于Wagar的超快速排序,两者均为无交换。
- 通过在每个进程的元素数超过阈值(例如c=1500)时切换到无交换模式,结合标准与无交换变体。
- 使用编号为0到p−1的MPI进程,其中p为2的幂,且假设初始负载均衡,每个进程拥有n/p个元素。
实验结果
研究问题
- RQ1在分布式内存快速排序中,能否在不降低性能的前提下消除成对元素交换?
- RQ2在递归快速排序中,交换元素与分发枢纽之间的通信成本权衡如何?
- RQ3在大规模集群上,无交换快速排序的性能与标准基于交换的快速排序相比如何?
- RQ4结合基于交换和无交换变体的混合方法是否能在不同问题规模下实现更好的可扩展性?
- RQ5每个进程的元素数达到何种阈值时,无交换变体比标准变体更高效?
主要发现
- 在1024个进程上,无交换快速排序对10^8个浮点数进行排序时实现了650倍的加速,显著优于标准变体。
- 在8192个进程的弱扩展测试中,当每个进程的元素数超过500,000时,无交换变体始终比标准变体快1.3倍。
- 组合式快速排序变体从未表现差于标准或无交换版本,在4096个进程上实现了超过1000倍的加速。
- 当每个进程的元素数较少(n/p < 100,000)时,无交换变体性能下降,原因在于高延迟的MPI_Alltoallv和MPI_Allreduce操作。
- 无交换方法将总通信量从$O(n\log p)$降低至$O(n)$,代价是额外的$O(p)$次枢纽分发。
- 结果在不同数据类型(双精度浮点数、整数)和输入分布(随机排列)下均表现稳健,中等到大问题规模下性能增益一致。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。