GEODES Global Energy Optimisation for Distributed heterogeneous Embedded Systems Tutorial Exploitation of power management techniques in Wireless Sensor Networks Sébastien Bilavarn, Cécile Belleudy University of Nice Sophia Antipolis - CNRS LEAT Como, Italy Feb. 2011 WUPS tutorial / GEODES – LEAT Univ. Nice / CNRS 1 of 40 Outline • Power management: state of the art • Energy and Power Aware Scheduling • Power management: Howto • Power Management • Operating System • Power Strategies • Application study • Low power video surveillance application • Conclusion WUPS tutorial / GEODES – LEAT Univ. Nice / CNRS 2 of 40 Exploitation of power management techniques in Wireless Sensor Networks Exploitation of power management techniques in Wireless Sensor Networks POWER MANAGEMENT: STATE OF THE ART WUPS tutorial / GEODES – LEAT Univ. Nice / CNRS 3 of 40 Energy and Power aware Scheduling Application + constraints Features of the platform Issue : schedule in order to meet time constraint with lowest energy : determine a global frequency based on the worst case execution time of a task set, tune the processor frequency according to the workload, low power mode in case of no (or low) workload. Global frequency Local frequency Low power mode 4 4 of 40 Dynamic Voltage and Frequency Scaling Deadline Power P1 Task ti P2 < P1 E2 < E1 f2 Global frequency (for all task) : based on the schedulability test according to the worst case execution time of a task set V2 < V1 f2 < f1 f1 Task ti Hors ligne Slow down factor: S = f1 / f2 Local frequency (for each job) : based on the schedulability test, The worst case execution time is substituted by the actual execution time => Lot of switch Lot of works : LP EDF, CC-RM, Power savings ? Unrealistic hypothesis : Tswitch ? 55 of 40 Low power modes (DPS) 2 to 4 low power modes : Example : Idle : data are saved in the memory cache, Sleep : data are lost. Switch in low power mode Time requirement T1 T2 T1 T3 Data in the cache memory ? Real time system : Off line or online policy Based on the schedulabitity test … T > Tsleep + Twakeup, Soft system : Probability based estimations of inactivity time, period, duration 6 of 40 DVFS or DPS Deadline F1,V1 Task1 Processeu r : nop E = Etask1,F1,V1 + Enop Deadline F2<F1,V2<V1 Task1 E’ = Etask1,F2,V2 + EswitchVF E’ < Etask1,F1,V1 < E Decrease of E and Ppeak. Deadline F1,V1 Task1 Processor in low power mode E’’ = Etask1,F1,V1 + Eswitch + Elp mode repos E’’ > Etask1,F1,V1(>E’) < E 7 of 40 Global methodology Power mode modelling : power characterization, time (switch delay) High level estimation of system (application, platform): power, energy, autonomy Power manager : strategy to reduce the power consumption, autonomy, … Modelling Experiment Power saving Estimation Optimisation : Exploration de solutions HW, SW 8 of 40 Exploitation of power management techniques in Wireless Sensor Networks Exploitation of power management techniques in Wireless Sensor Networks POWER MANAGEMENT: HOWTO WUPS tutorial / GEODES – LEAT Univ. Nice / CNRS 9 of 40 Power Management (1) • What is power management ? • We refer in the following to CPU level techniques able to operate dynamically (on the fly). • Hardware capabilities to exploit sleep modes, and/or to change the operating frequency. • A set of: • Power management mechanisms • Dynamic Voltage and Frequency Scaling (DVFS) • Dynamic Power Switching (DPS) • Power management policies (or strategies) • Governors WUPS tutorial / GEODES – LEAT Univ. Nice / CNRS 10 of 40 Power Management (2) • Power management mechanisms • DVFS: frequency scaling • Ability to change the CPU(s) clock speed on the fly • States are called operating performance points • Example: TI OMAP3530 • DPS: power swtiching • Ability to switch CPU(s) low-power modes • Many idle states with different recovery time and power GEODES Présentation 11 of 40 Power Management (3) • Power management strategies • Frequency selection policy • Automatic choice among performance states • Governors: how to apply these states? • Examples: Ondemand, Conservative (Linux) • Mainly workload based • DPS: Dynamic Power Swtiching • Automatic choice among idle states • Governors: • Examples: ladder, menu (Linux) • Step wise/parameter based approach to select idle states GEODES Présentation 12 of 40 Linux PM support (1) • Provides a platform independent interface • To handle power management mechanisms • To use existing power management strategies • Driver support • DVFS: CPUfreq • DPS: CPUidle • Supported by a large variety of platforms • Basic power management policies • Governors • Open source community support WUPS tutorial / GEODES – LEAT Univ. Nice / CNRS 13 of 40 Linux PM support (2) • Demo • OMAP-PM Distribution (Kevin Hilman) • http://elinux.org/OMAP_Power_Management • Suspend/resume • echo mem > /sys/power/state • mount -t debugfs nodev /sys/kernel/debug/ • echo 4 > /debug/pm_debug/wakeup_timer_seconds • DVFS • echo 125000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed WUPS tutorial / GEODES – LEAT Univ. Nice / CNRS 14 of 40 Power strategies (1) • Definition • A power strategy is a module which functionality is to apply power management techniques on the resources of the system in a way to save power and/or energy. • The power strategies are applied at runtime to support current and future resource requirements • Example • So far, very basic power strategies are actually used • Linux CPUfreq governors WUPS tutorial / GEODES – LEAT Univ. Nice / CNRS 15 of 40 Power strategies (2) Existing power strategies: Linux CPUfreq governors Performance governor: Highest frequency The performance governor statically sets the processor to the highest frequency available. Powersave governor: Lowest frequency On the flip side, the powersave governor statically sets the processor to the lowest available frequency. Userspace governor: Manual frequencies Next there is the userspace governor, which allows you to select and set a frequency manually. Ondemand governor: Frequency change based on processor use The ondemand governor checks the processor utilization and if it exceeds the threshold, the governor will set the frequency to the highest available. Conservative governor: A more gradual ondemand The conservative governor checks the processor utilization and if it is above or below the utilization thresholds, the governor steps up or down the frequency to the next available instead of just jumping to the highest frequency as ondemand does. WUPS tutorial / GEODES – LEAT Univ. Nice / CNRS 16 of 40 Power strategies (3) • Limits of existing strategies • Typical strategies are based on processor workload, but the workload is not always the driving parameter for frequency scaling oportunities (actual execution time, latency, bit rate, etc). • There is room for more efficient strategies by defining strategies that are specific to the application domain. • Task scheduling • Video processing WUPS tutorial / GEODES – LEAT Univ. Nice / CNRS 17 of 40 Power strategies (4) • Limits of existing strategies • Example: video processing • Video processing is almost in all cases a 100% CPU load application. • Using an Ondemand governor will result in setting the CPU to its maximum frequency. • The driving parameter in a video application is the frame rate. • Adapting the CPU frequency to the framerate required (e.g. 30 fps) has potential to decrease the operating frequency (thus power consumption). So how to develop a power strategy suited to an application domain ? WUPS tutorial / GEODES – LEAT Univ. Nice / CNRS 18 of 40 Exploitation of power management techniques in Wireless Sensor Networks Exploitation of power management techniques in Wireless Sensor Networks APPLICATION STUDY: VIDEO OVER IEEE 802.15.4 WUPS tutorial / GEODES – LEAT Univ. Nice / CNRS 19 of 40 Design of a power strategy • Objectives • Design of an ad hoc power strategy suited to WSN constraints • Illustration: low power video surveillance application • Development approach • Application development • Performance analysis • Power strategy definition • Power savings measurement/estimations WUPS tutorial / GEODES – LEAT Univ. Nice / CNRS 20 of 40 Application overview Very low power video surveillance application Video monitoring and transmission using IEEE 802.15.4 802.15.4 802.15.4 Camera sensor Video capture Compression Transmission IEEE 802.15.4 Base station/cluster head WUPS tutorial / GEODES – LEAT Univ. Nice / CNRS Reception IEEE 802.15.4 Decompression Video display 21 of 40 Requirements (1) • Hardware • Wireless radio • IEEE 802.15.4 • low power, short range (10 – 75 meters), low bit rate (20 - 250 Kbit/s) • Power management • DVFS on each kind of nodes (camera sensor, display nodes) • Monitoring capabilities • Camera: compression is mandatory given transmission speed limitations • Display: only on display nodes (some basestations used as control nodes) • Video compression/decompression • A MPEG2 standard is used for encoding complexity reasons (low processing power of WSN nodes) → Suited platform → OS support (variety of drivers) WUPS tutorial / GEODES – LEAT Univ. Nice / CNRS 22 of 40 Requirements (2) • Platforms • Crossbow IMOTE2 • PXA271 XScale® Processor at 13-416MHz • Wireless radio: • integrated 802.15.4 • Power management • DVFS, DPS • Monitoring capabilities • Extension for camera chip interface • No display • Operating System • TinyOS: few drivers support • No Linux support • No CPU power measurement → Not usable in practice WUPS tutorial / GEODES – LEAT Univ. Nice / CNRS 23 of 40 Requirements (3) • Platforms • Beagleboard • TI OMAP3530 processor • Up to 600 MHz • Wireless radio • None • Power management • DVFS, DPS • Monitoring capabilities • USB video camera • DVI-D output • Operating System • Many ports of Linux distributions • Ubuntu, Linux-omap, etc • No CPU power measurement → Intended for mobile phones, but large set of devices, APIs and drivers (Linux) WUPS tutorial / GEODES – LEAT Univ. Nice / CNRS 24 of 40 Requirements (4) • Operating System • Linux APIs and drivers • Wireless radio • XBee modules under the control of a serial connection, using termios API • Power management • CPUfreq, (CPUidle) • Monitoring capabilities • Camera: standard USB webcam supported by video capture API for Linux (V4L USB Video Class) • Display: X Window, Graphical User Interface, GIMP toolkit (GTK) • Distributions • Linux-omap-pm: Camera sensors • Ubuntu: Display nodes WUPS tutorial / GEODES – LEAT Univ. Nice / CNRS 25 of 40 Demo WUPS tutorial / GEODES – LEAT Univ. Nice / CNRS 26 of 40 Performance analysis MPEG2 performance on OMAP3 (w/o 802.15.4) 125MHz 250MHz 500MHz 550MHz 600MHz 720MHz Encoder 0,95 fps 1,92 fps 3,80 fps 4,16 fps 4,76 fps 5,61 fps Decoder 23 fps 43 fps 92 fps 101 fps 111 fps 130 fps MPEG2 performance on OMAP3 (w/ 802.15.4) • Bit rate: 4KB/sec max (average compressed frame size: 2KB) • Frame rate: 2.3 fps max Application 1: DVFS strategy for video encoding → adapt OMAP frequency to the variations of the bit rate 2 KB/s → 125 MHz, 4 KB/s → 250 MHz, 8 KB/s → 500 MHz 1 fps → 125 MHz, 2 fps → 250 MHz, 4 fps → 500 MHz WUPS tutorial / GEODES – LEAT Univ. Nice / CNRS 27 of 40 Power strategy definition Bit rate KB/sec 8 500MHz 4 250MHz 2 125MHz Time 1fps -2fps < 1fps 1fps - 2fps > 2fps Bit rate < 2KB/s → useless to run CPU at more than 125 MHz Bit rate < 4KB/s → useless to run CPU at more than 250 MHz Bit rate < 8KB/s → useless to run CPU at more than 500 MHz WUPS tutorial / GEODES – LEAT Univ. Nice / CNRS 28 of 40 Evaluation conditions Energy savings and lifetime extensions are based on measures and estimations: • It is not possible to measure power/energy (on OMAP/beagleboard) • Limitations on DVFS implementation (Linux CPUfreq/beagleboard) • Transmission speed can actually be measured on a real video capture and transmission example. DVFS - Transmit adaptation principle: bit rate < 2000 Bytes/sec → 125 MHz bit rate < 4000 Bytes/sec → 250 MHz (4000 Bytes/sec < bit rate < 8000Bytes/sec → 500 MHz) 2000 Bytes/sec < • We can combine this with real power measures (on OMAP/EVM) OPP 125MHz 250MHz 500MHz 550MHz 600MHz P (mW) 57 130 303 371 445 720MHz -29 of 40 Energy and Lifetime analysis (1) Analysis of energy savings • Based on transmission speed measures and OMAP 3530 power consumption measures at different operating points • An estimation of energy can be comptuted from the time spent in frequency each zone i: E = Σ(POMAP * Ti). • Energy savings are given by the ratio δ = (Ew/o - Ew/ ) / Ew/ Analysis of lifetime extension • From previous energy savings (δ %), we can compute an estimation of lifetime extension Textended based on E = Paverage* T • Since E is reduced from δ %, considering Paverage is constant implies: Textended = T * 100 / (100 - δ) 30 of 40 Energy and Lifetime analysis (2) Analysis of energy savings and lifetime extension over no DVFS strategy • First case: node is operating at nominal frequency (500 MHz) → Energy gains over nominal frequency (500 MHz) • Second case: node is set a minimum possible frequency to process video without loss in quality level (250 MHz). → Energy gains over minimum static frequency (250 MHz) Measures are performed on 3 sample tests where the actual transmission speed is measured on 2 physical prototypes 31 of 40 Sample test #1 36s video monitoring Bytes/sec Transmission speed variations 3000 250MHz 2500 2000 1500 125MHz 1000 500 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 Frame number Energy savings + lifetime extension over nominal freq (500MHz) Energy Energy savings Lifetime extension 500MHz 10.908 J 7.182 J -- W/ strategy 3.726 J 65.8% 2.92x 32 of 40 Sample test # 2 30s video monitoring Bytes/sec 3000 250MHz 2500 2000 1500 125MHz 1000 500 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Frame number Energy savings + lifetime extension over nominal freq (500MHz) Energy Energy savings Lifetime extension 500MHz 9.09 J 6.504 -- W/ strategy 2.586 J 71.5% 3.51x 33 of 40 Sample test # 3 135s video monitoring Bytes/sec 3000 250MHz 2500 2000 1500 125MHz 1000 500 1 7 13 19 25 31 37 43 49 55 61 67 73 79 85 91 97 103 109 115 121 127 133 139 145 151 157 163 169 175 181 187 193 199 205 0 Frame number Energy savings + lifetime extension over nominal freq (500MHz) Energy Energy savings Lifetime extension 500MHz 63.63 J 45.966 -- W/ strategy 17.664 J 72.2% 3.6x 34 of 40 Sample test #1 36s video monitoring Bytes/sec Transmission speed variations 3000 250MHz 2500 2000 1500 125MHz 1000 500 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 Frame number Energy savings + lifetime extension over minimum static freq (250MHz) Energy Energy savings Lifetime extension 250MHz 4.68 J 0.954 -- W/ strategy 3.726 J 20.4% 1.26x 35 of 40 Sample test # 2 30s video monitoring Bytes/sec 3000 250MHz 2500 2000 1500 125MHz 1000 500 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Frame number Energy savings + lifetime extension over minimum static freq (250MHz) Energy Energy savings Lifetime extension 250MHz 3.9 J 1.314 J -- W/ strategy 2.586 J 33.7% 1.49x 36 of 40 Sample test # 3 135s video monitoring Bytes/sec 3000 250MHz 2500 2000 1500 125MHz 1000 500 1 7 13 19 25 31 37 43 49 55 61 67 73 79 85 91 97 103 109 115 121 127 133 139 145 151 157 163 169 175 181 187 193 199 205 0 Frame number Energy savings + lifetime extension over minimum static freq (250MHz) Energy Energy savings Lifetime extension 250MHz 27.3 J 9.636 -- W/ strategy 17.664 J 35.3% x 1.55 37 of 40 GEODES Global Energy Optimisation for Distributed heterogeneous Embedded Systems Tutorial Exploitation of power management techniques in Wireless Sensor Networks Sébastien Bilavarn, Cécile Belleudy University of Nice Sophia Antipolis - CNRS LEAT Como, Italy Feb. 2011 WUPS tutorial / GEODES – LEAT Univ. Nice / CNRS 38 of 40