2
votes

I look on the profiling results and see that thrust::min_element() calls cudaMalloc(), hence uses the additional memory. I do not need the array data after the reduction, so would prefer to find the minimal element in-place. Is it possible?

1
Your array is already in device memory? - geek
Yes, it is already there - AdelNick
thrust::min_element is not really a reduction, but a search. This is a good question. It could be generalized to ask if it's possible to make faster search algorithms on the GPU if the algorithms are allowed to destroy the input data. - Roger Dahl
@RogerDahl min / max is a reduction. You don't do search in parallel. - Pavan Yalamanchili
@RogerDahl: min and max are not searches. They are associative binary functions, and reduction is the general parallel application of any suitable associative binary function over an input set. - talonmies

1 Answers

1
votes

Thrust's reductions only use O(1) temporary storage (actually O(#processors)), but if you insist on managing the allocations yourself, you can implement your own custom allocation scheme.