Energy Optimization Governor for HPC systems.
Reads power, price, and CO₂ intensity data, then sets the min and max frequency based on a calculated rating.
All the functionality and code logic located in src/hpc_eff stem from https://gitlab.cesnet.cz/dexter/hpc_eff.
hpc_eff is designed to be run periodically (e.g., via cron every few minutes) under root.
It evaluates current energy conditions, prints debug logs if enabled, and sets the min and max CPU frequencies accordingly.
Main steps performed:
- Load configuration from
/etc/hpc_eff/config.ini - Fetch current electricity price
- Read current power usage via a configured shell command
- Read current CPU frequency
- Retrieve available CPU frequencies and governors
- Fetch historical energy price averages and classify current price
- Fetch last 24h CO₂ values and calculate rating
- Apply min and max CPU frequencies based on rating
The application maintains two types of logs:
- SQLite Database: Detailed historical logs stored at
/var/lib/hpc_eff/history.db. - JSON State File: A consolidated state file at
/var/lib/hpc_eff/state.jsoncontaining:static: System metadata (score, power command, active plugins).current: Latest evaluation results (rating, price, power, temp, etc.).history: A rolling history of previous evaluations.
These can be configured in /etc/hpc_eff/config.ini:
[logging]
db_path = /var/lib/hpc_eff/history.db
state_json_path = /var/lib/hpc_eff/state.json
history_length = 10- Clone the repository:
git clone git@github.com:CESNET/hpc_eff.git cd hpc_eff - Install the dependencies:
sudo dnf install ipmitool cpufrequtils make kernel-tools rpm-build rpmdevtools -y
- Build and install:
make
- Configure with your API key from nowtricity:
sudo vi /etc/hpc_eff/config.ini
- To read from the created database:
Inspect tables and data:
sudo cp /var/lib/hpc_eff/history.db ~/history.db sqlite3 ~/history.db
.tables .schema cpu_settings_log SELECT * FROM cpu_settings_log LIMIT 10; - You can enable or disable a system cronjob using command-line switches.
By default, the cronjob runs every 10 minutes and is installed at /etc/cron.d/hpc-eff. You can customize the path and interval:
hpc-eff --enable hpc-eff --disable
hpc-eff --enable --cron-path /custom/path --cron-interval 5