Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sorting 什么是最快的基数排序实现_Sorting_Cuda_Thrust - Fatal编程技术网

Sorting 什么是最快的基数排序实现

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

我是GPU编程的新手。最近,我正试图实现基于教程的gpu bvh构造算法:。在该算法的第一步中,计算并排序每个基元的莫顿码(无符号整数)。本教程给出了计算和排序12K对象的morton代码的参考时间成本:

  • 0.02毫秒,每个对象一个线程:计算边界框并指定Morton代码
  • 0.18毫秒,平行基数排序:根据对象的莫顿代码对对象进行排序。
  • 在我的实现中,第一步花费0.1ms,排序步骤花费1.8ms。我用推力做分类。那么,在GPU上实现基数排序的最快方法是什么

    我使用的Geforce Titan GPU应该比教程作者使用的Geforce GTX690更快。 这是我的排序测试代码,即使大小为10,也要花费1.5毫秒

    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有一个基数排序的实现方式。他们提供了一个性能比较图,声称他们的实现是最快的