Skip to content

Commit eb602a7

Browse files
committed
Add CPU fallback mechanism based on TDP
1 parent e24137a commit eb602a7

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656

5757
build-n-publish:
5858
needs: [test, lint]
59-
runs-on: ubuntu-20.04
59+
runs-on: ubuntu-22.04
6060
steps:
6161
- uses: actions/checkout@v3
6262
- name: Set up Python 3.10

docs/index.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,14 @@ If this fails we measure all available GPUs.
5454
```
5555
echo "your_username ALL=(ALL) NOPASSWD: /usr/bin/powermetrics" | sudo tee -a /etc/sudoers
5656
```
57-
- Alternatively, one can run **carbontracker** with root privileges.
57+
- Alternatively, one can run **carbontracker** with root privileges.
58+
59+
## Running **carbontracker** in Virtual Machines
60+
61+
In virtual machines or containerized environments where direct power measurements are unavailable, **carbontracker** estimates power consumption using [CPU TDP values](https://github.com/mlco2/codecarbon/blob/master/codecarbon/data/hardware/cpu_power.csv):
62+
63+
- Identifies the CPU model when possible
64+
- Uses 50% of the CPU's TDP value to estimate power consumption at 50% utilization
65+
- Falls back to 50% of average TDP across known CPUs if the specific model isn't found
66+
67+
While less precise than direct measurements, this provides reasonable power consumption estimates in virtualized environments.

0 commit comments

Comments
 (0)