MC4ES Going Multicore for Embedded Software Jeroen Boydens (KHBO) Marijn Temmerman (KdG) Agenda 1. Kennismaking a) EP - Enterprise Programming b) TERAlabs c) Leden van de gebruikersgroep 2. Project MC4ES a) Omschrijving b) Mindmaps c) Content Management Systeem 3. Stand van zaken a) TERAlabs : Tooling, implementatie b) EP : Design Patterns, testing 4. Varia a) Resultaten van de enquête b) Discussie c) Valorisatieacties d) Planning 2 1
Design Test 29/11/2011 1.a EP onderzoeksgroep Founded: 2006 2007 dr. ing. Jeroen Boydens + founder + instructor + project leader @ep_research http://ep.khbo.be ing. Robbie Vincke + MC4ES ing. Sille Van Landschoot + MC4ES + lab assistant + TDD4ES ing. Olivier Rosseel + academic staff + ICTO coach ing. Piet Cordemans + PhD student + academic staff + TDD4ES ing. Wim Catteeuw + APS4ES 3 1.a EP onderzoeksgroep Industry Partners DistriNet K.U.Leuven Enterprise Programming DistriNet, KUL FMTC Input on fundamental research on SE methods for Traditional Software Systems APS4ES MC4ES Input on fundamental research on Embedded Systems Development PhD J. Boydens PhD P. Cordemans TDD4ES Fundamental research communities 4 2
1.b TERAlabs dr. ir. Marijn Temmerman + founder + instructor + project leader dr. Hugo Van Hove + MC4ES (Tetra) + Can (Hobu) + FlexRay(Tetra) + Kricode (Tetra) Peter Engels + MC4ES (Tetra) + Hi10 (POC) 5 1.b TERAlabs 6 3
1.c Gebruikersgroep 7 Agenda 1. Kennismaking a) EP Enterprise Programming b) TERAlabs c) Leden van de gebruikersgroep 2. Project MC4ES a) Omschrijving b) Mindmaps c) Content Management Systeem 3. Stand van zaken a) TERAlabs : Tooling, implementatie b) EP : Design Patterns, testing 4. Varia a) Resultaten van de enquête b) Discussie c) Valorisatieacties d) Planning 8 4
4.3 4.4 4.6 4.8 1.1 2.1 1.2 4.1 2 wekelijks overleg 2.2 2.2 2.3 2.3 2 wekelijks overleg a. Freestanding (zonder O/S) b. Hosted Environment 3.1 a. beperk in complexe case b. volledig in eenvoudige case 4.2 4.5 4.7 2 wekelijks overleg 2 wekelijks overleg 1.3 3.2 1.4 a. beperk in complexe case b. volledig in eenvoudige case a. Freestanding (zonder O/S) b. Hosted Environment 29/11/2011 2.a MC4ES Verdere rapportage: Engels? 9 2.a MC4ES Migratie van embedded software naar parallelle uitvoering VALORISATIESTAPPEN EXPLORATIE Ontwerppatronen voor parallelle uitvoering Testtechnieken bij parallelle uitvoering Design/Test keuzes Demystificatie Seminarie met Feedback van GC CMS Implementatietechnieken voor parallelle uitvoering Tool ondersteuning voor parallelle uitvoering Implementatie keuzes Management Reviews Seminarie State of industry / State of research Algemene vereisten analyse voor gevalstudies Brainstormsessie gevalstudies met Gebruikersgroep VERDIEPING Ontwerp en Testbaarheid vereisten analyse voor gevalstudies Academische gevalstudies Focus op Design/Testbaarheid CMS Lessons learned Implementatie vereisten analyse voor gevalstudies Academische gevalstudies Focus op Implementatie Feedback seminarie Lessons learned + Bevindingen toetsen aan GC VERDIEPING Industriële validatie gevalstudies Focus op Design/Testbaarheid CMS Best Practices Industriële validatie gevalstudies Focus op Implementatie Studiedag + Management Reviews, Lessons learned en Best Practices mbt gevalstudies + Externe sprekers: domein experten 10 5
2.a MC4ES: WP1 Migratie van embedded software naar parallelle uitvoering VALORISATIESTAPPEN EXPLORATIE 1.1 Ontwerppatronen voor parallelle uitvoering 1.2 Testtechnieken bij parallelle uitvoering Design/Test keuzes 4.1 Demystificatie Seminarie met Feedback van GC 2 wekelijks overleg 4.2 CMS 1.3 Implementatietechnieken voor parallelle uitvoering 1.4 Tool ondersteuning voor parallelle uitvoering Implementatie keuzes Management Reviews 4.3 Seminarie State of industry / State of research 29/11/2011 MC4ES 11 2.b Mindmap 12 6
2.c CMS http://mc4es.khbo.be screenshot met link erboven 13 Agenda 1. Kennismaking a) EP - Enterprise Programming b) TERAlabs c) Leden van de gebruikersgroep 2. Project MC4ES a) Omschrijving b) Mindmaps c) Content Management Systeem 3. Stand van zaken a) TERAlabs : Tooling, implementatie b) EP : Design Patterns, testing 4. Varia a) Resultaten van de enquête b) Discussie c) Valorisatieacties d) Planning 14 7
3.a TERAlabs Information gathered has been divided into 7 categories: Conferences Journals Periodicals Websites Hardware Software Standards 15 3.a Voorbeeld Fiches << Multicore System Analyzer>> SOFTWARE Name Multicore System Analyzer Producer Texas Instrument Website http://processors.wiki.ti.com/index.php/multicore_system_analyzer Classification Language Library Tool Compiler Reseller(s) Price free Manuals part of SYS/BIOS and Linux Multicore Software Development Kits (MCSDK) for C66x, C647x, C645x Processors http://www.ti.com/tool/bioslinuxmcsdk 16 8
3.a Voorbeeld Fiches Conferences Journals Periodicals Websites visits to conferences, information on future conferences, peer-reviewed not courses, blogs, sites of important organisations, 17 Company Processor url #cores AMP embedded AMP86290 link 2 3.a Voorbeeld Fiches processors Cavium OCTEON link Networks Fusion NXP LPC4300 link 2 (h) 6+DSP (networking) Fujitsu FR-1000 link 4 (for networking) Atmel DIOPSIS 740 link ARM7+DSP Dual-core DSP AT572D740 Atmel AT90SDC100/1 04 TWINAVR SECURE DUAL CORE MICROCONTR OLLER link Master core+secure core 18 9
Company Processor url #cores Tilera TILE GX link 100 (probably not suited for ES) Marvell MV78200 link 2(routers,switche s,laser pr) Intellasys SEAforth 40C18 link 40 Freescale QorIQ link 2 (networking) Freescale MPC8641D link1 link2 Renesas SH7265 link 2 (car eg car audio) Renesas SH7776 link 2 Toshiba Capricorn-H link 2 ARM Cortex- A9 Texas Instruments Overview link 19 3.a Software & Standards Standards: OpenMP, OpenCL, MPI, POSIX threads, IntelTBB Tools for analysis used for porting and optimizing existing code For finding problems specific for parallel programming (race conditions, dead locks, ) Debuggers OS: Windows,Linux,RTOS,bare metal 20 10
3.a Parallel Programming (starting from existing sequential code) 1.Determine independent parts 2.Refactor program 3.Implement 21 3.a Parallel Programming Determine independent parts use tools For example: Intel Parallel Advisor vfanalyst Refactor program by hand 22 11
Programmer effort 29/11/2011 3.a Parallel Programming Implementation Java threads OS+pthreads or MPI or OpenMP RTOS Bare metal Hardware 23 3.a Questions Questions for GG: Which processors? Which development boards? Also C++? Which standards? Ideas for simple applications Applications from scratch or porting (sequential to parallel) 24 12
3.a ARM Benoît Modave 25 3.a Overzicht 26 13
3.a Configuraties 27 3.a Cortex A9 overview 28 14
3.a Dev. Board: Snowball 29 3.a AP9500 Cortex-A9 -Dual-core @ 1GHz -L1 cache: 32K-I + 32K-D SRAM -L2 cache: 512K SRAM -FPU, NEON 30 15
3.a Multicore Instructies Voor ARMv6 -SWP en SWPB (Wordt afgeraden) Sinds ARMv6 -Load-Exclusives -Store-Exclusives -Clear-Exclusive Daarnaast zijn er nog heel wat instructies atomic 31 3.a OpenMP Gebaseerd op fork/join model 32 16
3.a Gebruik Gebruik van compiler directives: #pragma omp directive-name \ [clause[ [,] clause]...] 33 3.a Gebruik Functies aanroepen. #include <omp.h>... omp_set_num_threads(4); OS environment variabelen. $ OMP_NUM_THREADS= 2 34 17
3.a OpenMP voorbeeld int i; float a[]; float b[]; float c[]; float tmp[]... #pragma omp parallel for private (tmp) for (i=0; i<n; i++) { tmp= a[i] / b[i]; c[i]= tmp * tmp; } 35 3.a Intel Atom Siegfried Mercelis 36 18
3.a Inhoud Hardware Intel Atom Intel Desktop Board D510MO Multicore instructies Software Intel Parallel Studio 37 3.a Intel Atom Netbooks, embedded devices,... x86-64-microprocessor Zelfde instructieset zelfde software Linux, Windows, Low-power Geoptimaliseerde architectuur In-order-processing Langere pipeline wegens zuinige cache Delen van ALU s Power management Laagst mogelijke voltage Deep power down Binary clock tree 38 19
3.a Intel Atom D510 1,66 GHz Dual Core met Hyper-Threading 2 Cores, 4 Threads 64 bit instructieset, MMX, SSE, SSE2, SSE3, SSSE3 Integrated Graphics Media Accelerator 3150 200Mhz, shared memory DirectX 9, OpenGL 1.5, Shader 3.0, MPEG-2 Decode VGA, LVDS* Integrated Memory Controller Tot 4 GB RAM, single channel DDR2 Max. TDP 13 Watt 39 3.a Architectuur Cache L1 Cache (per core) 32kB instructie-cache 24kB data-cache Asymmetrisch 1MB L2 Cache 512kB per core Geen L3 Cache Hyper-Threading 2 fysieke cores 4 logische cores 40 20
3.a Intel Desktop Board D510MO Mini-ITX/microATX 2 Chip Systeem Intel Atom D510 Intel NM10 Express Chipset PS/2, Serial, Parallel, VGA, Ethernet, USB 2.0, audio, SATA, PCI & PCI-Express Mini card, BIOS,... Tot 4GB DDR2 41 3.a Intel Parallel Studio Software Parallel Advisor Waar heeft parallelliseren van seriële code de grootste impact? Parallel Composer C/C++ compiler, libraries, parallel building blocks Parallel Amplifier Identificeert bottlenecks, slechte wachttijden,... Parallel Inspector Identificeert Multithreading fouten (deadlocks, etc.) Ondersteuning Linux (Eclipse) & Windows (Visual Studio) Intel Threading Building Blocks, OpenMP, Windows Threads 42 21
3.a Multicore instructies Gegarandeerd atomische operaties Read/write Exchange Lock-prefix Bit test & modify instructies Compare Exchange instructie Logische en mathematische functies (INC, AND, ADD,...) 43 3.a XMOS Wim Van der Wilt 44 22
3.a XMOS Platform Specifiek ontwikkeld voor embedded toepassingen Scheduling, thread handeling en communicatie tussen threads wordt gedaan door hardware XC taal is specifiek voor het XMOS platform ontwikkeld 45 3.a Toepassingen Audio Encoding/Decoding Motor control Audio Video Bridging over Ethernet Iphone/Ipod Dock toepassingen 46 23
3.a Hardware Platform bestaat uit een array van tiled single-chip processors Processors bestaan in een single & in een quad-core versie Per core kunnen er max 8 threads gescheduled worden Schedulen & synchroniseren van threads gebeurt door hardware 47 3.a Hardware Threads kunnen met elkaar communiceren doormiddel van channels I/O gebeurt via ports die ook gebufferd en getimed kunnen worden Mogelijkheid tot event-driven processing 48 24
3.a XC Taal, gebaseerd op c speciaal ontwikkeld voor XMOS platform Threads kunnen toegewezen worden aan specifieke cores en ook hoe ze gescheduled worden Poorten, timers en channels kunnen aangesproken worden vanuit de taal 49 3.a XC Geen ondersteuning voor floating point & pointers Compiler en taal zo geschreven dat er geen race conditions mogelijk zijn XC kan gebruikt maken van C & C++ code die dan geëmuleerd word dmv LLVM 50 25
3.a Demo XMOS 51 3.b Management Review Book, article, tech report, standard, etc. Visual Reference One pager Abstract Keywords Technology Relevance Rating Reference Mindmap Zie print-out in uw bundel 52 26
3.b Design Pattern fiches Pattern name Classification Problem Statement Solution Figure Consequences Related Patterns Literature Zie print-out in uw bundel 53 3.b Design Pattern fiches Thread Pool pattern Classification: Implementation Mechanisms Problem: Fork/Join indirect mapping van tasks Static number of UE s 54 27
3.b Design Pattern fiches Thread Pool pattern Solution: Shared task queue Consequences: Use of shared resources (task queue) 55 3.b Demo priemgetallen Singlecore versie vs. Dualcore versie C Uitvoertijd opmeten (Amdahl) 56 28
3.b Demo priemgetallen Trial Division algoritme Evalueer elk oneven nummer n Deling door elk eerder gevonden priemgetal < n Als rest = 0 geen priemgetal Max. aantal benodigde berekeningen: ln n n 57 3.b Demo priemgetallen Opbouw Local memory (per CPU core) Lokale teller: geeft het aantal berekende priemgetallen weer Shared memory Resultatenarray met gevonden priemgetallen Task queue met te evalueren nummers 58 29
3.b Demo priemgetallen Design Patterns Fork/Join pattern Indirecte mapping op 2 CPU cores Main() wordt twee maal uitgevoerd. Selectie op basis van CPU ID. Thread Pool pattern Evaluatie van een oneven nummer = taak Evaluatie volgens Trial Division algoritme 59 3.b Demo priemgetallen DEMO 60 30
3.b Demo priemgetallen 61 Agenda 1. Kennismaking a) EP Enterprise Programming b) TERAlabs c) Leden van de gebruikersgroep 2. Project MC4ES a) Omschrijving b) Mindmaps c) Content Management Systeem 3. Stand van zaken a) TERAlabs : Tooling, implementatie b) EP : Design Patterns, testing 4. Varia a) Resultaten van de enquête b) Discussie c) Valorisatieacties d) Planning 62 31
4.a Enquête Doel Huidige toestand Verwachtingen Enkel technische leden gebruikersgroep N = 11 Genormaliseerde scores Naar groter doelpubliek verspreiden 63 4.a Enquête What is the number of processors in a single application? >8 processors 8 Processors 4 Processors 2 Processors 1 Processor 0% 20% 40% 60% 80% 100% Normalized score 64 32
4.a Enquête What is the number of cores you plan to use? >8 cores Present 8 cores Future 4 cores 2 cores 1 core 0% 20% 40% 60% 80% 100% Normalized score 65 4.a Enquête What is your key concern about multicore systems? Security Cost Speed Power Efficiency Reliability 0% 20% 40% 60% 80% 100% Normalized score 66 33
4.a Enquête What type of hardware platform do you intend to use? MIPS ARM M-series Xcore (XMOS) PowerQuiCC TILERA QorIQ x86 (other) x86 (Intel/AMD) ASIC Blackfin Atom PowerPC FPGA ARM-A series 0% 10% 20% 30% 40% 50% Normalized score 67 4.a Enquête What type of processor do you intend to use? Heterogeneous 61,54% Homogeneous 38,46% Homogeneous Heterogeneous 68 34
Normalized score 29/11/2011 4.a Enquête Which programming language do you use? 100% 90% 80% 70% 60% 50% 40% 30% 20% 10% 0% C C++ Assembly Java.NET Matlab Python Other 69 4.a Enquête Which of the following language extensions/frameworks/libraries are you familiar with? OpenMP 9% None 29% Other 29% POSIX Threads 24% MPI 9% OpenMP POSIX Threads MPI OpenCL TBB Other None TBB 0% OpenCL 0% 70 35
Normalized score 29/11/2011 4.a Enquête Are you interested in tools for porting sequential code to parallel code? No 45% Yes 55% Yes No 71 4.a Enquête Which operating system are you using? 100% 90% 80% 70% 60% 50% 40% 30% 20% 10% 0% Commercial OS In-house developed OS Open Source OS Freestanding 72 36
4.a Enquête Are Real-Time capabilities/performance required? Very important Important Neutral Less important Not important 0 1 2 3 4 5 6 7 8 73 4.b Discussie enquête 74 37
4.c Valorisatie J. Boydens and M. Temmerman. MC4ES: Going Multicore for Embedded Software. Presented at Academia-to-Business forum, DSPValley, 2011. R. Vincke, S. Van Landschoot, P. Cordemans, J. Boydens and E. Steegmans. Performance Experiments on Multicore Embedded Systems. Proceedings of the Fourth European Conference on the Use of Modern Information and Communication Technologies, 2011. I. Neshev, P. Cordemans, S. Van Landschoot and J. Boydens. Multitasking Framework for Embedded Multicore Systems. Proceedings of the Twentieth International Scientific and Applied Science conference: Electronics-ET, 2011. OptiMMA Symposium. Optimization of MP-SoC Middleware for Eventdriven Applications. 18/11/2011 75 4.c Planning Migratie van embedded software naar parallelle uitvoering VALORISATIESTAPPEN EXPLORATIE 1.1 Ontwerppatronen voor parallelle uitvoering 1.2 Testtechnieken bij parallelle uitvoering Design/Test keuzes 4.1 Demystificatie Seminarie met Feedback van GC 2 wekelijks overleg 4.2 CMS 1.3 Implementatietechnieken voor parallelle uitvoering 1.4 Tool ondersteuning voor parallelle uitvoering Implementatie keuzes Management Reviews 4.3 Seminarie State of industry / State of research 76 38
4.c Planning Volgende GG vergadering? 2012 Week 8-12 Doodle Factuur lidmaatschap opvolgen 77 39