OpenCL* for CPU
Ask questions and share information on Intel® SDK for OpenCL™ Applications and OpenCL™ implementations for Intel® CPU.
Announcements
This forum covers OpenCL* for CPU only. OpenCL* for GPU questions can be asked in the GPU Compute Software forum. Intel® FPGA SDK for OpenCL™ questions can be ask in the FPGA Intel® High Level Design forum.

CPU sort algorithm

Polar01
Beginner
464 Views
Hi,
I'm currently working on the CLPP library (http://code.google.com/p/clpp/) and mainly on the CPU implementation of the 'sort' algorithm.
I currently have a 'special' sort algorithm for the CPU only but after launching the benchmark I have
see that the std::sort algorithm is faster than the OpenCL one.
So, it simply mean that it remain some work to have a really fast sort on the CPU. I would like to know if the Intel Engineers has some councils to give, some papers to reference etc...
An important part would be use this algorithm on the Sandy Bridge too !
Thanks
Krys
0 Kudos
2 Replies
Doron_S_Intel
Employee
464 Views
Hello,

Which sorting algorithm do you use? There's a lot of literature abouve parallel sorting algorithms and their relative merits.
0 Kudos
Maxim_S_Intel
Employee
464 Views
Hello,
for SIMD machines (like CPUs) BitonicSort is typically used. Try one from Intel OCL SDK, there is a dedicated sample there.

Also from the general point, the specific sorting algo to select should match the task, e.g. BubbleSort is fastest approachif the input sequence is almost sorted, demostrating O(N). While the same BubbleSort is the sloweset with O(N*N), when the input sequence is simply inversed.

From this side the Bitonic exhibits the same garaunteed complexity of n*log(n) and fits most tasks.
0 Kudos
Reply