Conference article

Compilation of Modelica Array Computations into Single Assignment C for Efficient Execution on CUDA-enabled GPUs

Kristian Stavåker
Programming Environment Laboratory, Department of Computer Science, Linköping University, Sweden

Daniel Rolls
School of Computer Science, University of Hertfordshire, United Kingdom

Jing Guo
School of Computer Science, University of Hertfordshire, United Kingdom

Peter Fritzson
Programming Environment Laboratory, Department of Computer Science, Linköping University, Sweden

Sven-Bodo Scholz
School of Computer Science, University of Hertfordshire, United Kingdom

Download article

Published in: 3rd International Workshop on Equation-Based Object-Oriented Modeling Languages and Tools; Oslo; Norway; October 3

Linköping Electronic Conference Proceedings 47:9, p. 81-90

Show more +

Published: 2010-09-21

ISBN: 978-91-7519-824-8

ISSN: 1650-3686 (print), 1650-3740 (online)

Abstract

Mathematical models; derived for example from discretisation of partial differential equations; often contain operations over large arrays. In this work we investigate the possibility of compiling array operations from models in the equation-based language Modelica into Single Assignment C (SAC). The SAC2C SAC compiler can generate highly efficient code that; for instance; can be executed on CUDAenabled GPUs. We plan to enhance the open-source Modelica compiler OpenModelica; with capabilities to detect and compile data parallel Modelica for-equations/arrayequations into SAC WITH-loops. As a first step we demonstrate the feasibility of this approach by manually inserting calls to SAC array operations in the code generated from OpenModelica and show how capabilities and runtimes can be extended. As a second step we demostrate the feasibility of rewriting parts of the OpenModelica simulation runtime system in SAC. Finally; we discuss SAC2C’s switchable target architectures and demonstrate one by harnessing a CUDA-enabled GPU to improve runtimes. To the best of our knowledge; compilation of Modelica array operations for execution on CUDA-enabled GPUs is a new research area.

Keywords

Single Assignment C; Modelica; data parallel programming; OpenModelica; CUDA; GPU; SAC

References

[1] Peter Aronsson. Automatic Parallelization of Equation- Based Simulation Programs. PhD thesis; Linköping University; 2006. Dissertation No. 1022.

[2] Francois Cellier and Ernesto Kofman. Continuous System Simulation. Springer; 2006.

[3] Peter Fritzson. Principles of Object-Oriented Modeling and Simulation with Modelica 2.1. IEEE Press; 2004.

[4] Clemens Grelck. Implementing the NAS Benchmark MG in SAC. In Viktor K. Prasanna and George Westrom; editors; 16th International Parallel and Distributed Processing Symposium (IPDPS’02); Fort Lauderdale; Florida; USA. IEEE Computer Society Press; 2002.

[5] Clemens Grelck and Sven-Bodo Scholz. HPF vs. SAC — A Case Study. In Arndt Bode; Thomas Ludwig; Wolfgang Karl; and Roland Wismüller; editors; Euro- Par 2000 Parallel Processing; 6th International Euro-Par Conference (Euro-Par’00); Munich; Germany; volume 1900 of Lecture Notes in Computer Science; pages 620–624. Springer-Verlag; Berlin; Germany; 2000.

[6] Clemens Grelck and Sven-Bodo Scholz. SAC: A functional array language for efficient multithreaded execution. International Journal of Parallel Programming; 34(4):383– 427; 2006.

[7] Jing Guo; Jeyarajan Thiyagalingam; and Sven-Bodo Scholz. Towards Compiling SaC to CUDA. In Zoltan Horváth and Viktória Zsók; editors; 10th Symposium on Trends in Functional Programming (TFP’09); pages 33–49. Intellect; 2009.

[8] Stephan Herhut; Carl Joslin; Sven-Bodo Scholz; and Clemens Grelck. Truly nested data-parallelism. Compiling sac to the microgrid architecture. In: IFL’09: Draft Proceedings of the 21st Symposium on Implementation and Application of Functional Languages. SHU-TR-CS- 2009-09-1; Seton Hall University; South Orange; NJ; USA.; 2009.

[9] Matthias Korch and Thomas Rauber. Scalable parallel rk solvers for odes derived by the method of lines. In Harald Kosch; László Böszörményi; and Hermann Hellwagner; editors; Euro-Par; volume 2790 of Lecture Notes in Computer Science; pages 830–839. Springer; 2003.

[10] Håkan Lundvall. Automatic Parallelization using Pipelining for Equation-Based Simulation Languages; Licentiate thesis 1381. Linköping University; 2008.

[11] Modelica and the Modelica Association; accessed August 30 2010. http://www.modelica.org.

[12] CUDA Zone; accessed August 30 2010. http://www. Nvidia.com/object/cuda_home_new.html.

[13] Fermi; Next Generation CUDA Architecture; accessed August 30 2010. http://www.nvidia.com/object/ fermi_architecture.html.

[14] The OpenModelica Project; accessed August 30 2010. http://www.openmodelica.org.

[15] Thomas Rauber and Gudula Rünger. Iterated runge-kutta methods on distributed memory multiprocessors. In PDP; pages 12–19. IEEE Computer Society; 1995.

[16] Thomas Rauber and Gudula Rünger. Parallel execution of embedded and iterated runge-kutta methods. Concurrency - Practice and Experience; 11(7):367–385; 1999.

[17] Daniel Rolls; Carl Joslin; Alexei Kudryavtsev; Sven- Bodo Scholz; and Alexander V. Shafarenko. Numericalsimulations of unsteady shock wave interactions using sac and fortran-90. In PaCT; pages 445–456; 2009.

[18] Levon Saldamli. PDEModelica A High-Level Language for Modeling with Partial Differential Equations. PhD thesis; Linköping University; 2006. Dissertation No. 1016.

[19] Sven-Bodo Scholz. Single Assignment C — efficient support for high-level array operations in a functional setting. Journal of Functional Programming; 13(6):1005– 1059; 2003.

[20] Single Assignment C Homepage; accessed august 30 2010. http://www.sac-home.org.

Citations in Crossref