Skip to main content

FECoM Tool

Our tool can calculate the energy consumption

  • of an entire Tensorflow script (project-level experiments)
  • of each individual TensorFlow function/method from a given script (method-level experiments)
  • of different configurations of the same function/method (data-size experiments)

Directory Structure

This repository has the following main directories:

  • data: contains all input and output data used in the study and has three subdirectories:
    • code-dataset contains patched and original projects from the third-party source code repository
    • energy-dataset contains all experimental energy data
    • other contains failed experimental data or data used for calculating settings
  • replication: replication package for the FECoM study.
  • fecom: source code for the FECoM tool.

Environment Setup

Energy measurement libraries

First verify that perf, a library to measure CPU and RAM energy consumption, is already available in you Linux system, if not then install separately:

sudo apt install linux-tools-`uname -r`

Also make sure the lm-sensors CPU temperature measurement library is installed:

sudo apt install lm-sensors

This tool also makes use of the NVIDIA System Management Interface or nvidia-smi to measure GPU energy consumption.

Python environment

Install miniconda3. Then open the environment.yml file (provided in this directory) in a text editor and change the paths stored as prefix: and variables: to point at your miniconda installation.

Finally, in this directory, run the following command to create the required TensorFlow environment from the specified environment.yml file:
conda env create -f environment.yml
Activate the environemnt:
conda activate tf2
Check if the GPU is setup correctly by running
python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
This might give some warnings about missing TensorRT libraries, but as long as the output is [PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')] there is a good chance that the GPU has been setup correctly. Despite this, an issue faced was an error message that libdevice is required by this HLO module but was not found. A fix for this is highlighted here.

Install FECoM

In this (top-level) directory, run
pip install .
to install the FECoM tool. If you make any changes, for example to the configuration files, you need to repeat this step such that all changes are loaded.

Configuration

All constants and settings for the measurement script can be found in fecom/measurement/measurement_config.py, and for the patching script in fecom/patching/patching_config.py. These files are the single source of truth for all used constants.

measurement_config.py contains configurations regarding

  • Stable state checking
  • Energy measurements
  • Temperature measurements

patching_config.py contains patching script file paths.

You will need to add your own file paths in patching_config!

Run Energy Consumption Experiments

Start the energy measurement processes by following the instructions below. Detailed instructions on how to run experiments can be found in replication/README.md.

With the activated conda environment, navigate to fecom/measurement and run this command to start perf and nvidia-smi (energy measurement tools) as well as sensors (cpu temperature tool, which is run inside the wrapper cpu_temperature.py):
python3 start_measurement.py

The application can be terminated by pressing Control-C.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Release files for fecom 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fecom 1.0.0
File Size Uploaded
fecom-1.0.0.tar.gz 64.8 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for fecom 1.0.0
File Interpreter ABI Platform
fecom-1.0.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 64.9 MB

Release files / fecom-1.0.0.tar.gz

Download URL fecom-1.0.0.tar.gz
Size 64.8 MB
Tags Source
SHA-256 checksum
How to use checksums
76f8006fad95a31f726305611dd8b6f3f6d19464bf9a3e4b25d5e999d71a7b25
BLAKE2b-256 checksum
How to use checksums
958a0f19db41caafc30fb76ed25790856dc49e9224cd6281bc61472671a0e606
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.28.2

Release files / fecom-1.0.0-py2.py3-none-any.whl

Download URL fecom-1.0.0-py2.py3-none-any.whl
Size 51.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
d7901bac8eb826f8b01c7731ab884bbe1d7bed8d920aed8936a44a453f1443c7
BLAKE2b-256 checksum
How to use checksums
b69ab4951dd3de3b6506be262fca01a023a49047679b0f1b338945317039aadf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.28.2

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page