An internal domain-specific language for expressing linear pipelines: a proof-of-concept with MPI in Rust

  • Leonardo Gibrowski Faé PUCRS
  • Dalvan Griebler PUCRS

Resumo


Parallel computation is necessary in order to process massive volumes of data in a timely manner. There are many parallel programming interfaces and environments, each with their own idiosyncrasies. This, alongside non-deterministic errors, make parallel programs notoriously challenging to write. Great effort has been put forth to make parallel programming for several environments easier. In this work, we propose a DSL for Rust, using the language’s source-to-source transformation facilities, that allows for automatic code generation for distributed environments that support the Message Passing Interface (MPI). Our DSL simplifies MPI’s quirks, allowing the programmer to focus almost exclusively on the computation at hand. Performance experiments show nearly or no runtime difference between our abstraction and manually written MPI code while resulting in less than half the lines of code. More elaborate code complexity metrics (Halstead) estimate from 4.5 to 14.7 times lower effort for expressing parallelism.
Palavras-chave: Programming Languages, Parallel Programming, Stream Processing, Distributed Systems

Referências

Marco Aldinucci, Marco Danelutto, Peter Kilpatrick, and Massimo Torquati. 2017. Fastflow: High-Level and Efficient Streaming on Multicore. John Wiley & Sons, Ltd, Chapter 13, 261–280. DOI: 10.1002/9781119332015.ch13

Gabriella Andrade, Dalvan Griebler, Rodrigo Santos, and Luiz Gustavo Fernandes. 2023. A parallel programming assessment for stream processing applications on multi-core systems. Computer Standards & Interfaces 84 (March 2023), 103691. DOI: 10.1016/j.csi.2022.103691

Valerio Besozzi. 2024. PPL: Structured Parallel Programming Meets Rust. In 2024 32nd Euromicro International Conference on Parallel, Distributed and Network-Based Processing (PDP). 78–87. DOI: 10.1109/PDP62718.2024.00019

Paweł Czarnul, Jerzy Proficz, Krzysztof Drypczewski, and Pedro Valero-Lara. 2020. Survey of Methodologies, Approaches, and Challenges in Parallel Programming Using High-Performance Computing Systems. Sci. Program. 2020 (jan 2020), 19 pages. DOI: 10.1155/2020/4176794

