Skip to content

Commit f4f5387

Browse files
authored
Merge pull request #1167 from KReyes-py/docs/improve-tracking-mode-484
docs: clarify machine vs process tracking modes (#484)
2 parents 7e2676a + b41ab93 commit f4f5387

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

docs/explanation/methodology.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,20 @@ emissions tracker.
8787

8888
Currently, the package supports the following hardware infrastructure.
8989

90+
### Tracking Modes
91+
92+
CodeCarbon operates in two distinct modes to determine how power consumption is attributed to your work. Choosing the right mode is essential for data accuracy.
93+
94+
The `tracking_mode` parameter (values: `"machine"` or `"process"`, default `"machine"`) controls the **scope** of power attribution:
95+
96+
**Machine Mode** (`tracking_mode="machine"`): Measures the total energy consumed by the whole hardware stack (all CPUs, GPUs, and RAM). This is the most straightforward measurement and is ideal for dedicated machines where the tracked workload dominates resource usage.
97+
98+
**Process Mode** (`tracking_mode="process"`): Estimates the energy attributable to your Python process (and its child processes) by sampling their CPU time relative to total CPU capacity. This is a software-based approximation — it does **not** read hardware counters directly — and is preferable on shared environments where other workloads are running in parallel.
99+
100+
> ⚠️ **GPU limitation**: Process Mode only affects CPU and RAM attribution. GPU power is always measured at the device level, so if you share a GPU with other users or processes, CodeCarbon will still account for the **entire GPU's** power consumption, not just your share.
101+
102+
Note: The underlying measurement method (Intel RAPL, Intel Power Gadget, TDP-based CPU-load estimation…) is chosen automatically based on hardware availability and software permissions. It applies independently of the tracking mode.
103+
90104
### GPU
91105

92106
Tracks Nvidia GPUs energy consumption using `nvidia-ml-py` library

0 commit comments

Comments
 (0)