当前位置:首页 > 报告详情

加速基于 GPU 的 Top-K 计算.pdf

上传人: li 编号:29468 2021-02-07 52页 1.42MB

1、NVIDIAACCELERATING TOP-KCOMPUTATION ON GPUChristina Zhang 8 Yong Wang#page#OUTLINEAlgorithms for Top-KOptimizing WarpSelectOptimizing Radix Select#page#PROBLEM DEFINITIONTop-K:find k smallest (or largest) elements in a list of Nelements.For example,whenN=8,k=3:34615827#page#TWO USEFUL ENHANCEMENTS I

2、N PRACTICEbatch processingreturn also the index3461583OO4index01234567287S4628346#page#ALGORITHM 1: SORTINGinput3461582217sorted112134567884advantage: highly efficient sorting algorithms for GPU existdisadvantage:do more work than necessaryGPU implementatiion: cub:DeviceRadixSort from CUB library#pa

3、ge#ALGORITHM 2: PRIORITY QUEUE (PQ)maintain a PQof size k,and try to insert elements one after one:PO642PQY642介432a failed insertiona successful insertionadvantages:read data only once, can handle streaming data efficient when k is smallDisadvantage:depending on the implementation of PQ,the time com

4、plexity is usually at least proportional to log kinefficient when kis largeGPU implementation: WarpSelect from FAISS Library (https:/ PQ is commonly implemented with Heap for CPU.using parallel sorting can be more effiicient on GPU.#page#ALGORITHM 3: SELECTION + FILTERa closely related problem is K-

5、selection Problem:find the k-th smallest(or largest)element ina list of Nelementsinput 34161518217selectionl31416111518|217filter by3H2eep aepauu sululeuleu nle kq sinsal ydo uanalo paypou aq ue suuosie uoas auos aou)thus dont neeed the filter step)#page#ALGORITHM 3: SELECTION + FILTERmany sorting a

6、lgorithms have corresponding selection algorithms:sortingselectionquicksortquick selectsamplesortsample selectradix sortradix selectadvantages: selection algorithm usually has time complexity O(N),so efficient when kand Nare largedisadvantages: may need to read input multiple timesGPU implementation

word格式文档无特别注明外均可编辑修改,预览文件经过压缩,下载原文更清晰!
三个皮匠报告文库所有资源均是客户上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作商用。
本文主要介绍了在GPU上加速Top-K计算的方法。首先,作者定义了Top-K问题,即在N个元素中找到最小的k个元素。然后,作者提出了三种算法:排序、优先队列和选择+过滤。排序算法虽然高效,但需要读取输入多次;优先队列算法只读取一次数据,但当k较大时效率较低;选择+过滤算法通常具有O(N)的时间复杂度,当k和N都较大时效率较高。 接着,作者详细介绍了WarpSelect和RadixSelect两种GPU实现。WarpSelect使用单个warp(GPU上的32个线程)来维护一个优先队列,插入操作由warp使用奇数大小合并网络完成。RadixSelect则通过并行实现,每次迭代使用8位/次来执行基数选择。 作者还讨论了如何优化这些算法的占用率,以及如何根据数据大小实现不同的实现。实验结果显示,当批量大小较大时,使用较少线程的实例可以提高GPU的饱和度。 总的来说,本文通过提出和优化不同的算法,展示了在GPU上加速Top-K计算的有效性。
如何优化GPU上的Top-K计算? WarpSelect和BlockSelect有何不同? 不同数据大小如何影响Radix Select的性能?
客服
商务合作
小程序
服务号
折叠