Energy Measurements
The get_energy
command
The get_energy command is a powerful command-line utility based on MERIC designed for Deucalion that allows users to track and measure the energy consumption and associated CO2 emissions of SLURM jobs. This tool provides valuable insights for researchers and system administrators who need to monitor the environmental impact of computational tasks, supporting both individual job analysis and aggregate reporting across multiple jobs. The command returns data in JSON format and offers extensive filtering capabilities based on job ID, username, account, and submission timeframes.
To know all the options associated with get_energy
, you can simply run: get_energy -h
Getting my energy consumption
To know the total energy you used at Deucalion, you can use the -u
option with --all
: get_energy -u $USER --all
. You can only calculate the energy from jobs that you submitted or from slurm accounts (what you put in the -A
option of srun
or sbatch
) that you belong to.
An example of an output of get_energy -u $USER --all
would be:
{"type": "JOB", "data": {"#Jobs": 1501, "submit_time_first": 1726151979, "submit_time_last": 1741867277, "budgeting_levels": {"CPU[J]": 2447361460.1497436, "CPU[kWh]": 679.822627819372, "GPU[J]": 15842952.446912188, "GPU[kWh]": 4.400820124142275, "Node[J]": 2833260650.6834755, "Node[kWh]": 787.0168474120767, "Overall[J]": 4249890976.025213, "Overall[kWh]": 1180.5252711181163, "CO2 emissions[g]": 0}}}
This example gives us the total energy spent at CPU, GPU and overall (which includes CPU, GPU and other things such as cooling, RAM, etc.). In this case, this user used 679.82 kWh (CPU), 4.40 kWh (GPU), with a total of 1180 kWh.
Getting my project's energy consumption
To know the total energy used by a project in which you are a member you can run: get_energy -a <account>
, where <account>
should be substituted by the account name (ending with a
,x
, and g
for ARM, x86 and GPU allocations respectively).
Getting a job's energy consumption
To know the energy used during a job you must use the job number and run: get_energy -j <job_number>
.
Filtering jobs with time
To only filter jobs that were submitted in a given time range, you can use the -s1 SUBMIT_TIME_START -s2 SUBMIT_TIME_END
options, where SUBMIT_TIME_START
and SUBMIT_TIME_END
must be given in SLURM time (unix timestamp), which are both integer values. To calculate this you can use this online calculator.
List option
For all the commands given, there is the option of showing every job separately, instead of summing the contributions of all jobs. This is done by using --format list
. Depending on the amount of jobs and nodes used per job, the output can be quite big. This would be one of the elements of the JSON file:
{"job_id": 251765, "user_name": "malaca", "account": "macc", "submit_time": 1736862668, "start_time": 1736862668, "end_time": 1736862677, "used_walltime": 9, "nodes": ["cna0005"], "budgeting_levels": {"CPU": {"energy[J]": 1022.1587399999999, "energy[kWh]": 0.0002839329833333333, "error": ""}, "GPU": {"energy[J]": 0.0, "energy[kWh]": 0.0, "error": ""}, "Node": {"energy[J]": 1142.0980990666076, "energy[kWh]": 0.00031724947196294656, "error": ""}, "Overall": {"energy[J]": 1713.1471485999114, "energy[kWh]": 0.0004758742079444198, "error": ""}}},
This tells information on CPU, GPU, Node (everything that is inside the board) and Overall (sum of everything inside or outside the board, such as cooling).