hbyido / AIPowerMeter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Measure the efficiency of your deep learning

Record the energy consumption of your cpu and gpu. Check our documentation for usage.

This repo is largely inspired from this experiment Tracker

Requirements

Running Average Power Limit (RAPL) and its linux interface : powercap

RAPL is introduced in the Intel processors starting with the Sandy bridge architecture in 2011.

Your linux os supports RAPL if the following folder is not empty:

/sys/class/powercap/intel-rapl/

Empty folder? If your cpu is very recent, it is worth to check the most recent linux kernels.

Installation

Install pytorch, then,

pip install -r requirements.txt
python setup.py install

You need to authorize the reading of the rapl related files:

sudo chmod -R 755 /sys/class/powercap/intel-rapl/

Usage

See examples/example_exp_deep_learning.py.

Essentially, you instantiate an experiment and place the code you want to measure between a start and stop signal.

from deep_learning_power_measure.power_measure import experiment, parsers

driver = parsers.JsonParser("output_folder")
exp = experiment.Experiment(driver)

p, q = exp.measure_yourself(period=2)
###################
#  place here the code that you want to profile
################
q.put(experiment.STOP_MESSAGE)

This will save the recordings as json file in the output_folder. You can display them with:

from deep_learning_power_measure.power_measure import experiment, parsers
driver = parsers.JsonParser(output_folder)
exp_result = experiment.ExpResults(driver)
exp_result.print()

model card

We use a wrapper for torchinfo to extract statistics about your model. To obtain them, add additional parameters:

net = ... the model you are using for your experiment 
input_size = ... (batch_size, *data_point_shape)
exp = experiment.Experiment(driver, model=net, input_size=input_size)

About


Languages

Language:Jupyter Notebook 65.2%Language:HTML 13.4%Language:Python 11.6%Language:JavaScript 5.4%Language:CSS 4.4%Language:Shell 0.0%