@@ -42,6 +42,7 @@ class CO2Monitor(pydantic.BaseModel):
42
42
"""
43
43
44
44
thermal_design_power_per_cpu : pydantic .PositiveFloat | None
45
+ n_cores_per_cpu : pydantic .PositiveInt | None
45
46
thermal_design_power_per_gpu : pydantic .PositiveFloat | None
46
47
local_data_directory : pydantic .DirectoryPath
47
48
intensity_refresh_interval : int | None | str
@@ -87,6 +88,8 @@ def __init__(self, *args, **kwargs) -> None:
87
88
----------
88
89
thermal_design_power_per_cpu: float | None
89
90
the TDP value for each CPU, default is 80W.
91
+ n_cores_per_cpu: int | None
92
+ the number of cores in each CPU, default is 4.
90
93
thermal_design_power_per_gpu: float | None
91
94
the TDP value for each GPU, default is 130W.
92
95
local_data_directory: pydantic.DirectoryPath
@@ -111,6 +114,12 @@ def __init__(self, *args, **kwargs) -> None:
111
114
"⚠️ No TDP value provided for current CPU, will use arbitrary value of 80W."
112
115
)
113
116
117
+ if not isinstance (kwargs .get ("n_cores_per_cpu" ), float ):
118
+ kwargs ["n_cores_per_cpu" ] = 4
119
+ _logger .warning (
120
+ "⚠️ No core count provided for current CPU, will use arbitrary value of 4."
121
+ )
122
+
114
123
if not isinstance (kwargs .get ("thermal_design_power_per_gpu" ), float ):
115
124
kwargs ["thermal_design_power_per_gpu" ] = 130.0
116
125
_logger .warning (
@@ -244,9 +253,9 @@ def estimate_co2_emissions(
244
253
_process .gpu_percentage = gpu_percent
245
254
_process .cpu_percentage = cpu_percent
246
255
_previous_energy : float = _process .total_energy
247
- _process .power_usage = (
248
- _process . cpu_percentage / 100.0
249
- ) * self . thermal_design_power_per_cpu
256
+ _process .power_usage = (_process . cpu_percentage / 100.0 ) * (
257
+ self . thermal_design_power_per_cpu / self . n_cores_per_cpu
258
+ )
250
259
251
260
if _process .gpu_percentage and self .thermal_design_power_per_gpu :
252
261
_process .power_usage += (
0 commit comments