From 26a544cfae53835058636bbeefca449af11cce95 Mon Sep 17 00:00:00 2001 From: Carsten Griwodz Date: Tue, 13 Feb 2018 14:11:24 +0000 Subject: [PATCH] workable thrust filter with cuda 7 --- src/popsift/s_filtergrid.cu | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/popsift/s_filtergrid.cu b/src/popsift/s_filtergrid.cu index 37238252..67211186 100644 --- a/src/popsift/s_filtergrid.cu +++ b/src/popsift/s_filtergrid.cu @@ -17,7 +17,7 @@ using namespace std; -#if (__CUDACC_VER__ >= 80000) && not defined(DISABLE_GRID_FILTER) +#if not defined(DISABLE_GRID_FILTER) #include #include @@ -67,18 +67,6 @@ struct FunctionExtractCell } }; -struct FunctionReversePosition -{ - const int _total; - FunctionReversePosition( int total ) : _total(total) { } - - __host__ __device__ - inline int operator()(int val) const - { - return _total - val - 1; - } -}; - struct FunctionIsAbove { int _limit; @@ -239,12 +227,14 @@ int Pyramid::extrema_filter_grid( const Config& conf, int ext_total ) // inclusive prefix sum thrust::inclusive_scan( h_cell_counts.begin(), h_cell_counts.end(), cell_count_prefix_sums.begin() ); - FunctionReversePosition fun_reverse_pos( n ); + thrust::host_vector h_reverse_index(n); + thrust::sequence( h_reverse_index.begin(), h_reverse_index.end(), + n-1, + -1 ); // sumup[i] = prefix sum[i] + sum( cell[i] copied into remaining cells ) thrust::transform( h_cell_counts.begin(), h_cell_counts.end(), - thrust::make_transform_iterator( thrust::make_counting_iterator(0), - fun_reverse_pos ), + h_reverse_index.begin(), cell_count_sumup.begin(), thrust::multiplies() ); thrust::transform( cell_count_sumup.begin(), cell_count_sumup.end(),