|
17 | 17 |
|
18 | 18 | using namespace std; |
19 | 19 |
|
20 | | -#if (__CUDACC_VER__ >= 80000) && not defined(DISABLE_GRID_FILTER) |
| 20 | +#if not defined(DISABLE_GRID_FILTER) |
21 | 21 |
|
22 | 22 | #include <thrust/device_vector.h> |
23 | 23 | #include <thrust/sequence.h> |
@@ -67,18 +67,6 @@ struct FunctionExtractCell |
67 | 67 | } |
68 | 68 | }; |
69 | 69 |
|
70 | | -struct FunctionReversePosition |
71 | | -{ |
72 | | - const int _total; |
73 | | - FunctionReversePosition( int total ) : _total(total) { } |
74 | | - |
75 | | - __host__ __device__ |
76 | | - inline int operator()(int val) const |
77 | | - { |
78 | | - return _total - val - 1; |
79 | | - } |
80 | | -}; |
81 | | - |
82 | 70 | struct FunctionIsAbove |
83 | 71 | { |
84 | 72 | int _limit; |
@@ -239,12 +227,14 @@ int Pyramid::extrema_filter_grid( const Config& conf, int ext_total ) |
239 | 227 | // inclusive prefix sum |
240 | 228 | thrust::inclusive_scan( h_cell_counts.begin(), h_cell_counts.end(), cell_count_prefix_sums.begin() ); |
241 | 229 |
|
242 | | - FunctionReversePosition fun_reverse_pos( n ); |
| 230 | + thrust::host_vector<int> h_reverse_index(n); |
| 231 | + thrust::sequence( h_reverse_index.begin(), h_reverse_index.end(), |
| 232 | + n-1, |
| 233 | + -1 ); |
243 | 234 |
|
244 | 235 | // sumup[i] = prefix sum[i] + sum( cell[i] copied into remaining cells ) |
245 | 236 | thrust::transform( h_cell_counts.begin(), h_cell_counts.end(), |
246 | | - thrust::make_transform_iterator( thrust::make_counting_iterator<int>(0), |
247 | | - fun_reverse_pos ), |
| 237 | + h_reverse_index.begin(), |
248 | 238 | cell_count_sumup.begin(), |
249 | 239 | thrust::multiplies<int>() ); |
250 | 240 | thrust::transform( cell_count_sumup.begin(), cell_count_sumup.end(), |
|
0 commit comments