- Intel CPU
- Linux OS (Tested on Ubuntu) with superuser (i.e.,
sudo
) permissions - NVIDIA GPU (Not used in the session)
- TensorFlow (tested on version 2.9.0)
- CarbonTracker
- Git
Most energy measurement software rely on Intel’s RAPL interface to obtain CPU
and energy data. In Linux, one way to access the RAPL interface is via the
powercap
framework
(https://www.kernel.org/doc/html/latest/power/powercap/powercap.html). For
the hands-on session, you must the able to access RAPL by the following command
sudo cat /sys/class/powercap/intel-rapl/intel-rapl:0/energy_uj
The sudo
became necessary as a patch to avoid a security vulnerability with
the RAPL interface
(https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/advisory-guidance/running-average-power-limit-energy-reporting.html)
To avoid additional requirements, the session does not cover monitoring the GPU energy consumption. The way we monitor the energy consumption with CodeCarbon is the same for CPU and GPU. If you want to use GPUs CodeCarbon only supports NVIDIA GPUs, and you should be able to run Tensorflow with GPU support (https://www.tensorflow.org/install/pip)
This part assumes that you are used to using a terminal. Open a terminal, then run the following commands
mkdir idessai-2022-ai-energy-consumption
cd idessai-2022-ai-energy-consumption
git clone https://github.com/danilo-carastan-santos/ai-energy-consumption.git
cd ai-energy-consumption
python3 -m venv venv/
source venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
sudo venv/bin/python session.py --sect 1b
- Once inside the virtual environment, you can run the
deactivate
command to
disconnect from the virtual environment.
- There are four sections
(1a, 1b, 1c, 2a)
, each of which presents new concepts and propose questions(Q1, Q2, Q3, Q4, Q5, Q6)
. These questions will be explored during the hands-on session. You can run a different section by using the--sect
argument in the command at step 5. - The questions can be seen at the
session.py
as comments. Inside a terminal you can use thenano
editor (i.e., commandnano session.py
) to navigate and edit the source code.