Energy Consumption of Software – Using CPU Time or CPU Utilization as a Proxy

Question

How good/bad is the usage of CPU time or CPU utilization as a proxy for energy consumption?

Seealso
Issues with CPU Time / Utilization as a Proxy Metric

If used as a proxy for CPU energy consumption:

  • usage of different CPU instructions may lead to different energy consumption
  • frequency may change due to DVFS
  • hyper-threading
  • waiting time (stalled) is part of the CPU Utilization

If used as a proxy for the energy consumption of the whole machine:

  • energy consumption of some components are independent of CPU activity(e.g. memory consumes energy of the time)

Experiment by Qiao et al. (2024)

qiao.etal.2024.energyawareprocessscheduling (image) (pg. 2)

Figure 1: Two processes that get scheduled the same CPU time by CFS but significantly differ in their energy consumption.

qiao.etal.2024.energyawareprocessscheduling (pg. 3)

We demonstrate this discrepancy between CPU and energy consumption with a simple experiment. Figure 1 shows the energy consumption of two processes that are run on Linux with CFS, which allocates each of the processes roughly the same CPU time. The two processes that execute two Python programs. Process 1 is memory-intensive: it repeatedly reads and writes large byte-arrays into heap memory, while process 2 is CPU-intensive: it repeatedly computes SHA256 on long strings (see Β§5 for the full evaluation setup). We measure each process’s energy consumption using Wattmeter. The experiment shows that despite the fact that both processes are scheduled almost identical CPU time, process 2 consumes about 50% more energy than process 1. In general, variability in energy consumption can stem from factors such as the usage of different CPU instructions, memory consumption, and the cache hit rate [17]. Linux today has no awareness of this variability in energy consumption across processes.

Kepler Discussion

Sources / Design decisions for energy splitting Β· sustainable-computing-io/kepler Β· Discussion #548 Β· GitHub

The CPU's dynamic energy consumption is mainly determined by the operations it performs at a given voltage and temperature. The workload can cause the CPU to execute fewer or more instructions in a cycle (or time interval).
β€” Marcelo Carneiro do Amaral

I do fully agree that using CPU-Time is a problematic proxy for splitting the energy, because the value has limited absolute meaning nowadays with features like DVFS and also that waiting time in linux is often mal-attributed due to interconnect congestions.
β€” Arne Tarara