sorting a small shared array

Hello everyone,

Does someone has a code snippet for sorting an array of floats in CUDA? I have a small shared array of 216 elements and I would like to sort it from ascending to descending.

So, I have something like this:


shared float localArray[216];

localArray[current] = someValue;


// sorting routine here


My array is quite small and the sorting routine does not have to be very complicated, I guess.



EDIT: Actually, I realized that I need to do the sorting in another kernel, but the sorting bit still remains to be solved…

Check out the bitonic sort example in the SDK, it just needs a little minor tweaking to sort floats instead of integers.