I have been working on an extension that is capable to reporting CPU and/or GPU power usage along with eCO2 emissions for our JupyterHub deployment. I finally managed to publish on PyPI and you can find it as jupyter-power-usage. It closely follows the same pattern as jupyter-resource-usage.
Under the hood we use RAPL metrics to estimate CPU power. Currently, only nVIDIA GPUs are supported and nvidia-smi tool is used to get GPU power consumption.
The current power consumption is combined with an emission factor to estimate eCO2 emissions. The extension is capable of using a “real-time” emission factor from RTE eCO2 mix for France. For the rest of the countries a configurable constant emission factor is used.
Currently, the extension supports:
JupyterLab 3 and 4
Only Notebook >= 7
Extension works best on bare-metal as we are a HPC center. When using within a containerized environments, user needs to ensure that /sys/fs/powercap is mounted in the container. However, the metrics reported will be more closer to system wide usage rather than container usage.
Yes, we should be able to get per container energy consumption and emission metrics. But, this is possible only if we can bind mount host’s /proc and /sys/fs/powercap file systems into container. The package does not support it yet, but we can add it.
Actually, I have been looking to configure container runtime like configuring bind mounts for mybinder.org but could not find any info. I guess repo2docker supports bind mounts, so, does binder supports it too?
mybinder is a public shared unauthenticated service so allowing anonymous users to override the spawner configuration is a massive security risk, and I’m not sure if it’s safe for an admin to mount parts of /sys into an untrusted container read-only.
I’m also not sure how accurate this would be on a virtual shared server with a lot of resource contention like mybinder- what might make more sense is to make these power usage statistics available in aggregate for the entire deployment, e.g. via Grafana?
That is what I thought and I totally agree with that. I was just looking to test the extension on a Kubernetes deployment. I dont have access to any Kubernetes clusters and I thought I would test my luck with mybinder.
Yes, I agree that it is not relevant in virtual machines as RAPL metrics are not available in VMs.