Comparison based sorting for systems with multiple GPUs

Ivan Tanasic, Lluís Vilanova, Marc Jordà, Javier Cabezas, Isaac Gelado, Nacho Navarro, Wen Mei Hwu

Research output: Chapter in Book/Report/Conference proceedingConference contribution


As a basic building block of many applications, sorting algorithms that efficiently run on modern machines are key for the performance of these applications. With the recent shift to using GPUs for general purpose compuing, researches have proposed several sorting algorithms for single-GPU systems. However, some workstations and HPC systems have multiple GPUs, and applications running on them are de- signed to use all available GPUs in the system. In this paper we present a high performance multi-GPU merge sort algorithm that solves the problem of sorting data distributed across several GPUs. Our merge sort algorithm first sorts the data on each GPU using an existing single- GPU sorting algorithm. Then, a series of merge steps pro- duce a globally sorted array distributed across all the GPUs in the system. This merge phase is enabled by a novel pivot selection algorithm that ensures that merge steps always distribute data evenly among all GPUs. We also present the implementation of our sorting algorithm in CUDA, as well as a novel inter-GPU communication technique that enables this pivot selection algorithm. Experimental results show that an efficient implementation of our algorithm achieves a speed up of 1.9x when running on two GPUs and 3.3x when running on four GPUs, compared to sorting on a single GPU. At the same time, it is able to sort two and four times more records, compared to sorting on one GPU.

Original languageEnglish (US)
Title of host publicationProceedings of the 6th Workshop on General Purpose Processor Using Graphics Processing Units, GPGPU 2013
Number of pages11
StatePublished - 2013
Event6th Workshop on General Purpose Processor Using Graphics Processing Units, GPGPU 2013 - Houston, TX, United States
Duration: Mar 16 2013Mar 16 2013

Publication series

NameACM International Conference Proceeding Series


Other6th Workshop on General Purpose Processor Using Graphics Processing Units, GPGPU 2013
Country/TerritoryUnited States
CityHouston, TX


  • CUDA
  • GPU
  • Parallel
  • Sorting

ASJC Scopus subject areas

  • Software
  • Human-Computer Interaction
  • Computer Vision and Pattern Recognition
  • Computer Networks and Communications


Dive into the research topics of 'Comparison based sorting for systems with multiple GPUs'. Together they form a unique fingerprint.

Cite this