Skip to main content

Automatic Parallelization of Python Programs for Distributed Heterogeneous Computing

  • 183 Accesses

Part of the Lecture Notes in Computer Science book series (LNCS,volume 13440)

Abstract

This paper introduces a new approach to automatic ahead-of-time (AOT) parallelization and optimization of sequential Python programs for execution on distributed heterogeneous platforms. Our approach enables AOT source-to-source transformation of Python programs, driven by the inclusion of type hints for function parameters and return values. These hints can be supplied by the programmer or obtained by dynamic profiler tools; multi-version code generation guarantees the correctness of our AOT transformation in all cases.

Our compilation framework performs automatic parallelization and sophisticated high-level code optimizations for the target distributed heterogeneous hardware platform. It introduces novel extensions to the polyhedral compilation framework that unify user-written loops and implicit loops present in matrix/tensor operators, as well as automated selection of CPU vs. GPU code variants. Finally, output parallelized code generated by our approach is deployed using the Ray runtime for scheduling distributed tasks across multiple heterogeneous nodes in a cluster, thereby enabling both intra-node and inter-node parallelism.

Our empirical evaluation shows significant performance improvements relative to sequential Python in both single-node and multi-node experiments, with a performance improvement of over 20,000\(\times \) when using 24 nodes and 144 GPUs in the OLCF Summit supercomputer for the Space-Time Adaptive Processing (STAP) radar application.

Keywords

  • Parallelizing compilers
  • Python language
  • Parallel computing
  • Heterogeneous computing
  • Distributed computing

This is a preview of subscription content, access via your institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • DOI: 10.1007/978-3-031-12597-3_22
  • Chapter length: 17 pages
  • Instant PDF download
  • Readable on all devices
  • Own it forever
  • Exclusive offer for individuals only
  • Tax calculation will be finalised during checkout
eBook
USD   64.99
Price excludes VAT (USA)
  • ISBN: 978-3-031-12597-3
  • Instant PDF download
  • Readable on all devices
  • Own it forever
  • Exclusive offer for individuals only
  • Tax calculation will be finalised during checkout
Softcover Book
USD   84.99
Price excludes VAT (USA)
Fig. 1.
Fig. 2.
Fig. 3.
Fig. 4.
Fig. 5.
Fig. 6.
Fig. 7.
Fig. 8.
Fig. 9.
Fig. 10.

