Automatic GPU Code Generation of Modelica Functions

Hilding Elmqvist
Dassault Systemes, Lund, Sweden

Hans Olsson
Dassault Systemes, Lund, Sweden

Axel Goteman
Dassault Systemes, Lund, Sweden / Lund Institute of Technology, Lund, Sweden

Vilhelm Roxling
Dassault Systemes, Lund, Sweden / Lund Institute of Technology, Lund, Sweden

Dirk Zimmer
Institute of System Dynamics and Control, DLR, Germany

Alexander Pollok
Institute of System Dynamics and Control, DLR, Germany

Ladda ner artikelhttp://dx.doi.org/10.3384/ecp15118235

Ingår i: Proceedings of the 11th International Modelica Conference, Versailles, France, September 21-23, 2015

Linköping Electronic Conference Proceedings 118:25, s. 235-243

Visa mer +

Publicerad: 2015-09-18

ISBN: 978-91-7685-955-1

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


Modelica users can and want to build more realistic and complex models. This typically means slower simulations. The speed of CPU has of course increased enormously to partly compensate. But now it’s important to utilize the many cores. This paper discusses code generation for GPU cores. This is important when the model has regular structure, for example, discretization of PDEs. The behavior of each cell can then be partly described by a function call. The evaluation of such calls can then be made in parallel on the GPU cores. The same function is thus executed on every GPU core but operates on different data; the data of its cell. Our GPU code generator automatically generates code for Modelica functions, i.e. no additional language constructs are needed. The function is just annotated as suitable for execution on a GPU.


Modelica functions; Multi-core; GPU; CFD


Dassault Systèmes (2015): Dymola 2016. http://www.Dymola.com

Elmqvist H., Mattsson S.E., Olsson H. (2014): Parallel Model Execution on Many Cores. Proceedings of the 10th International Modelica Conference March 10-12, 2014, Lund, Sweden.

Gebremedhin M., Hemmati Moghadam A., Fritzson F., Stavåker K. (2012): A Data-Parallel Algorithmic Modelica Extension for Efficient Execution on Multi-Core Platforms. Proceedings 9th Modelica Conference, Munich, Germany, September 3-5, pp. 393-404. Download: http://www.ep.liu.se/ecp/076/041/ecp12076041.pdf

Goteman A., Roxling V. (2015): GPU Usage for Parallel Funcions and Contacts in Modelica, master’s thesis Lund Institute of Technology, Lund, Sweden. (To be published)

Kirk D.B., Hwu W. (2013): Programming Massively Parallel Processors, 2nd edition.

Modelica (2014): Modelica, A Unified Object-Oriented Language for Systems Modeling. Language Specification, Version 3.3, Revision 1, June 11, 2014.

Vreugdenhil C.B. (1994), Numerical Methods for Shallow-Water Flow, Kluwer Academic Publishers, ISBN 0792331648

Citeringar i Crossref