Priority queues are data structures that maintain a dynamic collection of elements and allow inserting new elements and removing the smallest element. The most widely known and used priority queue is likely the implicit binary heap, even though it is has frequent cache misses and is hard to optimize using e.g. SIMD instructions. We introduce the SimdQuickHeap, a variant of the QuickHeap that was introduced by Navarro and Paredes in 2010. As suggested by the name, the data structure bears some similarity to QuickSort. We modify the data layout of the original QuickHeap to have all \emph{pivots} adjacent in memory, with elements between consecutive pivots stored in dedicated \emph{buckets}. This allows efficient SIMD implementations for both partitioning of buckets and scanning the list of pivots to find the bucket to append newly inserted elements to. The SimdQuickHeap has amortized expected complexity $O(\log n)$ per operation, which improves to $O(\frac 1W\log n)$ in non-degenerate cases, where $W$ is the number of words in a SIMD register. In this case, the I/O-complexity is amortized $O(\frac 1B)$ per push and $O(\frac 1B \log_2 \frac nM)$ per pop. In synthetic benchmarks, the SimdQuickHeap is up to twice as fast as the next-best competitor, including the non-comparison radix heap, and needs around $1.5\log_2 n$ comparisons and $\log_2 n$ nanoseconds per pair of push and pop operations. On graph benchmarks with Dijkstra's shortest path algorithm and Jarnik-Prim's minimum spanning tree algorithm, the SimdQuickHeap is consistently the fastest.


翻译:优先队列是一种维护动态元素集合的数据结构,支持插入新元素和移除最小元素。最广为人知和使用的优先队列可能是隐式二叉堆,尽管它存在频繁的缓存未命中问题,且难以通过SIMD指令等方法优化。我们提出了SimdQuickHeap,这是纳瓦罗(Navarro)和帕雷德斯(Paredes)于2010年提出的QuickHeap的一种变体。顾名思义,该数据结构与QuickSort具有一定的相似性。我们对原始QuickHeap的数据布局进行了修改,使所有*枢轴*在内存中相邻排列,而相邻枢轴之间的元素则存储在专用的*桶*中。这使得我们可以为桶的分区以及扫描枢轴列表以找到插入新元素的目标桶,实现高效的SIMD实现。SimdQuickHeap的每操作平摊期望复杂度为$O(\log n)$,在非退化情况下可改进至$O(\frac 1W\log n)$,其中$W$是SIMD寄存器中的字长。在此情况下,其I/O复杂度为每次push操作平摊$O(\frac 1B)$,每次pop操作平摊$O(\frac 1B \log_2 \frac nM)$。在合成基准测试中,SimdQuickHeap的速度是次优竞争算法(包括非比较型基数堆)的两倍,且每对push和pop操作平均需要约$1.5\log_2 n$次比较和$\log_2 n$纳秒。在使用Dijkstra最短路径算法和Jarnik-Prim最小生成树算法的图基准测试中,SimdQuickHeap始终是最快的。

0
下载
关闭预览

相关内容

【牛津博士论文】序列机器学习的应用与方法论,137页pdf
12篇顶会论文,深度学习时间序列预测经典方案汇总!
专知会员服务
55+阅读 · 2022年4月11日
Seq2seq强化,Pointer Network简介
机器学习算法与Python学习
15+阅读 · 2018年12月8日
从Seq2seq到Attention模型到Self Attention(一)
量化投资与机器学习
76+阅读 · 2018年10月8日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
9+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
VIP会员
相关主题
最新内容
《无人机对海面作战影响评估》
专知会员服务
11+阅读 · 7月21日
印度精确打击与指挥架构的断层
专知会员服务
6+阅读 · 7月20日
美空军AI完成F-16战斗机自主空战历史性试飞
专知会员服务
6+阅读 · 7月20日
深入Project Maven:为何人工智能在战场上依然失灵
锻造未来士兵:外骨骼、基因工程与赛博格
专知会员服务
8+阅读 · 7月19日
相关VIP内容
【牛津博士论文】序列机器学习的应用与方法论,137页pdf
12篇顶会论文,深度学习时间序列预测经典方案汇总!
专知会员服务
55+阅读 · 2022年4月11日
相关基金
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
9+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
Top
微信扫码咨询专知VIP会员