Multi-Threaded Distributed System Simulations

Multi-Threaded Distributed System Simulations

Linköping Studies in Science and Technology Licentiate Thesis No. 1576 Multi-Threaded Distributed System Simulations Using Bi-Lateral Delay Lines Robert Braun LIU-TEK-LIC-2013:10 Division of Fluid and Mechatronic Systems Department of Management and Engineering Linköping University, SE–581 83 Linköping, Sweden Linköping 2013 Copyright c Robert Braun, 2013 Multi-Threaded Distributed System Simulations Using Bi-Lateral Delay Lines ISBN 978-91-7519-694-7 ISSN 0280-7971 LIU-TEK-LIC-2013:10 Distributed by: Division of Fluid and Mechatronic Systems Department of Management and Engineering Linköping University SE-581 83 Linköping, Sweden Printed in Sweden by LiU-Tryck, Linköping 2013. To Emma Multi-tasking - screwing everything up simultaneously. ” Unknown Abstract As the speed increase of single-core processors keeps declining, it is im- portant to adapt simulation software to take advantage of multi-core technology. There is a great need for simulating large-scale systems with good performance. This makes it possible to investigate how different parts of a system work together, without the need for expensive physical prototypes. For this to be useful, however, the simulations cannot take too long, because this would delay the design process. Some uses of simulation also put very high demands on simulation performance, such as real-time simulations, design optimization or Monte Carlo-based sen- sitivity analysis. Being able to quickly simulate large-scale models can save much time and money. The power required to cool a processor is proportional to the proces- sor speed squared. It is therefore no longer profitable to keep increasing the speed. This is commonly referred to as the "power wall". Manufac- turers of processors have instead begun to focus on building multi-core processors consisting of several cores working in parallel. Adapting pro- gram code to multi-core architectures constitutes a major challenge for software developers. Traditional simulation software uses centralized equation-system solvers, which by nature are hard to make parallel. By instead using distributed solvers, equations from different parts of the model can be solved simul- taneously. For this to be effective, it is important to minimize overhead costs and to make sure that the workload is evenly distributed over the processor cores. Dividing an equation system into several parts and solving them sep- arately means that time delays will be introduced between the parts. If these occur in the right locations, this can be physically correct, since it also takes some time for information to propagate in physical systems. i The transmission line element method (TLM) constitutes an effective method for separating system models by introducing impedances be- tween components, causing physically motivated time delays. Contributions in this thesis include parts of the development of the new generation of the Hopsan simulation tool, with support for TLM and distributed solvers. An automatic algorithm for partitioning models has been developed. A multi-threaded simulation algorithm using barrier synchronization has also been implemented. Measurements of simulation time confirm that the simulation time is decreased almost proportionally to the number of processor cores for large models. The decrease, however, is reduced if the cores are divided on different processors. This was expected, due to the communication delay for processors communicating over shared memory. Experiments on real-time systems with four cores show that a four times as large model can be simulated without losing real-time performance. The division into distributed solvers constitutes a sort of natural co- simulation. A future project could be to use this as a platform for linking different simulation tools together and simulating them with high performance. This would make it possible to model each part of the system in the most suitable tool, and then connect all parts into one large model. ii Sammanfattning Att anpassa simuleringsmjukvara för att kunna utnyttja flerkärniga pro- cessorer är viktigt, eftersom processorkärnornas hastighet inte ökar i samma takt som tidigare. Efterfrågan på storskaliga systemsimuleringar med god prestanda är stor. Sådana simuleringar gör det möjligt att un- dersöka hur olika delkomponenter i ett större system fungerar tillsam- mans, utan att behöva bygga dyra fysiska prototyper. Det är dock vik- tigt att simuleringen inte tar för lång tid, eftersom detta skulle fördröja utvecklingsprocessen. Vissa användningsområden, som till exempel realtidssimulering, konstruktionsoptimering och Monte Carlo-baserade känslighetsanalyser, ställer också särskilt höga krav på simuleringens prestanda. Man kan spara mycket tid och pengar genom att snabbt kunna simulera storskaliga modeller. Effekten som krävs för att kyla en processor är proportionell mot pro- cessorns hastighet i kvadrat. Att fortsätta öka hastigheten är därför inte längre lönsamt. Detta kallas allmänt för "the power wall". För att kringgå detta har processortillverkare istället börjat fokusera på flerkärniga processorer. Dessa består av flera kärnor som arbetar paral- lellt. Mjukvaruutvecklare står nu inför den stora utmaningen att anpassa programkod till flerkärniga arkitekturer. I traditionella simuleringsprogram används centrala ekvationslösare. Att skriva om dessa på parallell form är svårt. Ett alternativ är att istället använda distribuerade lösare, så att olika delar av modellen kan lösas samtidigt. För att detta ska bli effektivt så är det viktigt att minimera overhead-kostnader och att se till att beräkningarna är jämnt fördelade över processorkärnorna. För att dela upp ett ekvationssystem i flera delar och lösa dem sep- arat så krävs att man inför tidsfördröjningar mellan de olika delarna. Eftersom det tar en viss tid för information att propagera genom ett iii verkligt system, kan dessa tidsfördröjningar placeras på fysikaliskt mo- tiverade platser. En effektiv metod för att dela upp en systemmodell på detta sätt är transmission line element-metoden (TLM), som använder impedanser för att orsaka tidsfördröjningar mellan komponenter. En viktig del av resultaten i den här avhandlingen är stora delar av utvecklingen av den nya generationen av simuleringsverktyget Hopsan, som stödjer TLM och distribuerade lösare. Bland annat har en algoritm för att automatiskt dela upp modeller tagits fram. En algoritm för multitrådade simuleringar, baserad på barriärsynkronisering, har också implementerats. Mätresultat av simuleringstiden för stora modeller bekräftar att simu- leringstiden minskar nästan proportionellt till antalet processorkärnor. Tidsvinsten blir dock mindre när processorkärnor från olika processorer används. Eftersom kommunikationstiden mellan processorer måste gå via datorns delade minne var detta väntat. Experiment på realtidssys- tem med fyra kärnor visar att en fyra gånger så stor modell kan köras i realtid jämfört med simulering på en kärna. Att dela upp en modell med hjälp av distribuerade lösare resulterar i en sorts naturlig co-simulering. Ett framtida projekt skulle kunna vara att använda detta som en plattform för att koppla samman olika simuleringsverktyg och simulera dem parallellt med god prestanda. Det skulle då bli möjligt att modellera varje del av systemet med det bäst lämpade simuleringsverktyget och sedan koppla samman alla delar till en stor modell. iv Acknowledgements This project was conducted at the Division of Fluid and Mechatronic Systems (Flumes) at Linköping University. It is a result of the project High Performance Simulation for Product Design and Operation (HiPO), and was supported by ProViking research school and the Swedish Foun- dation for Strategic Research (SSF). There are many people to whom I would like to express my gratitude for their support in this project. First of all I would like to thank my supervisor, Prof. Petter Krus, for his encouragement and support, and for giving me the opportunity to be a part of this division. I would also like to thank all my colleagues at the division, especially my co-workers in the Hopsan project, Peter Nordin and Dr. Björn Eriksson, for their great contributions and for sharing their expertise. Thanks also to the industrial partners supporting this project, espe- cially to the team at Atlas Copco Rock Drills for our close cooperation and for verifying my results in real applications. Last but not least I would like to thank my beloved Emma for lov- ing support, and my parents for believing in me and encouraging my academic career. Linköping, January 2013 Robert Braun v vi Abbreviations CPU central processing unit DAE differential algebraic equation FMI Functional Mock-up Interface GPU graphics processing unit MIMD multiple instruction multiple data ODE ordinary differential equation SIMD single instruction multiple data TBB Threading Building Blocks TLM transmission line element method vii viii Nomenclature AL Four-pole element see eq. (2.5) [-] BL Four-pole element see eq. (2.5) [-] C Hydraulic capacitance see eq. (2.3) [m5N] CL Four-pole element see eq. (2.5) [-] DL Four-pole element see eq. (2.5) [-] EF Parallelization efficiency see eq. (3.5) [-] G Hydraulic conductance see eq. (2.2) [m3sPa] L Hydraulic inductance see eq. (2.4) [Ns2m5] N Frequency-dependent friction factor see eq. (2.7) [-] R Hydraulic resistance see eq. (2.1) [sPam3] SL Parallelization slow-down see eq. (3.6) [-] SUabs Absolute speed-up see eq. (3.3) [-] SUrel Relative speed-up see eq. (3.4) [-] T Time delay see eq. (2.7) [s] V Oil volume see eq. (2.21) [m3] 5 Zc Characteristic

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    74 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us