Skip to content

Commit b8ddf1b

Browse files
author
Carsten Griwodz
authored
Merge pull request #35 from alicevision/cuda7filter
workable thrust filter with cuda 7
2 parents 8992a05 + 26a544c commit b8ddf1b

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

src/popsift/s_filtergrid.cu

+6-16
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
using namespace std;
1919

20-
#if (__CUDACC_VER__ >= 80000) && not defined(DISABLE_GRID_FILTER)
20+
#if not defined(DISABLE_GRID_FILTER)
2121

2222
#include <thrust/device_vector.h>
2323
#include <thrust/sequence.h>
@@ -67,18 +67,6 @@ struct FunctionExtractCell
6767
}
6868
};
6969

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-
8270
struct FunctionIsAbove
8371
{
8472
int _limit;
@@ -239,12 +227,14 @@ int Pyramid::extrema_filter_grid( const Config& conf, int ext_total )
239227
// inclusive prefix sum
240228
thrust::inclusive_scan( h_cell_counts.begin(), h_cell_counts.end(), cell_count_prefix_sums.begin() );
241229

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 );
243234

244235
// sumup[i] = prefix sum[i] + sum( cell[i] copied into remaining cells )
245236
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(),
248238
cell_count_sumup.begin(),
249239
thrust::multiplies<int>() );
250240
thrust::transform( cell_count_sumup.begin(), cell_count_sumup.end(),

0 commit comments

Comments
 (0)