References

  1. Abella-González, M.A., Carollo-Fernández, P., Pouchet, L.N., Rastello, F., Rodríguez, G.: Polybench/python: Benchmarking python environments with polyhedral optimizations. In: Proceedings of CC 2021 (2021). https://doi.org/10.1145/3446804.3446842

  2. Ardö, H., Bolz, C.F., FijaBkowski, M.: Loop-aware optimizations in pypy’s tracing jit. SIGPLAN Not. 48(2), 63–72 (2012). https://doi.org/10.1145/2480360.2384586

    CrossRef  Google Scholar 

  3. Bezanson, J., Karpinski, S., Shah, V.B., Edelman, A.: Julia: a fast dynamic language for technical computing. CoRR abs/1209.5145 (2012)

    Google Scholar 

  4. Bondhugula, U., Acharya, A., Cohen, A.: The pluto+ algorithm: a practical approach for parallelization and locality optimization of affine loop nests. ACM Trans. Program. Lang. Syst. 38(3), April 2016. https://doi.org/10.1145/2896389

  5. Cython (2007). https://cython.org/

  6. Dalcin, L., Fang, Y.L.L.: mpi4py: status update after 12 years of development. Comput. Sci. Eng. (2021). https://doi.org/10.1109/MCSE.2021.3083216

    CrossRef  Google Scholar 

  7. Grosser, T., Größlinger, A., Lengauer, C.: Polly - performing polyhedral optimizations on a low-level intermediate representation. Parallel Process. Lett. 22(4), 1250010 (2012)

    Google Scholar 

  8. LCF Summit supercomputer (2019). https://www.olcf.ornl.gov/olcf-resources/compute-systems/summit/

  9. Melvin, W.L.: Chapter 12: Space-time adaptive processing for radar. Academic Press Library in Signal Processing: Volume 2 Comm. and Radar Signal Proc. (2014)

    Google Scholar 

  10. Moritz, P., et al.: Ray: a distributed framework for emerging ai applications. In: Proceedings of OSDI 2018 (2018)

    Google Scholar 

  11. NERSC Cori supercomputer (2016). https://docs.nersc.gov/systems/cori/

  12. Nuitka (2012). https://nuitka.net/pages/overview.html

  13. Numba (2012). https://numba.pydata.org/

  14. NumPy (2006). https://numpy.org/

  15. PolyBench: The polyhedral benchmark suite. http://www.cse.ohio-state.edu/~pouchet/software/polybench/

  16. Press, W.H., Teukolsky, S.A., Vetterling, W.T., Flannery, B.P.: Numerical Recipes 3rd Edition: The Art of Scientific Computing. 3 edn. (2007)

    Google Scholar 

  17. PyPy (2019). https://pypy.org/

  18. Pyston (2014). https://blog.pyston.org/

  19. Python typed AST package (2019). https://pypi.org/project/typed-ast/

  20. SciPy (2001). https://www.scipy.org/

  21. Shed Skin (2012). https://shedskin.github.io/

  22. Shirako, J., Hayashi, A., Sarkar, V.: Optimized two-level parallelization for gpu accelerators using the polyhedral model. In: Proceedings of CC 2017 (2017). https://doi.org/10.1145/3033019.3033022

  23. Shirako, J., Pouchet, L.N., Sarkar, V.: Oil and water can mix: An integration of polyhedral and ast-based transformations. In: Proceedings of SC’14 (2014). https://doi.org/10.1109/SC.2014.29

  24. Shirako, J., Sarkar, V.: Integrating data layout transformations with the polyhedral model. In: Proceedings of IMPACT 2019 (2019)

    Google Scholar 

  25. Shirako, J., Sarkar, V.: An affine scheduling framework for integrating data layout and loop transformations. In: Proceedings of LCPC 2020 (2020). https://doi.org/10.1007/978-3-030-95953-1_1

  26. SymPy (2017). https://www.sympy.org

  27. Verdoolaege, et al.: Polyhedral parallel code generation for CUDA. ACM Trans. Archit. Code Optim. 9(4), 54:1–54:23 (2013). https://doi.org/10.1145/2400682.2400713

  28. Verdoolaege, S.: isl: an integer set library for the polyhedral model. In: Mathematical Software - ICMS 2010 (2010). https://doi.org/10.1007/978-3-642-15582-6_49

  29. Wang, S., et al.: Lineage stash: Fault tolerance off the critical path. In: Proceedings of the ACM Symposium on Operating System Principles (SOSP’19), SOSP 2019 (2019)

    Google Scholar 

  30. Zhou, T., et al.: Intrepydd: Performance, productivity and portability for data science application kernels. In: Proceedings of Onward! ’20 (2020). https://doi.org/10.1145/3426428.3426915

  31. Zinenko, O., et al.: Modeling the conflicting demands of parallelism and temporal/spatial locality in affine scheduling. In: Proceedings of CC 2018 (2018). https://doi.org/10.1145/3178372.3179507

Download references

Acknowledgments

This material is based upon work supported by the Defense Advanced Research Projects Agency (DARPA) under Agreement No. HR0011-20-9-0020. This research used resources of the Oak Ridge Leadership Computing Facility, which is a DOE Office of Science User Facility supported under Contract DE-AC05-00OR22725. Also, this research used resources of the National Energy Research Scientific Computing Center, which is supported by the Office of Science of the U.S. Department of Energy under Contract No. DE-AC02-05CH11231.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Jun Shirako .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and Permissions

Copyright information

© 2022 Springer Nature Switzerland AG

About this paper

Verify currency and authenticity via CrossMark

Cite this paper

Shirako, J., Hayashi, A., Paul, S.R., Tumanov, A., Sarkar, V. (2022). Automatic Parallelization of Python Programs for Distributed Heterogeneous Computing. In: Cano, J., Trinder, P. (eds) Euro-Par 2022: Parallel Processing. Euro-Par 2022. Lecture Notes in Computer Science, vol 13440. Springer, Cham. https://doi.org/10.1007/978-3-031-12597-3_22

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-12597-3_22

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-12596-6

  • Online ISBN: 978-3-031-12597-3

  • eBook Packages: Computer ScienceComputer Science (R0)