Skip to content

Overall Energy Measurement

Measurement on Brubeck

The power measurements are performed on the Brubeck node, identified by the brub partition.

To run a measurement, simply run the command:

board boardX measure

By replacing X by the number of the measurement platform, which are the following, according to the table here:

Board Name Board no
Jetson AGX Xavier 1
Jetson Xavier Nano 2
VIM1S 3
Banana Pi F3 4
Odroid-XU4 5
Raspberry Pi 4 Model B 6
Orange Pi 5 Plus 7
Jetson AGX Orin 8
Jetson Orin Nano 9

Warning

We noticed that the calibration of boards 2, 3, 5, 6, 7, 8 & 9 might be wrong (around 20% of error). A new calibration will be achieved early in September 2024. Boards 1 & 4 have been calibrated recently (07/2024).

Info

Note that some of the SBCs are not powered by a measurement platforms. Thus, it is not possible to measure the overall energy/power on these SBCs.

Output file of the command board boardX measure is structure as followed:

cal_data: cal_data 3489 0.4980 3637 1.0000 3946 2.0030 3905 4.7130 3374 5.0110 3584 12.011 3409 20.024
cr 3489 ca 0.498000
cr 3637 ca 1.000000
cr 3946 ca 2.003000
cr 3905 ca 4.713000
vr 3374 vv 5.011000
vr 3584 vv 12.011000
vr 3409 vv 20.024000
cal_data selected: 3905.000000 4.713000, 3409.000000 20.024000
  0 0.795356 18.927303 15.053953
  0 0.847254 18.932138 16.040325
  0 0.806219 18.932959 15.264104
  0 0.805012 18.932983 15.241274
  0 0.899151 18.931101 17.021919
  0 1.097085 18.921268 20.758240
  0 0.931738 18.924576 17.632742
  0 1.019842 18.922813 19.298286
  0 0.825529 18.938446 15.634242
...

The measures are on the lines starting with two spaces and a bit (here set to 0) which can be used to profile an application during its evaluation. First float value is intensity (A), second value is voltage (V) and third one is instantaneous power (W).

Use GPIOs to identify specific part in a benchmark

Measuring a specific part in a benchmark (e.g. a function) can be achieve using GPIO pins connected between the compute node and the measurement board. At least one pin should be connected on each board, with a maximum of 8 GPIOs allowing 256 values, and are located in the /sog/gpio/ directory.

To identify a specific part you have to write 1 in the corresponding pin file at the beginning and 0 at the end.

In the example given below, a benchmark executes three functions and the consumption is measured for the complete run. Thanks to the GPIO it is possible to identifiy the consumption of a small part of it.

void do_stuff();
void my_specific_stuff();
void my_benchmark(int gpio_fd)
{
    do_stuff();
    size_t r = write(gpio1_fd, "1", 1);
    my_specific_stuff();
    r        = write(gpio1_fd, "0", 1);
    do_stuff();
}

int main(int argc, char** argv)
{
    int gpio1_fd = open("/sog/gpio/pin1","w");
    my_benchmark(gpio1_fd);
    close(gpio1);
    return 0;
}

Measure energy for a given slurm job (beta)

In order to measure power/energy consumption of a given job, the following script may be used:

#!/bin/bash

if [ $# != 3 ]
then
    echo "Usage: $0 PART BOARD JOB"
    exit 0
fi

# Change the value of BOARD with the board you want to evaluate
export PART=$1
export BOARD=$2
echo "Starting measurements on board: $BOARD"
meas=$(sbatch /nfs/scripts/meas.sh --export=BOARD)
echo "$meas"

# Start your main batch job
export JOB=$3
echo "Starting script: $JOB"
job1=$(sbatch -p $BOARD --dependency=after:${meas##* } $JOB)
echo "$job1"

# Stop the measure
export JOBID=${meas##* }
cc=$(sbatch -p $BOARD --dependency=afterany:${job1##* } /nfs/scripts/scancel.sh --export=JOBID)

It uses 2 auxilliary scripts stored in /nfs/scripts in order to start the mesure and stop it.

The script works as it follows:

  • A first slurm job is created on brubeck to start the measure (using the script /nfs/scripts/meas.sh)
  • A second job is created with your script to bench. This job starts only after the measure job starts
  • A third job is created to stop the measures job (using the script /nfs/scripts/scancel.sh). This job starts only when the bench job is finished (either with an error or exited normally) and sends a SIGINT to the measure script.

Warning

If you misconfigured this script, the measure job may stay on background for an unlimited amount of time.

Please check regularly with squeue that you have no undesirable jobs running. If so, you can cancel them with the command scancel [job id].

To use this script, simply copy-paste it and change the board number and the name of the batch job you want to evaluate.

Warning

The script /nfs/scripts/meas.sh calls a python program that reads the output of the board command and compute statistics on-the-fly on it in order to avoid the generation of heavy output files.

If you need the exact output of the board command, a special attention should be paid to stop the measures script, and you are advised to run it with the option --timeout of sbatch.

Info

To allow a better profiling of the evaluated job, one can use GPIOs to modify the first bit in each measure line.

Otherwise, keep in mind that a slight delay may occur between the beginning of the measurement and the application's start and between its end and the end of the measurement