The energy footprint of computers, from power-hungry server farms to billions of frequently charged smartphones, tablets and smart watches, is now an important part of the global energy consumption picture. The ENTRA project is building tools for the energy-aware programmer who needs to write energy-efficient code.

Published Monday, 15 December, 2014
Updated Monday, 2 March, 2015

This is a guest blog post, written by the project coordinator of ENTRA, John Patrick Gallagher.

The energy footprint of computers, from power-hungry server farms to billions of frequently charged smartphones, tablets and smart watches, is now an important part of the global energy consumption picture.  Hence we need more energy-efficient hardware, don't we?  Not necessarily. It turns out that the software that runs on modern hardware is often the culprit in energy inefficiency.

The problem is that it's not a simple matter to look at the code for two smartphone apps and understand which one will drain the battery faster. Very few programmers have an idea of how much power their programs dissipate or which parts of a program are energy hotspots.  It might also be different from one phone to another. That raises the question “can programmers be trained to write energy-efficient programs?”.

Software Engineering vs. Energy Transparency?

There are good software engineering reasons for the programmer's ignorance of energy.  The large conceptual gap from hardware, where energy is consumed, to high-level languages and programming abstractions has been created by decades of computer science research and compiler advances. Yet somehow, the energy-aware programmer using a high-level language has to get a profile of the energy consumption induced at the hardware level, without actually executing the program on a machine. Is it possible to bridge the conceptual gap and make energy transparent through the layers?  Is the term energy-aware software engineering a contradiction?

That is the starting point of the EU ENTRA project. ENTRA has some promising answers and is developing prototype tools for the energy-aware programmer.  Methods from automatic complexity analysis and worst-case execution time analysis of programs are extended and combined with energy models of the hardware, giving the programmer an approximate energy profile for the high-level program he or she is writing.

Trade-offs - low-level modelling and high-level analysis

Constructing an accurate energy model at the machine level is hard in the first place. The amount of energy consumed when executing a particular machine instruction depends on many factors and it is simply too complex to model them all.  Mapping that energy model back up to high-level code introduces further approximation. On the other hand, some things get simpler at a higher level.  For example precise analysis of how data flows through the program's threads and which bits of code are most heavily used is easier when the details of the machine are abstracted away. The ENTRA tools experiment with various trade-offs - greater accuracy at lower level versus better analyses at the higher level.

Energy-aware software engineering is a challenging goal, but it is not a contradiction. Even an approximate energy profile for a high-level design of a system can help take decisions that reduce power consumption later. The alternative is to measure the energy of an implemented system and re-engineer it if it is too high. This is an expensive process.  XMOS Ltd, a fabless semiconductor company based in Bristol, UK and a partner in the ENTRA project, is testing the ENTRA tools on embedded systems case studies and plans to introduce energy optimization tools into its toolchain. It is important to reduce development costs for the low-power systems that many of its customers want.

Join the community of the ENTRA project on Facebook !