<para>cudaFlow provides template methods to create parallel sort tasks on a CUDA GPU.</para><sect1id="cudaFlowSort_1cudaFlowSortARangeofItems">
<title>Sort a Range of Items</title>
<para><refrefid="classtf_1_1cudaFlow_1ae462d455fed06dfcdbd1e25a2c9c5da6"kindref="member">tf::cudaFlow::sort</ref> performs an in-place parallel sort over a range of elements specified by <computeroutput>[first, last)</computeroutput> using the given comparator. The following code sorts one million random integers in an increasing order on a GPU.</para><para><programlistingfilename=".cpp"><codeline><highlightclass="keyword">const</highlight><highlightclass="normal"><sp/></highlight><highlightclass="keywordtype">size_t</highlight><highlightclass="normal"><sp/>N<sp/>=<sp/>1000000;</highlight></codeline>
</programlisting></para><para>You can specify a comparator to <refrefid="classtf_1_1cudaFlow_1ae462d455fed06dfcdbd1e25a2c9c5da6"kindref="member">tf::cudaFlow::sort</ref> to alter the sorting order. For example, the following code sorts one million random integers in an decreasing order on a GPU.</para><para><programlistingfilename=".cpp"><codeline><highlightclass="keyword">const</highlight><highlightclass="normal"><sp/></highlight><highlightclass="keywordtype">size_t</highlight><highlightclass="normal"><sp/>N<sp/>=<sp/>1000000;</highlight></codeline>
<para>Parallel sort algorithms are also available in <refrefid="classtf_1_1cudaFlowCapturer"kindref="compound">tf::cudaFlowCapturer</ref> with the same API. </para></sect1>