Skip to main content

Extension that shows system power usage

Project description

jupyter-power-usage

Github Actions Status Binder PyPI PyPI GitHub

Screencast for power usage

The objective of this extension is to display power usage of the CPU and/or GPU on which jupyter server is running. Power usage is estimated using Running Average Power Limit (RAPL) metrics that are available on Intel processors manufactured after 2012 (since broadwell). It is available on latest AMD processors as well. For the case of GPUs, currently only nVIDIA GPUs are supported and power usage is gathered from nvidia-smi tool.

Additionally, the extension is capable of estimating equivalent CO2 emissions. Emissions are estimated based on the current power usage and a emission factor that gives equivalent grams of CO2 power consumed. Currently, a real time emission factor is implemented for France and for the rest a constant configurable factor of 475 gCO2.eq/kWh is used.

The metrics are displayed in the top bar of JupyterLab and are updated at a configurable interval. The default interval is 5 seconds. RAPL can enforce power limit so as nVIDIA GPUs. If those power limits are enabled and available, they will be displayed in the indicators.


NOTE

The extension works only on Linux that exposes RAPL metrics. Starting from kernel 5.4, RAPL metrics are accessible only for root. In this case, the user needs to add read permissions on /sys/fs/powercap directory to be able to display power usage indicators in JupyterLab.

If the JupyterLab is running inside a container or VM, ensure that /sys/fs/powercap file system exists. If it does not, extension will not work.

The extension is not available for Notebook < 6. It supports JupyterLab >= 3 and Notebook >= 7.

The extension's architecture closes follows the jupyter-resource-usage extension and all the credit goes to the contributors and maintainers of the above stated extension.


Installation

JupyterLab 3.x

You should install the version <1.0.0 for JupyterLab 3.x compatibility.

pip install 'jupyter-power-usage<1.0.0'

JupyterLab 4.x and Notebook 7.x

You should install the latest version for JupyterLab 4.x and Notebook 7.x compatibility.

pip install jupyter-power-usage

The extension does not support Notebook < 7.

Configuration

Server side config

Measurement Scope

Currently the extension supports different measurement scopes:

  • process: Power usage for current process and its children will be reported
  • user: Power usage for current user processes will be reported
  • system: Power usage for entire system will be reported.

By default process scope is used. The user can change it by CLI flag --PowerUsageDisplay.measurement_scope to jupyter lab command. Alternatively, it can be configured in jupyter_server_config.json in Jupyter config directory.

Frontend extension config

Frontend extension settings

The frontend extension settings can be accessed by Settings -> Advanced Settings -> Power Usage Monitor in JupyterLab. Important settings are:

  • Refresh Rate: Frequency at which power usage is updated in the JupyterLab. Do not use too small intervals as it will end up making too many API calls to update metrics.

  • CPU label and GPU label settings are self explanatory.

Emissions Estimation Settings

  • Country code: Currently only data for France is supported. The realtime emission factor from RTE eCO2 mix. We encourage users to add support for other countries. Please check CONTRIBUTING.md on how to do it. If your country is not available in the list, leave it blank.

  • Refresh rate: This defines how often the emission factor is updated in ms. For RTE eCO2 mix data, it is updated every 30 min and has a rate limit of 50000 API requests per month.

  • Emission factor: This constant emission factor is used in the estimation of emissions when country specific data is unavailable.

Contributing

If you would like to contribute to the project, please read the CONTRIBUTING.md. The CONTRIBUTING.md file explains how to set up a development installation and how to run the test suite.

Uninstall

pip uninstall jupyter_power_usage

This will uninstall python package and all the frontend related assets.

Troubleshooting

  • If power indicators do not show up in the JupyterLab, try reload the browser tab. Sometimes network latencies prevent extension to load in time.

  • If there are any issues with the server side extension, they will be logged to the same log that JupyterLab uses.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jupyter_power_usage-0.2.0.tar.gz (218.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jupyter_power_usage-0.2.0-py3-none-any.whl (57.7 kB view details)

Uploaded Python 3

File details

Details for the file jupyter_power_usage-0.2.0.tar.gz.

File metadata

  • Download URL: jupyter_power_usage-0.2.0.tar.gz
  • Upload date:
  • Size: 218.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for jupyter_power_usage-0.2.0.tar.gz
Algorithm Hash digest
SHA256 298f52c96f79d8bbdf881013e9b678dce0887e2c8e7197e6c74522f874f28224
MD5 4579c566728f73b1bb2c3b646eb74aa8
BLAKE2b-256 f7eb7377cfb164faa82c83f26a74dfa04efc8fe6c6dd4a208e20f8d99ab4b32c

See more details on using hashes here.

File details

Details for the file jupyter_power_usage-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for jupyter_power_usage-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 67a94d9446465df83bde2776d36315f2180a5241a6dc31399c27354260979d2a
MD5 4b003864bfb194d5c46734cc49a5e52a
BLAKE2b-256 5f61e4c527e4a8dbf1527e9a0b0fe1bee3629b1b3cc3e0f16abe313a827220d7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page