EnergyAware
is R package that allows you to estimate the CPU's energy use of R tasks. The aim of applying EnergyAware
is that users become more aware of how much energy (sophisticated) computations in R require, in particular those running on external servers (e.g., supercomputers).
The latest version of EnergyAware
can be installed from source using devtools
:
devtools::install_github("timonelmer/EnergyAware")
EnergyAware
is a very simple package that computes the energy consumption of a particular R task based on the CPU's power consumption (i.e., Thermal Design Power; TDP) over its active timeperiod. For this, you need to let R know what CPU model you are running the R task on or how much TDP your CPU model uses. This can be achieved in two ways:
cpu.info <- setup_cpu()
If the automatic setup does not work, you can either
- manually enter the CPU model and let
EnergyAware
search in its database for a match
cpu.info <- setup_cpu(cpu.model = "Intel(R) Core(TM) i7-4870HQ")
- manually enter the CPU's thermal design power (TDP) and number of cores. For most CPU models, this information can be found here.
cpu.info <- setup_cpu(tdp = 47, n.cores = 4)
# setup
cpu.info <- setup_cpu()
# time recording
start.time <- proc.time()
# R task
profvis::pause(6000) # uses one CPU to 100% for 100 minutes
# evaluation
energy_evaluate(cpu.info, start.time, cores = 1)