This CLI interface can be invoked from bash to invoke the application whose energy is to be estimated. For developing this tool, we have used Intel’s V-Tune Profiler to extract the performance metrics and instruction-level statistics of the task being profiled. The extracted data from the profiler is processed into a required format and subsequently fed as input features for a pre-trained estimator, which then estimates the power consumption based on these low-level CPU metrics.
Key requirements and notes about the tool are as below:
● Supported OS: Windows, Linux
● Intel® oneAPI toolkit must be pre-installed.
● You can download it from: https://www.intel.com/content/www/us/en/developer/tools/oneapi/vtune-profiler-download.html
● Intel® VTune™ Profiler is the part of Intel® oneAPI toolkit.
● Currently tested on Intel’s commercial CPUs, but the model could be adapted to any modern Intel processor-based system.
● Python version 3.x
The profiling tool is openly made available via the GitHub repository, from which users can download and install the tool using standard git clone and pip install commands. It is expected that the user has installed Intel VTune Profiler from the link given above.
Creating a virtual environment is highly recommended to prevent dependency conflicts between existing projects and tools, and to safely test the profiling tool.
```power shell git clone git@github.com:RCSL-TCD/cpu_power_profiler.git cd cpu_power_profiler pip install .
For linux, you might need to do few kernel tweaks to enable perf profiling, this
includes initialising vtunes CLI to the path via setvars.sh. The default path
when isntalled via apt is at /opt/intel/oneapi/setvars.sh.
source /opt/intel/oneapi/setvars.sh
For the enabling the perf, you have to adjust some kernel settings, to temporory do them, please do the following, you can do it via systemwide
sudo sh -c "echo 0 > /proc/sys/kernel/kptr_restrict"
sudo sh -c "echo 0 > /proc/sys/kernel/perf_event_paranoid "● Nuke — the VFX and film editing software from Foundry — versions 15 and 16 are supported only on Rocky 9 (64-bit), Windows 11 (64-bit), and macOS(Not supported by Intel® VTune™ Profiler, and therefore also not supported by the CPU Profiler tool).
● For Rocky 9 users, the Intel® oneAPI toolkit 2024 release is recommended, as the 2025 version has reported bugs that affect certain analyses—such as hotspot and microarchitecture analysis—on some CPUs, including the Intel(R) Core(TM) i9-10900KF.
● You can download it from: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/20f4e6a1-6b0b-4752-b8c1-e5eacba10e01/l_BaseKit_p_2024.0.0.49564_offline.sh
● For deeper hardware events (hotspot and Micro architecture analysis), you may need to install VTune sampling drivers as below:
cd /opt/intel/oneapi/vtune/2024.0/sepdk/src
./build-driver
./insmod-sep -rVerify it’s running
lsmod | grep sep
Upgrade default python version
sudo dnf module reset python36 sudo dnf module enable python39
sudo dnf install python39 python39-devel python39-pip gcc gcc-c++ make pkgconfig
Upgrade pip
python -m pip install --upgrade pip
While browsing folders through Nuke, Home directories are not visible when Nuke is launched as root.
cd /home/USER_NAME export HOME=/home/USER_NAME export USER=USER_NAME export LOGNAME=USER_NAME
The resulting file structure should be as shown below.
cpu_power_profiler/
├── predictor/ # Package containing logic and model files
│ ├── __init__.py
│ ├── l2_extractor.py
│ ├── predict_power.py
│ ├── convert_save_command.py
│ ├── cpu_power_model_min.joblib
│ ├── cpu_power_model_avg.joblib
│ └── cpu_power_model_peak.joblib
├── cpu_profiler.py # CLI tool entry point
├── setup.py # Package installer script
└── MANIFEST.in # Includes .joblib files in the package
| Option | Description |
|---|---|
-m |
Specifies which power value to estimate. By default, it estimates the average power consumption of the profiled task. You can specify: • -m min• -m avg• -m peak• -m allto estimate the minimum, peak, and average power values. |
-a |
Specifies the application/task’s executable that needs to be profiled. Provide the full path to the application. Example: python cpu_profiler -a C:\Nuke\Nuke15.0v4\Nuke.exe |
-c |
Points to a previously generated VTune .csv file for power estimation. Full path to the extracted data should be provided. When this is used, the -a switch is ignored.Example: python cpu_profiler -c /usr/local/Vtune_profiled.csv |
-s |
Passes argument to the tool under investigation. For e.g., to load Nuke script to be profiled, -s can be used to point to the location of .nk . Example: cpu_profiler -m all -a "c:\Program Files\Nuke15.0v4\Nuke15.0.exe" -s "D:/nuke_graphs/blur_image.nk" |
The tool allows Three modes for testing
(a) Fully Automated mode
(b)Semi-manual mode
(c) Manual Mode
(a) Fully Automated Mode
In the simplest form, both steps are fully automated and handled by the API. The application/task to be profiled is specified using the -a configuration, and the -m switch specifies the estimator(s) that would be invoked post the profiling phase. With Nuke, the below examples open the application in profiling mode (through Vtune), and the specific task graph is loaded manually; however, this can also be automated using command line switches offered by Nuke.
Examples:
cpu_profiler -m min -a "C:\Program Files\Nuke15.0v4\Nuke15.0.exe"
cpu_profiler -m avg -a "C:\Program Files\Nuke15.0v4\Nuke15.0.exe"
cpu_profiler -m peak -a "C:\Program Files\Nuke15.0v4\Nuke15.0.exe"
cpu_profiler -m all -a "C:\Program Files\Nuke15.0v4\Nuke15.0.exe"
cpu_profiler -m all -a "C:\Program Files\Nuke15.0v4\Nuke15.0.exe" -s "D:/nuke_graphs/blur_image.nk"
Note that the above cases use Windows as the host OS.
(b) Semi-manual/manual Mode
This option can be exercised if the profiling of the tool has already been completed using VTune and the performance counter values are available in a CSV format. In this case, the -a switch should not be used, and the -c switch can be used to point to the .csv file for energy estimation. If the .csv file is available in the local directory, then the -c switch can also be ignored, as shown in the first example.
Examples
cpu_profiler -m min
cpu_profiler -m avg
cpu_profiler -m peak
cpu_profiler -m all -c <path\to\.csv\file.csv>