Sorting 什么是最快的基数排序实现
我是GPU编程的新手。最近,我正试图实现基于教程的gpu bvh构造算法:。在该算法的第一步中,计算并排序每个基元的莫顿码(无符号整数)。本教程给出了计算和排序12K对象的morton代码的参考时间成本:Sorting 什么是最快的基数排序实现,sorting,cuda,thrust,Sorting,Cuda,Thrust,我是GPU编程的新手。最近,我正试图实现基于教程的gpu bvh构造算法:。在该算法的第一步中,计算并排序每个基元的莫顿码(无符号整数)。本教程给出了计算和排序12K对象的morton代码的参考时间成本: 0.02毫秒,每个对象一个线程:计算边界框并指定Morton代码 0.18毫秒,平行基数排序:根据对象的莫顿代码对对象进行排序。 在我的实现中,第一步花费0.1ms,排序步骤花费1.8ms。我用推力做分类。那么,在GPU上实现基数排序的最快方法是什么 我使用的Geforce Titan GP
void testSort()
{
int sz = 10;
thrust::host_vector<unsigned int> h_keys(sz);
for(int i=0; i<sz; i++)
h_keys[i] = rand();
thrust::device_ptr<unsigned int> keys = thrust::device_malloc<unsigned int>(sz);
thrust::copy(h_keys.begin(),h_keys.end(),keys);
cudaEvent_t estart, estop;
cudaEventCreate( &estart );
cudaEventCreate( &estop );
cudaEventRecord( estart, 0 );
thrust::stable_sort(keys,keys+sz);
cudaEventRecord( estop, 0 ) ;
cudaEventSynchronize( estop );
float elapsedTime;
cudaEventElapsedTime( &elapsedTime,
estart, estop ) ;
printf( "Time to sort: %3.1f ms\n", elapsedTime );
cudaEventDestroy( estart ) ;
cudaEventDestroy( estop ) ;
}
void testSort()
{
int sz=10;
推力:主机_向量h_键(sz);
对于(inti=0;i,GPGPU有一个基数排序的实现方式。他们提供了一个性能比较图,声称他们的实现是最快的