J. Darlington, A. J. Field, P. G. Harrison, P. H. J. Kelly, D. W. N. Sharp, Q. Wu, and R. L. While. 1993. Parallel programming using skeleton functions. In PARLE ’93 Parallel Architectures and Languages Europe, Arndt Bode, Mike Reeve, and Gottfried Wolf (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg, 146–160.

David del Rio Astorga, Manuel F Dolz, Javier Fernández, and J Daniel García. 2017. A generic parallel pattern interface for stream and data processing. Concurrency and Computation: Practice and Experience 29, 24 (2017). DOI: 10.1002/cpe.4175

José Duarte and António Ravara. 2022. Taming stateful computations in Rust with typestates. Journal of Computer Languages 72 (2022), 101154. DOI: 10.1016/j.cola.2022.101154

Leonardo Faé, Renato Barreto Hoffmann, and Dalvan Griebler. 2023. Source-to-Source Code Transformation on Rust for High-Level Stream Parallelism. In XXVII Brazilian Symposium on Programming Languages (SBLP) (SBLP’23). ACM, Campo Grande, Brazil, 41–49. DOI: 10.1145/3624309.3624320

Alessio Fino, Alessandro Margara, Gianpaolo Cugola, Marco Donadoni, and Edoardo Morassutto. 2021. RStream: Simple and Efficient Batch and Stream Processing at Scale. In 2021 IEEE International Conference on Big Data (Big Data). IEEE, 2764–2774. DOI: 10.1109/BigData52589.2021.9671932

Martin Fowler. 2010. Domain-Specific Languages (Addison-Wesley Signature Series (Fowler)) (1 ed.). Addison-Wesley Professional. [link]

Edgar Gabriel, Graham E. Fagg, George Bosilca, Thara Angskun, Jack J. Dongarra, Jeffrey M. Squyres, Vishal Sahay, Prabhanjan Kambadur, Brian Barrett, Andrew Lumsdaine, Ralph H. Castain, David J. Daniel, Richard L. Graham, and Timothy S. Woodall. 2004. Open MPI: Goals, Concept, and Design of a Next Generation MPI Implementation. In Proceedings, 11th European PVM/MPI Users’ Group Meeting. Budapest, Hungary, 97–104.

Andrew James Gaspar. 2018. Rust in HPC. (12 2018). DOI: 10.2172/1485376

Dalvan Griebler. 2016. Domain-Specific Language & Support Tool for High-Level Stream Parallelism. Ph.D. Dissertation. Faculdade de Informática - PPGCC - PUCRS, Porto Alegre, Brazil. [link]

Dalvan Griebler, Marco Danelutto, Massimo Torquati, and Luiz Gustavo Fernandes. 2017. SPar: A DSL for High-Level and Productive Stream Parallelism. Parallel Processing Letters 27, 01 (March 2017), 1740005. DOI: 10.1142/S0129626417400059

Dalvan Griebler and Luiz Gustavo Fernandes. 2017. Towards Distributed Parallel Programming Support for the SPar DSL. In Parallel Computing is Everywhere, Proceedings of the International Conference on Parallel Computing (ParCo’17). IOS Press, Bologna, Italy, 563–572. DOI: 10.3233/978-1-61499-843-3-563

Dalvan Griebler, Renato B. Hoffmann, Marco Danelutto, and Luiz Gustavo Fernandes. 2018. Stream Parallelism with Ordered Data Constraints on Multi-Core Systems. Journal of Supercomputing 75, 8 (July 2018), 4042–4061. DOI: 10.1007/s11227-018-2482-7

Maurice H. Halstead. 1977. Elements of Software Science (Operating and programming systems series). Elsevier Science Inc., USA.

Kyle Headley. 2018. A DSL embedded in Rust. IFL 2018: Proceedings of the 30th Symposium on Implementation and Application of Functional Languages, 119–126. DOI: 10.1145/3310232.3310241

Renato B. Hoffmann, Dalvan Griebler, Marco Danelutto, and Luiz G. Fernandes. 2020. Stream Parallelism Annotations for Multi-Core Frameworks. In XXIV Brazilian Symposium on Programming Languages (SBLP) (SBLP’20). ACM, Natal, Brazil, 48–55. DOI: 10.1145/3427081.3427088

Renato Barreto Hoffmann, Júnior Löff, Dalvan Griebler, and Luiz Gustavo Fernandes. 2022. OpenMP as runtime for providing high-level stream parallelism on multi-cores. The Journal of Supercomputing 78, 1 (January 2022), 7655–7676. DOI: 10.1007/s11227-021-04182-9

S. Klabnik and C. Nichols. 2023. The Rust Programming Language, 2nd Edition. No Starch Press. [link]

Júnior Löff, Renato Barreto Hoffmann, Dalvan Griebler, and Luiz Gustavo Fernandes. 2022. Combining stream with data parallelism abstractions for multi-cores. Journal of Computer Languages 73 (December 2022), 101160. DOI: 10.1016/j.cola.2022.101160

Michael McCool, James Reinders, and Arch Robison. 2012. Structured parallel programming: patterns for efficient computation. Elsevier.

Marjan Mernik, Jan Heering, and Anthony M. Sloane. 2005. When and How to Develop Domain-Specific Languages. ACM Comput. Surv. 37, 4 (Dec. 2005), 316–344. DOI: 10.1145/1118890.1118892

Chuck Pheatt. 2008. Intel® threading building blocks. Journal of Computing Sciences in Colleges 23, 4 (2008), 298–298.

Ricardo Pieper, Dalvan Griebler, and Luiz G. Fernandes. 2019. Structured Stream Parallelism for Rust. In XXIII Brazilian Symposium on Programming Languages (SBLP) (SBLP’19). ACM, Salvador, Brazil, 54–61. DOI: 10.1145/3355378.3355384

Ricardo Pieper, Júnior Löff, Renato Berreto Hoffmann, Dalvan Griebler, and Luiz Gustavo Fernandes. 2021. High-level and Efficient Structured Stream Parallelism for Rust on Multi-cores. Journal of Computer Languages 65 (July 2021), 101054. DOI: 10.1016/j.cola.2021.101054

Ricardo Luis Pieper. 2020. High-level Programming Abstractions for Distributed Stream Processing. Master’s Thesis. School of Technology - PPGCC - PUCRS, Porto Alegre, Brazil.

Thomas Rauber and Gudula Rünger. 2013. Parallel programming. Springer.

Rayon. 2019. Rayon. [link]

Dinei A. Rockenbach, Júnior Löff, Gabriell Araujo, Dalvan Griebler, and Luiz G. Fernandes. 2022. High-Level Stream and Data Parallelism in C++ for GPUs. In XXVI Brazilian Symposium on Programming Languages (SBLP) (SBLP’22). ACM, Uberlândia, Brazil, 41–49. DOI: 10.1145/3561320.3561327

Rsmpi. 2023. Rsmpi. [link]

Arash Sahebolamri, Thomas Gilray, and Kristopher Micinski. 2022. Seamless Deductive Inference via Macros. In Proceedings of the 31st ACM SIGPLAN International Conference on Compiler Construction (Seoul, South Korea) (CC 2022). Association for Computing Machinery, New York, NY, USA, 77–88. DOI: 10.1145/3497776.3517779

Stefan Sydow, Mohannad Nabelsee, Sabine Glesner, and Paula Herber. 2020. Towards Profile-Guided Optimization for Safe and Efficient Parallel Stream Processing in Rust. In 2020 IEEE 32nd International Symposium on Computer Architecture and High Performance Computing (SBAC-PAD). 289–296. DOI: 10.1109/SBAC-PAD49847.2020.00047

The Rust Project. 2024. The Rust Reference. [link]

Tokio. 2019. Tokio - The asynchronous runtime for the Rust programming language. [link]

Jake Tronge and Howard Pritchard. 2023. Embedding Rust within Open MPI. In Proceedings of the SC ’23 Workshops of The International Conference on High Performance Computing, Network, Storage, and Analysis (, Denver, CO, USA, ) (SC-W ’23). Association for Computing Machinery, New York, NY, USA, 438–447. DOI: 10.1145/3624062.3624112

Jake Tronge, Howard Pritchard, and Jed Brown. 2023. Improving MPI Safety for Modern Languages. In Proceedings of the 30th European MPI Users’ Group Meeting (, Bristol, United Kingdom, ) (EuroMPI ’23). Association for Computing Machinery, New York, NY, USA, Article 10, 11 pages. DOI: 10.1145/3615318.3615328
Publicado
30/09/2024
FAÉ, Leonardo Gibrowski; GRIEBLER, Dalvan. An internal domain-specific language for expressing linear pipelines: a proof-of-concept with MPI in Rust. In: SIMPÓSIO BRASILEIRO DE LINGUAGENS DE PROGRAMAÇÃO (SBLP), 28. , 2024, Curitiba/PR. Anais [...]. Porto Alegre: Sociedade Brasileira de Computação, 2024 . p. 81-90.