Presentation at MODPROD'2014PELAB – Programming Environment Laboratory
Department of Computer and Information ScienceLinköping University
2014-02-04
Peter Fritzson
Research in Model-Based Product Developmentat PELAB in the MODPROD Center
class x {publicint a;float b;int func (int a,int b);Asa asadAsda ad Asd ad ccAac sdscfcc c aAscccv caAscc cac}
class x {publicint a;float b;int func (int a,int b);Asa asadAsda ad Asd ad ccAac sdscfcc c aAscccv caAscc cac}
class x {publicint a;float b;int func (int a,int b);Asa asadAsda ad Asd ad ccAac sdscfcc c aAscccv caAscc cac}
class x {publicint a;float b;int func (int a,int b);Asa asadAsda ad Asd ad ccAac sdscfcc c aAscccv caAscc cac}
2 © Peter Fritzson
Examples of Complex Systems in Engineering• Robotics• Automotive• Aircraft• Mobile Phone Systems• Business Software • Power plants• Heavy Vehicles• Process industry
3 © Peter Fritzson
Product models
Requirementsmodels
Unified Modeling: Meta-modeling& Modelica& UML & OWL
BusinessProcessControl
RequirementsCapture
Model-Driven Design(PIM)
Compilation & Code Gen
(PSM)
SystemSimulation
Software &Syst Product
Feedback
Platformmodels
Processmodels
Product models
Requirementsmodels
Unified Modeling: Meta-modeling&Modelica& UML
BusinessProcessControl
RequirementsCapture
Model-Driven Design
Compilation& Code Gen
SystemSimulation
Software &System Product
Platformmodels
Processmodels
Open Standards – Modelica (HW, SW) and UML (SW)
Architecture of IntegratedModel-Based Product Development
5 © Peter Fritzson
• Advanced Interactive Modelica compiler (OMC)• Supports most of the Modelica Language
• Basic environment for creating models• OMShell – an interactive command handler • OMNotebook – a literate programming notebook • MDT – an advanced textual environment in Eclipse
5
• OMEdit graphic Editor• OMOptim optimization subsyst• ModelicaML UML Profile• MetaModelica extension• ParModelica extension• OMPython – Python scripting
The OpenModelica Open Source Enviroment www.openmodelica.org
6 © Peter Fritzson
Industrial members• Bosch Rexroth AG, Germany •Siemens PLM, California, USA•Siemens Turbo, Sweden • CDAC Centre, Kerala, India • Creative Connections, Prague• DHI, Aarhus, Denmark• EDF, Paris, France• Equa Simulation AB, Sweden• Fraunhofer IWES, Bremerhaven• Fraunhofer FIRST, Berlin• Frontway AB, Sweden • IFP, Paris, France
Open-source community services• Website and Support Forum• Version-controlled source base• Bug database• Development courses• www.openmodelica.org
Code Statistics• Linköping University, Sweden• UC Berkeley, USA •TU Berlin, Insti UEBB, Germany• FH Bielefeld, Bielefeld, Germany•TU Braunschweig, Germany • Univ Calabria, Italy• Danish Technical Univ, Denmark•TU Dortmund, Germany•TU Dresden, Germany• Université Laval, Canada • Georgia InstiTechnology, USA• Ghent University, Belgium
University members
OSMC – International Consortium for Open Source Model-based Development Tools, 45 members Dec 2013
Founded Dec 4, 2007• GTI, USA• ISID Dentsu, Tokyo, Japan• ITI, Dresden, Germany• Maplesoft, Canada • Rickardo Inc., USA• STEAG, Dehli, India•TLK Thermo, Germany •Sozhou Tongyuan, China• VTI, Linköping, Sweden• VTT, Finland • Wolfram MathCore, Sweden
• Halmstad University, Sweden• Heidelberg University, Germany •TU Hamburg/Harburg Germany • KTH, Stockholm, Sweden • Univ of Maryland, Syst Eng USA • Univ of Maryland, CEEE, USA • Politecnico di Milano, Italy • Ecoles des Mines, CEP, France• Mälardalen University, Sweden • Univ Pisa, Italy•Telemark Univ College, Norway• Univ Ålesund, Norway
8 © Peter Fritzson
General Tool Interoperability & Model ExchangeFunctional Mock-up Interface (FMI) The FMI development is result of the MODELISAR 29-partner project• FMI development initiated by Daimler• Improved Software/Model/Hardware-in-the-Loop Simulation, of physical
models and of AUTOSAR controller models from different vendors for automotive applications with different levels of detail.
• Open Standard• 14 automotive use cases for evaluation• > 30 tool vendors are supporting it
Enginewith ECU
Gearboxwith ECU
Thermalsystems
Automatedcargo door
Chassis components,roadway, ECU (e.g. ESP)
etc.
functional mockup interface for model exchange and tool couplingcourtesy Daimler
9 © Peter Fritzson
Research
Modeling-Language Design
Model-based Optimization
Fault Analysis – Bayesian Networks
Debugging
Multi-Core based Simulation
Modeling Support Environments
10 © Peter Fritzson
Product models
Requirementsmodels
Unified Modeling: Meta-modeling& Modelica& UML & OWL
BusinessProcessControl
RequirementsCapture
Model-Driven Design(PIM)
Compilation & Code Gen
(PSM)
SystemSimulation
Software &Syst Product
Feedback
Platformmodels
Processmodels
Product models
Requirementsmodels
Unified Modeling: Meta-modeling&Modelica& UML
BusinessProcessControl
RequirementsCapture
Model-Driven Design
Compilation& Code Gen
SystemSimulation
Software &System Product
Platformmodels
Processmodels
OPENPROD – Large 28-partner European Project, 2009-2012 Vision of Cyber-Physical Model-Based Product Development
OPENPROD Vision of unified modeling framework for model-based product development.
Open Standards – Modelica (HW, SW) and UML (SW)
11 © Peter Fritzson
OPENPROD Model-Based Development EnvironmentCovers Product-Design V
Product models
Requirementsmodels
Unified Modeling: Meta-modeling& Modelica& UML & OWL
BusinessProcessControl
RequirementsCapture
Model-Driven Design(PIM)
Compilation & Code Gen
(PSM)
SystemSimulation
Software &Syst Product
Feedback
Platformmodels
Processmodels
Product models
Requirementsmodels
Unified Modeling: Meta-modeling& Modelica& UML
BusinessProcessControl
RequirementsCapture
Model-Driven Design
Compilation& Code Gen
SystemSimulation
Software &System Product
Platformmodels
Processmodels
Specification
Design
DesignRefinement
Component verification
Subsystem level integration andverification
Subsystem level integration testcalibration and verification
Product verification anddeployment
Maintenance
Realization
Detailed feature design andimplementation
Architectural design and system functional design
Preliminary feature design
Systemrequirements
Level of Abstraction
Documentation, Version and Configuration Management
Verification
Integration
Calibration
Experience Feedback
12 © Peter Fritzson
Business Process Control and Modeling
Product models
Requirementsmodels
Unified Modeling: Meta-modeling& Modelica& UML & OWL
BusinessProcessControl
RequirementsCapture
Model-Driven Design(PIM)
Compilation & Code Gen
(PSM)
SystemSimulation
Software &Syst Product
Feedback
Platformmodels
Processmodels
Product models
Requirementsmodels
Unified Modeling: Meta-modeling& Modelica& UML
BusinessProcessControl
RequirementsCapture
Model-Driven Design
Compilation& Code Gen
SystemSimulation
Software &System Product
Platformmodels
Processmodels
Metso Business model & simulationVTT Simantics Graphic Modeling Tool
OpenModelica based simulation
Simulation of 3 strategies with outcomes
VTT SimanticsBusiness process modeler
OpenModelicacompiler & simulator
13 © Peter Fritzson
Requirement Capture
Product models
Requirementsmodels
Unified Modeling: Meta-modeling& Modelica& UML & OWL
BusinessProcessControl
RequirementsCapture
Model-Driven Design(PIM)
Compilation & Code Gen
(PSM)
SystemSimulation
Software &Syst Product
Feedback
Platformmodels
Processmodels
Product models
Requirementsmodels
Unified Modeling: Meta-modeling& Modelica& UML
BusinessProcessControl
RequirementsCapture
Model-Driven Design
Compilation& Code Gen
SystemSimulation
Software &System Product
Platformmodels
Processmodels
OpenModelica based simulation
vVDR (virtual Verification of Designs against Requirements)
in ModelicaML UML/Modelica Profile, part of OpenModelica
Design Model
Scenario Model
Requirement Models
Verification Model
Binding
Provider from design model
Client from requirement model
14 © Peter Fritzson
Model-Driven Whole-Product DesignSW/HW – UML/Modelica
Product models
Requirementsmodels
Unified Modeling: Meta-modeling& Modelica& UML & OWL
BusinessProcessControl
RequirementsCapture
Model-Driven Design(PIM)
Compilation & Code Gen
(PSM)
SystemSimulation
Software &Syst Product
Feedback
Platformmodels
Processmodels
Product models
Requirementsmodels
Unified Modeling: Meta-modeling& Modelica& UML
BusinessProcessControl
RequirementsCapture
Model-Driven Design
Compilation& Code Gen
SystemSimulation
Software &System Product
Platformmodels
Processmodels
• SW modeled in UML: statecharts, activity diagrams
• UML translated to Modelica allows integration with Modelica (HW) models
Integrated SW/HW Modeling with ModelicaML/OpenModelica
15 © Peter Fritzson
Model-Driven Design, mostly with Modelica
Product models
Requirementsmodels
Unified Modeling: Meta-modeling& Modelica& UML & OWL
BusinessProcessControl
RequirementsCapture
Model-Driven Design(PIM)
Compilation & Code Gen
(PSM)
SystemSimulation
Software &Syst Product
Feedback
Platformmodels
Processmodels
Product models
Requirementsmodels
Unified Modeling: Meta-modeling& Modelica& UML
BusinessProcessControl
RequirementsCapture
Model-Driven Design
Compilation& Code Gen
SystemSimulation
Software &System Product
Platformmodels
Processmodels
Sensitivity analysis(Appedge, IFPEN)
Acausal analysis for design(INSA, PSA)
Uncertainties modeling(EDF, LiU, MaCo)
Model Debugger(LiU)
Improved Type System(LMS, LiU)
Modeling & Design Tools
New Capabilities
Wolfram System Modeler(MaCo)
IDA Simulation(Equa)
Jmodelica.org, Optimica Studio)(Modelon)
BEAST(SKF)
Simantics(VTT)
Amesim(LMS)
BoGie(INSA)
AppEdge Sensi(Appedge)
TeamCenter(Siemens)
D&C System Simulator(Bosch-Rexroth)
Model Guidelines Checker(TUC, LiU)
Model Simplifier(Bosch-Rexroth)
OpenModelica(LIU, UBiele, MaCo, et al)
16 © Peter Fritzson
Compilation and Code Generation
Product models
Requirementsmodels
Unified Modeling: Meta-modeling& Modelica& UML & OWL
BusinessProcessControl
RequirementsCapture
Model-Driven Design(PIM)
Compilation & Code Gen
(PSM)
SystemSimulation
Software &Syst Product
Feedback
Platformmodels
Processmodels
Product models
Requirementsmodels
Unified Modeling: Meta-modeling& Modelica& UML
BusinessProcessControl
RequirementsCapture
Model-Driven Design
Compilation& Code Gen
SystemSimulation
Software &System Product
Platformmodels
Processmodels
OMC QSS Codegen(ETH, LIU)
IDA Simulation(Equa)
Amesim(LMS)
OpenModelica Compiler (OMC)(LIU, UBiele, MaCo, et al)
Wolfram System Modeler(MaCo)
OMC Inline Codegen(LiU, Ubiele)
OMC Parallel Codegen(LiU)
OMC Sparse Jacobians(UBiele)
DSP Codegen(LiU, MaCo)
Real-Time CodeGen SynDEx(IFP, INRIA)
OMC Symbolic Linearization(Ubiele, MaCo)
Model Compiling ToolsNew Capabilities
Simulation Efficient Storage(Maco, BR)
Multi-Rate Controller(Equa)
Real-Time Code Transform(CEA, LMS)
17 © Peter Fritzson
System Simulation
Product models
Requirementsmodels
Unified Modeling: Meta-modeling& Modelica& UML & OWL
BusinessProcessControl
RequirementsCapture
Model-Driven Design(PIM)
Compilation & Code Gen
(PSM)
SystemSimulation
Software &Syst Product
Feedback
Platformmodels
Processmodels
Product models
Requirementsmodels
Unified Modeling: Meta-modeling& Modelica& UML
BusinessProcessControl
RequirementsCapture
Model-Driven Design
Compilation& Code Gen
SystemSimulation
Software &System Product
Platformmodels
Processmodels
Plexsim Simulator(Plexsim)
BEAST Simulator(SKF)
Wolfram Syst Modeler/Simulator(MaCo)
OpenModelica Simulator(LIU, Ubiele, MaCo, et al)
BEAST Parallel Solver(SKF, LIU)
Sparse-Matrix DAE Solver(XRG, BR)
OMC QSS Solver(ETH, LIU)
Plexsim QSS Solver(ETH, Plexsim)
OMC Interactive Simulation(EADS, LIU)
xMOD Simulator(IFP)
OMC Parallel Solver(LiU)
Simulation ToolsNew Capabilities
Solver Selection(LiU, MaCo)
OMC Modular Solver Runtime(BR, LiU)
Data Reconciliation(EDF, LIU, MaCo)
3D Graphic Animation(Fhg)
18 © Peter Fritzson
Interoperability
Product models
Requirementsmodels
Unified Modeling: Meta-modeling& Modelica& UML & OWL
BusinessProcessControl
RequirementsCapture
Model-Driven Design(PIM)
Compilation & Code Gen
(PSM)
SystemSimulation
Software &Syst Product
Feedback
Platformmodels
Processmodels
Product models
Requirementsmodels
Unified Modeling: Meta-modeling& Modelica& UML
BusinessProcessControl
RequirementsCapture
Model-Driven Design
Compilation& Code Gen
SystemSimulation
Software &System Product
Platformmodels
Processmodels
Wolfram System Modeler(MaCo)
OpenModelica(LIU, Ubiele, MaCo, et al)
FMI 1.0 Prototypes(LiU, Modelon, MaCo, TLK, TUC)
XML Generation(Modelon, LIU)
xMOD(IFP)
TISC Co-Simulator for xIL(TLK)
Real-Time Co-Sim Platform(IFP, TLK, TUC)
OPC Data Access Server(VTT) Jmodelica.org, Optimica Studio
(Modelon)
FMI 2.0 Subset Co-simulator(LiU)
FMI 2.0 Sparse Jacobians(Ubiele, Modelon)
Flat Modelica export/import(LIU, Equa)
M&S Tools, PLM Tools
New Capabilities
TeamCenter(Siemens)
PDM System Integration(Siemens)
19 © Peter Fritzson
Modeling Language and Tool Research
• How can a modeling language be designedwith precise semantics to avoid errors?
• Can the language be made extensible?
• Can it model itself (meta-modeling)?
• How should a user-supportive modeling environment be designed?
20 © Peter Fritzson
Efficient Traceable Model-Based Dynamic Optimization – EDOp Research Project
Integrated modeling & optimization in OpenModelica Equation oriented tool, generation of efficient parallel code Based on OpenModelica, cooperation with Open-Source Consortium Including model error traceability and localization
Efficient solution methods for model-based optimization problems Methods can exploit structure of the problem and their equations Exploit models for parallel computing Utilize equations to analytically compute gradients and hessians, faster search
routines
Optimized Heavy Industrial Applications Trucks (Scania), Wheel Loaders (Volvo CE) Bearing applications in mechanical systems (e.g. wind power, SKF) Siemens: Gas turbines, Frontway: Process industry
21 © Peter Fritzson
OpenModelica Parallel Multiple-Shooting and Collocation Dynamic Trajectory Optimization
• Minimize a goal function subject to model equation constraints, useful e.g. for NMPC
• Multiple Shooting/Collocation• Solve sub-problem in each sub-interval
0,02,04,06,08,0
10,012,014,016,0
1 2 4 8 16
MULTIPLE_COLLOCATION
ipopt [scaled] jac_g [scaled]
Example speedup, 16 cores:
In OpenModelica Release1.9.1, non-parallel version.
22 © Peter Fritzson
OpenModelica Optimization SubsystemOMOptim• Parameter
optimization• Currently using
genetic optimization algorithms in OMOptim 0.9.
• Work on more parameter optimization
• Work on dynamic optimization using multi-corecomputers
23 © Peter Fritzson
Bayesian Network Based Fault and Failure Analysis – Cooperation with Scania, Mattias Nyberg
• Developing a Fault and Failure analysis tool for the engineers, containing the following features:
• Modelica/UML/SysML-like intuitive GUI design interface with simulation
• Functionality• Generate Failure Mode and Effect Analysis, FMEA table• Generate Fault Tree, FTA table• Answer to Queries• Probability of hazards• Root cause of hazards• Infer hazards, given the root cause
24 © Peter Fritzson
Legend
Bayesian Network Based Fault and Failure AnalysisAssociation of Services to the Components
25 © Peter Fritzson
Need for Debugging ToolsProblems and Motivation
• A major part of the total cost of software projects is due to testing and debugging
• US-Study 2002: Software errors cost the US economy annually~ 60 Billion $
• Large Gap in Abstraction Levelfrom Equations to Executable Code
• Example error message (hard to understand)Error solving nonlinear system 132
time = 0.002residual[0] = 0.288956x[0] = 1.105149residual[1] = 17.000400x[1] = 1.248448...
26 © Peter Fritzson
Algorithm Debugger in Eclipse OpenModelicaMDT Environment, Now also in OMEdit
• Eclipse plugin MDT (Modelica Development Tooling) is the integrated development environment
• Debugger is a debug plug-in within MDT
• Now also in OMEdit
28 © Peter Fritzson
Equation Model Transformation Debugger
• Complicated to understand source of some errors• Trace transformations through the compiler
0 = y + der(x * time * z); z = 1.0;
(1) subst:
y + der(x * (time * z))
=>
y + der(x * (time * 1.0))
(2) simplify:
y + der(x * (time * 1.0))
=>
y + der(x * time)
(3) expand derivative (symbolic diff):
y + der(x * time)
=>
y + (x + der(x) * time)
(4) solve:
0.0 = y + (x + der(x) * time)
=>
der(x) = ((-y) - x) / timetime <> 0
29 © Peter Fritzson
Run-Time Debugger for Equation-Based ModelsIntegrated with OMEdit – first in any Modelica tool
Mapping error Positions backto source model
Tracing symbolictransformations
31 © Peter Fritzson
Integrated Hardware-Software Modeling
ModelicaML UML Profile for Modelica
SysML-Modelica Integration
32 © Peter Fritzson
Using ECLIPSE as Integration Platform
Java runtime
ECLIPSE Rich Client Platform (RCP) Runtime
ECLIPSE Process Framework (EPF) Composer Specific components
OpenModelica runtime
MetaModelica runtime
C/C++ runtime
ECLIPSE Modeling Framework
OpenModelicaMDT
Graphical Modeling Framework
UML-ModelicaPlug-in
OpenUP/Basic Capacity Sub-Process Areas
33 © Peter Fritzson
ModelicaML – UML Profile for Modelica1st Generation (2006-2008)
• Extension of SysML subset• Features:
• Supports Modelica constructs• Modelica generic class modeling• Modelica syntax in definitions• Equation-based modeling• Simulation modeling
34 © Peter Fritzson
ModelicaML UML Profile, 2nd Generation (2009-now)Also SysML/UML to Modelica OMG Standardization(with Wladimir Schamai, from 2009 until Now)
• ModelicaML is a UML Profile for SW/HW modeling• Applicable to “pure” UML or to other UML profiles, e.g. SysML
• Standardized Mapping UML/SysML to Modelica• Defines transformation/mapping for executable models• Being standardized by OMG
• ModelicaML• Defines graphical concrete syntax (graphical notation for diagram) for
representing Modelica constructs integrated with UML• Includes graphical formalisms (e.g. State Machines, Activities,
Requirements) • Which do not exist in Modelica language • Which are translated into executable Modelica code
• Is defined towards generation of executable Modelica code• Current implementation based on the Papyrus UML tool +
OpenModelica
36 © Peter Fritzson
Example: Representation of System Structure
Interconnections
Inheritance
Components
37 © Peter Fritzson
Example: Representation of System Behavior
State Machine of
the Tank
State Machine of the
Controller
Conditional Algorithm
(Activity Diagram)
38 © Peter Fritzson
Example: Representation of System Requirements
Textual Requirement Formalized Requirement
39 © Peter Fritzson
Example: Simulation and Requirements Evaluation
Req. 001 is instantiated 2 times (there are 2 tanks in
the system)
tank-height is 0.6m
Req. 001 for the tank2 is violated
Req. 001 for the tank1 is not violated
40 © Peter Fritzson
System Tester
System Designer
Requirements Analyst
- 1. Select requirements to be verified using simulations (or logic tools)- 2. Formalize textual requirements
- Support Requirements Analyst in selecting requirements - 3. Create system design models to be verified against requirements- Support System Tester in deciding which requirements are to be
verified using which test cases- Support System Tester in linking requirement properties to design
model properties
- 4. Create test modes including test cases and decide which requirement are to be verified using which test cases
- 5. Link requirements to design models - 6. Simulate and observe requirement violations- 7. Analyze simulation results and create a Simulation Summary Report
vVDR – virtual Verification of Design Requirements vVDR Roles and Tasks (Wladimir Schamai PhD thesis Nov 2013)
41 © Peter Fritzson
Modeling Requirements in Modelica
• We need a way of marking requirements in models• introduce a new kind of specialized class: requirement• Requirement language constructs only valid within this kind of class
• 3-valued status of a requirement:• violated, not_violated, not_applicable
// Example Form-L: during (On and (MPSVoltage > V170)) check no (Off becomes true); requirement Req1b_is_on; input Real MPSVoltage;input Boolean on;input Boolean off;equationstatus = if (on and (MPSVoltage > V170)) then
if (off) then Status.violated else Status.not_violatedelse Status.not_applicable;
end Req1bis;
42 © Peter Fritzson
Automating Verification of Scenairo Model Composition using Bindings in Modelica
• Some models require data: Clients• Some models can provide require data: Providers• Clients and providers do not know each other a priori !
• Mediators relate a number of clients to a number of providers
MC
C
…
P
P
…
clients mediator providers
44 © Peter Fritzson
Towards High-Level Parallel Modeling and Simulation• Simulations are
time-consuming• Moore’s ”Law”: (since 1965)
• #devices per chip area doublesevery 18 months
• CPU clock rate also doubled every18 months – until 2003,
then: heat and power issues, limited ILP, ... superscalar technology has reached
its limits,only (thread-level) parallelism can increasethroughput substantially
• The consequence: Chip multiprocessors (+ clusters)• Multi-core, PIM, ... (for general-purpose computing)
• Need parallel programming/modeling/parallelization• Automatic parallelization• Explicit parallel modeling and parallel programming
Single-processor Performance Scaling
0.0
2.0
4.0
6.0
8.0
10.0
12.0
14.0
16.0
1984198619881990199219941996199820002002200420062008201020122014201620182020
Log
2 S
pee
du
p
Limit: Clock rate
Limit: RISC ILP
Throughput incr. 55%/year
65 nm45 nm 32nm 22nm90 nm
Pipelining
RISC/CISC CPI
Device speed
Parallelism
Assumed increase17%/year possible
Source: Doug Burger, UT Austin 20052006
45 © Peter Fritzson
Integrating Parallelism and Mathematical ModelsThree Approaches
• Automatic Parallelization of Mathematical Models (ModPar)• Parallelism over the numeric solver method.• Parallelism over time. • Parallelism over the model equation system
• ... with fine-grained task scheduling
• Coarse-Grained Explicit Parallelization Using Components• The programmer partitions the application into computational components
using strongly-typed communication interfaces. • Co-Simulation • Transmission-Line Modeling (TLM)
• Explicit Parallel Programming • Providing general, easy-to-use explicit parallel programming constructs
within the algorithmic part of the modeling language. • ParModelica, NestStepModelica
46 © Peter Fritzson
Modelica Simulations – Parallelization Approach
• Simulation = solution of (hybrid) DAEs from models
• In each step of numerical solver:• Calculate in g (and Y in h)
• Parallelization approach: perform the calculation of in parallel• Called parallelization over the system.
• Drawback: Numeric solver might become bottle-neck
00
),,(),,,(
tYXhtYXXg
X
X
47 © Peter Fritzson
Modelica + OpenCL = ParModelica
function parvarInteger m = 1024;Integer A[m];Integer B[m];parglobal Integer pm;parglobal Integer pn;parglobal Integer pA[m]; parglobal Integer pB[m];parlocal Integer ps;parlocal Integer pSS[10];
algorithmB := A;pA := A; //copy to deviceB := pA; //copy from devicepB := pA; //copy device to devicepm := m;n := pm;pn := pm;
end parvar;
ParModelica – Modelica Parallel Algorithmic ProgrammingHere: parglobal and parlocal Variables; Execution on GPUs
2014-47
Memory Regions
Accessible by
Global Memory All work-items in all work-groups
Constant Memory
All work-items in all work-groups
Local Memory All work-items in a work-group
Private Memory Priavte to a work-item
48 © Peter Fritzson
ParModelica Matrix Multiplication using Kernel function
Gained speedup• Intel Xeon E5520 CPU (16 cores) 26• NVIDIA Fermi-Tesla M2050 GPU (448 cores) 115
Speedup comparison to sequential algorithm on Intel Xeon E5520 CPU
32 64 128 256 512CPU E5520 (Serial) 0,093 0,741 5,875 58,426 465,234CPU E5520 (Parallel) 0,137 0,17 0,438 2,36 17,66GPU M2050 (Parallel) 1,215 1,217 1,274 1,625 4,057
0,06250,125
0,250,5
1248
163264
128256512
Sim
ulat
ion
Tim
e (s
econ
d)
4,36 13,4124,76 26,34
0,61 4,61
35,95
114,67
64 128 256 512Parameter M (Matrix sizes MxM)
SpeedupCPU E5520 GPU M2050
2014-48
49 © Peter Fritzson
New Scalable OpenModelica Parallel Code Generator
• Ongoing work• Both task parallelism and data parallelism• Handling non-expanded arrays efficiently• Includes use of TLM-partitioning for more parallelism
• OPENMP or Pthreads based parallelization prototype for equation-based models in OpenModelica
• ParModelica - Generating OpenCL code for platform independence
• Template based code generator
50 © Peter Fritzson
Summary of MODPROD Research at PELAB
• Modeling language design (semantics, type systems, meta-modeling, extensibility)
• Model-based efficient optimization (multi-core)• Fault estimation & traceability; Bayesian networks• Modelica-UMLSysML integration• Requirements traceability• Debugging of models• Compilation to multi-core platforms• Compilation and performance measurements for
real-time simulation