Skip to content

Power estimation tool for understanding the energy costs incurred by visual processing tools that run on x86/x64 CPUs. The development is supported by HEU project, EMERALD

License

Notifications You must be signed in to change notification settings

RCSL-TCD/cpu_power_profiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CPU Power Consumption Profiler for visual processing algorithms

🖥️ CPU Profiler API

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® VTune™ Profiler must be pre-installed.
● You can download it from: https://www.intel.com/content/www/us/en/developer/tools/oneapi/vtune-profiler-download.html
● Currently tested on Intel’s commercial CPUs, but the model could be adapted to any modern Intel processor-based system.
● Python version 3.x

💾 Installation Instructions

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 . 

🐧 Linux Users

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 "

📦 File Structure

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

🛠️ CLI Options

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 all
to 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>

About

Power estimation tool for understanding the energy costs incurred by visual processing tools that run on x86/x64 CPUs. The development is supported by HEU project, EMERALD

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages