Skip to main content

Faster Segmented Sort on GPUs

  • Conference paper
  • First Online:
Euro-Par 2023: Parallel Processing (Euro-Par 2023)

Abstract

Efficient parallel implementations of various sorting algorithms on modern hardware platforms are essential to numerous application areas. In this paper, we first measure the performance of the leading segmented sort implementation on CUDA-enabled GPUs and determine optimal setups using the resulting runtimes. Subsequently, we propose a number of changes that improve efficiency for segments of specific lengths. Furthermore, an alternative key-only version is introduced, that is specifically optimized to just sort keys instead of key-value pairs, which allows for further optimization. Performance is evaluated by comparing runtimes of the original algorithm with our improved version for segments of different lengths resulting in average speedups between 1.26 and 1.35 on four GPUs of different generations (Pascal, Volta, Ampere, Ada Lovelace). Furthermore, comparison to alternative segmented sort implementations from CUB and ModernGPU results in average speedups of at least 2.2 and 2.5, respectively, across all tested architectures. To illustrate how our improved sorting algorithm can be beneficial in a practical application, we have integrated it into the MetaCache-GPU pipeline for metagenomic DNA classification resulting in speedups of up to 25.6% for the sorting step. Code is publicly available at

https://gitlab.rlp.net/pararch/faster-segmented-sort-on-gpus.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 79.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 99.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    https://gitlab.rlp.net/pararch/faster-segmented-sort-on-gpus.

  2. 2.

    https://nvlabs.github.io/cub/struct_device_segmented_sort.html.

References

  1. Arkhipov, D.I., Wu, D., Li, K., Regan, A.C.: Sorting with GPUs: a survey. arXiv preprint arXiv:1709.02520 (2017)

  2. Baxter, S.: ModernGPU: Patterns and behaviors for GPU computing (2016). https://github.com/moderngpu/moderngpu

  3. Büren, F., Jünger, D., Kobus, R., Hundt, C., Schmidt, B.: Suffix array construction on multi-GPU systems. In: Proceedings of the 28th International Symposium on High-Performance Parallel and Distributed Computing, pp. 183–194 (2019)

    Google Scholar 

  4. Dalton, S., Bell, N., Olson, L., Garland, M.: CUSP: A C++ Templated Sparse Matrix Library (2015). http://cusplibrary.github.io/

  5. Flick, P., Aluru, S.: Parallel distributed memory construction of suffix and longest common prefix arrays. In: International Conference for High Performance Computing, Networking, Storage and Analysis, SC 2015, Austin, TX, USA, pp. 16:1–16:10 (2015)

    Google Scholar 

  6. Graefe, G.: Implementing sorting in database systems. ACM Comput. Surv. (CSUR) 38(3), 10-es (2006)

    Google Scholar 

  7. Gu, Y., He, Y., Fatahalian, K., Blelloch, G.: Efficient BVH construction via approximate agglomerative clustering. In: Proceedings of the 5th High-Performance Graphics Conference, pp. 81–88 (2013)

    Google Scholar 

  8. Hou, K., Liu, W., Wang, H., Feng, W.C.: Fast Segmented sort on GPUs. In: Proceedings of the International Conference on Supercomputing, pp. 1–10 (2017)

    Google Scholar 

  9. Kobus, R., Müller, A., Jünger, D., Hundt, C., Schmidt, B.: MetaCache-GPU: ultra-fast metagenomic classification. In: 50th International Conference on Parallel Processing, pp. 1–11 (2021)

    Google Scholar 

  10. Kobus, R., Nelgen, J., Henkys, V., Schmidt, B.: Artifact for euro-par 2023 paper: “faster segmented sort on GPUs’’. Figshare (2023). https://doi.org/10.6084/m9.figshare.23540553

    Article  Google Scholar 

  11. Leischner, N., Osipov, V., Sanders, P.: GPU sample sort. In: 2010 IEEE International Symposium on Parallel & Distributed Processing (IPDPS), pp. 1–10. IEEE (2010)

    Google Scholar 

  12. Liu, W., Vinter, B.: A framework for general sparse matrix-matrix multiplication on GPUs and heterogeneous processors. J. Parallel Distrib. Comput. 85, 47–61 (2015)

    Article  Google Scholar 

  13. NVIDIA: CUB: Cooperative primitives for CUDA C++ (2021). https://nvlabs.github.io/cub/

  14. Satish, N., Harris, M., Garland, M.: Designing efficient sorting algorithms for manycore GPUs. In: 2009 IEEE International Symposium on Parallel & Distributed Processing, pp. 1–10. IEEE (2009)

    Google Scholar 

  15. Schmid, R., Pisani, F., Borin, E., Cáceres, E.: An evaluation of segmented sorting strategies on GPUs. In: 2016 IEEE HPCC/SmartCity/DSS, pp. 1123–1130. IEEE (2016)

    Google Scholar 

  16. Schmid, R.F., Pisani, F., Cáceres, E.N., Borin, E.: An evaluation of fast segmented sorting implementations on GPUs. Parallel Comput. 110, 102889 (2022)

    Article  MathSciNet  Google Scholar 

  17. Yuan, Y., Lee, R., Zhang, X.: The Yin and Yang of processing data warehousing queries on GPU devices. Proc. VLDB Endowment 6(10), 817–828 (2013)

    Article  Google Scholar 

  18. Zhang, J., Wang, H., Feng, W.C.: cuBLASTP: fine-grained parallelization of protein sequence search on CPU+GPU. IEEE/ACM Trans. Comput. Biol. Bioinf. 14(4), 830–843 (2015)

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Bertil Schmidt .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Kobus, R., Nelgen, J., Henkys, V., Schmidt, B. (2023). Faster Segmented Sort on GPUs. In: Cano, J., Dikaiakos, M.D., Papadopoulos, G.A., Pericàs, M., Sakellariou, R. (eds) Euro-Par 2023: Parallel Processing. Euro-Par 2023. Lecture Notes in Computer Science, vol 14100. Springer, Cham. https://doi.org/10.1007/978-3-031-39698-4_45

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-39698-4_45

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-39697-7

  • Online ISBN: 978-3-031-39698-4

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics