Reduction Operation to find the Minimum

Is there a reduction operation to find the minimum of an array of floats, either in the SDK or elsewhere?

I don’t know of an easiliy available one but I think you should be able to do this with the SDK reduction without too many changes. Just replace the a += b with a = min(a, b).

You can do that in one line using the thrust::min_element() function in Thrust.

Look through the Tutorialto get started.

how fast Thrust is? Comparing to pure CUDA?

Our reduction kernel is similar to the one in the CUDA SDK, so performance is basically the same (both are very fast).

Actually, we do somewhat better than the SDK code when your types are not 32 words (e.g. int, float). For example, when reducing small types like char (8-bits) or short (16-bits) we read in multiple values per thread to obtain better coalescing. On G80 this a tremendous improvement.

In general, we are mindful of performance and implement optimizations that have the highest impact. For example here’s a explanation of our sorting optimizations.

You might also take a look at CUDPP. I don’t think CUDPP v1.1 implements reduction, but v1.2 will.