Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove 0.491 constant value from CPU die size #279

Merged
merged 5 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions boaviztapi/data/factors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,15 @@
"cpu": {
"gwp": {
"die_impact": 0.0197,
"impact": 9.14,
"constant_core_impact": 49.1
"impact": 9.14
},
"pe": {
"die_impact": 0.2650,
"impact": 156.00,
"constant_core_impact": 49.1
"impact": 156.00
},
"adp": {
"die_impact": 5.80e-09,
"impact": 2.04e-02,
"constant_core_impact": 49.1
"impact": 2.04e-02
}
}

Expand Down
11 changes: 3 additions & 8 deletions boaviztapi/service/impacts_computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,6 @@ def cpu_impact_use(impact_type: str, duration: int, cpu: ComponentCPU) -> Comput


def cpu_impact_embedded(impact_type: str, duration: int, cpu: ComponentCPU) -> ComputedImpacts:
core_impact = Impact(
value=get_impact_factor(item='cpu', impact_type=impact_type)['constant_core_impact'],
min=get_impact_factor(item='cpu', impact_type=impact_type)['constant_core_impact'],
max=get_impact_factor(item='cpu', impact_type=impact_type)['constant_core_impact']
)
cpu_die_impact = Impact(
value=get_impact_factor(item='cpu', impact_type=impact_type)['die_impact'],
min=get_impact_factor(item='cpu', impact_type=impact_type)['die_impact'],
Expand All @@ -130,9 +125,9 @@ def cpu_impact_embedded(impact_type: str, duration: int, cpu: ComponentCPU) -> C
)

impact = Impact(
value=(cpu.die_size.value + core_impact.value) * cpu_die_impact.value + cpu_impact.value,
min=(cpu.die_size.min + core_impact.min) * cpu_die_impact.min + cpu_impact.min,
max=(cpu.die_size.max + core_impact.max) * cpu_die_impact.max + cpu_impact.max)
value=cpu.die_size.value * cpu_die_impact.value + cpu_impact.value,
min=cpu.die_size.min * cpu_die_impact.min + cpu_impact.min,
max=cpu.die_size.max * cpu_die_impact.max + cpu_impact.max)

impact.allocate(duration, cpu.usage.hours_life_time)

Expand Down
4 changes: 2 additions & 2 deletions docs/docs/Explanations/components/cpu.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ If CPU ```name``` is given, ```model_range```, ```tdp```, ```die_size``` and ```

if ```die_size_per_core``` and ```core_units``` are given :

$$ \text{die_size} = {\text{core_units}}*{\text{die_size}}$$
$$ \text{die_size} = {\text{core_units}}*{\text{die_size_per_core}}$$

Otherwise, if ```family``` is given, ```die_size``` can be retrieved from a fuzzy matching on our cpu repository.

Expand Down Expand Up @@ -73,7 +73,7 @@ If several cpu matches the given ```family```, we use the ```core_units``` attri
For one CPU the embedded impact is:

$$
\text{CPU}_\text{embedded}^\text{criteria} = (\text{CPU}_{\text{core_units}} * \text{CPU}_{\text{die_size_per_core}} + 0.491 ) * \text{CPU}_\text{embedded_die}^\text{criteria} + \text{CPU}_\text{embedded_base}^\text{criteria}
\text{CPU}_\text{embedded}^\text{criteria} = (\text{CPU}_{\text{die_size}}) * \text{CPU}_\text{embedded_die}^\text{criteria} + \text{CPU}_\text{embedded_base}^\text{criteria}
$$

with:
Expand Down
58 changes: 29 additions & 29 deletions tests/api/test_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ async def test_empty_usage():
ImpactOutput(0.000581, 2.165e-05, 0.00012),
),
GWPImpact(
ImpactOutput(636.6, 258.9, 450.0, END_OF_LIFE_WARNING),
ImpactOutput(635.6, 258.0, 450.0, END_OF_LIFE_WARNING),
ImpactOutput(1969.0, 37.73, 700.0),
),
PEImpact(
ImpactOutput(8846.0, 3542.0, 6300.0, END_OF_LIFE_WARNING),
ImpactOutput(8833.0, 3529.0, 6300.0, END_OF_LIFE_WARNING),
ImpactOutput(1024000.0, 21.33, 20000.0, UNCERTAINTY_WARNING),
),
)
Expand All @@ -78,11 +78,11 @@ async def test_empty_usage_m6gxlarge():
ImpactOutput(0.0001721, 6.415e-06, 3e-05),
),
GWPImpact(
ImpactOutput(89.23, 31.58, 55.0, END_OF_LIFE_WARNING),
ImpactOutput(89.17, 31.52, 55.0, END_OF_LIFE_WARNING),
ImpactOutput(583.2, 11.18, 200.0),
),
PEImpact(
ImpactOutput(1168.0, 416.4, 730.0, END_OF_LIFE_WARNING),
ImpactOutput(1167.0, 415.6, 730.0, END_OF_LIFE_WARNING),
ImpactOutput(303400.0, 6.318, 10000.0),
),
)
Expand All @@ -99,11 +99,11 @@ async def test_empty_usage_with_url_params_a1():
ImpactOutput(0.0002905, 1.083e-05, 6e-05),
),
GWPImpact(
ImpactOutput(318.3, 129.5, 230.0, END_OF_LIFE_WARNING),
ImpactOutput(317.8, 129.0, 230.0, END_OF_LIFE_WARNING),
ImpactOutput(984.3, 18.87, 350.0),
),
PEImpact(
ImpactOutput(4423.0, 1771.0, 3200.0, END_OF_LIFE_WARNING),
ImpactOutput(4416.0, 1764.0, 3200.0, END_OF_LIFE_WARNING),
ImpactOutput(512000.0, 10.66, 10000.0),
),
)
Expand All @@ -120,11 +120,11 @@ async def test_empty_usage_with_url_params_r5ad():
ImpactOutput(0.003295, 0.0001228, 0.0007),
),
GWPImpact(
ImpactOutput(1694.0, 593.4, 1000.0, END_OF_LIFE_WARNING),
ImpactOutput(1693.0, 592.6, 1000.0, END_OF_LIFE_WARNING),
ImpactOutput(11170.0, 214.0, 4000.0),
),
PEImpact(
ImpactOutput(21480.0, 7606.0, 13000.0, END_OF_LIFE_WARNING),
ImpactOutput(21470.0, 7596.0, 13000.0, END_OF_LIFE_WARNING),
ImpactOutput(5808000.0, 121.0, 100000.0),
),
)
Expand Down Expand Up @@ -167,15 +167,15 @@ async def test_usage_with_complex_time_workload():
},
),
ADPImpact(
ImpactOutput(0.1744, 0.08627, 0.124, END_OF_LIFE_WARNING),
ImpactOutput(0.1744, 0.08626, 0.124, END_OF_LIFE_WARNING),
ImpactOutput(0.002975, 0.0001109, 0.0006),
),
GWPImpact(
ImpactOutput(1216.0, 459.3, 780.0, END_OF_LIFE_WARNING),
ImpactOutput(1215.0, 458.4, 780.0, END_OF_LIFE_WARNING),
ImpactOutput(10080.0, 193.2, 3500.0),
),
PEImpact(
ImpactOutput(16090.0, 6121.0, 10500.0, END_OF_LIFE_WARNING),
ImpactOutput(16070.0, 6108.0, 10500.0, END_OF_LIFE_WARNING),
ImpactOutput(5244000.0, 109.2, 100000.0),
),
)
Expand All @@ -192,15 +192,15 @@ async def test_usage_with_simple_time_workload():
usage={"time_workload": 100},
),
ADPImpact(
ImpactOutput(0.1744, 0.08627, 0.124, END_OF_LIFE_WARNING),
ImpactOutput(0.1744, 0.08626, 0.124, END_OF_LIFE_WARNING),
ImpactOutput(0.005068, 0.0001889, 0.001),
),
GWPImpact(
ImpactOutput(1216.0, 459.3, 780.0, END_OF_LIFE_WARNING),
ImpactOutput(1215.0, 458.4, 780.0, END_OF_LIFE_WARNING),
ImpactOutput(17170.0, 329.2, 6000.0),
),
PEImpact(
ImpactOutput(16090.0, 6121.0, 10500.0, END_OF_LIFE_WARNING),
ImpactOutput(16070.0, 6108.0, 10500.0, END_OF_LIFE_WARNING),
ImpactOutput(8934000.0, 186.1, 200000.0),
),
)
Expand All @@ -221,11 +221,11 @@ async def test_usage_with_duration():
ImpactOutput(1.122e-07, 4.182e-09, 2e-08),
),
GWPImpact(
ImpactOutput(0.0347, 0.01311, 0.022, END_OF_LIFE_WARNING),
ImpactOutput(0.03467, 0.01308, 0.022, END_OF_LIFE_WARNING),
ImpactOutput(0.3802, 0.007287, 0.13),
),
PEImpact(
ImpactOutput(0.4591, 0.1747, 0.3, END_OF_LIFE_WARNING),
ImpactOutput(0.4588, 0.1743, 0.3, END_OF_LIFE_WARNING),
ImpactOutput(197.8, 0.004119, 5.0, UNCERTAINTY_WARNING),
),
)
Expand Down Expand Up @@ -253,11 +253,11 @@ async def test_usage_with_duration_and_time_workload():
ImpactOutput(4.11e-09, 3.082e-09, 3.4e-09),
),
GWPImpact(
ImpactOutput(0.03634, 0.01478, 0.026, END_OF_LIFE_WARNING),
ImpactOutput(0.03628, 0.01472, 0.026, END_OF_LIFE_WARNING),
ImpactOutput(0.008291, 0.006218, 0.0069),
),
PEImpact(
ImpactOutput(0.5049, 0.2022, 0.36, END_OF_LIFE_WARNING),
ImpactOutput(0.5041, 0.2014, 0.36, END_OF_LIFE_WARNING),
ImpactOutput(0.955, 0.7163, 0.79),
),
)
Expand All @@ -274,11 +274,11 @@ async def test_verbose_output_with_empty_usage():
ImpactOutput(0.003295, 0.0001228, 0.0007),
),
GWPImpact(
ImpactOutput(1694.0, 593.4, 1000.0, END_OF_LIFE_WARNING),
ImpactOutput(1693.0, 592.6, 1000.0, END_OF_LIFE_WARNING),
ImpactOutput(11170.0, 214.0, 4000.0),
),
PEImpact(
ImpactOutput(21480.0, 7606.0, 13000.0, END_OF_LIFE_WARNING),
ImpactOutput(21470.0, 7596.0, 13000.0, END_OF_LIFE_WARNING),
ImpactOutput(5808000.0, 121.0, 100000.0),
),
verbose_output={
Expand Down Expand Up @@ -393,7 +393,7 @@ async def test_verbose_output_with_empty_usage():
"max": 32,
"min": 32,
"source": "Completed from name name based on "
"https://docs.google.com/spreadsheets/d/1DqYgQnEDLQVQm5acMAhLgHLD8xXCG9BIrk-_Nv6jF3k/edit#gid=224728652.",
"https://docs.google.com/spreadsheets/d/1DqYgQnEDLQVQm5acMAhLgHLD8xXCG9BIrk-_Nv6jF3k/edit#gid=224728652.",
"status": "COMPLETED",
"value": 32,
},
Expand All @@ -410,15 +410,15 @@ async def test_verbose_output_with_empty_usage():
"max": "Naples",
"min": "Naples",
"source": "Completed from name name based on "
"https://docs.google.com/spreadsheets/d/1DqYgQnEDLQVQm5acMAhLgHLD8xXCG9BIrk-_Nv6jF3k/edit#gid=224728652.",
"https://docs.google.com/spreadsheets/d/1DqYgQnEDLQVQm5acMAhLgHLD8xXCG9BIrk-_Nv6jF3k/edit#gid=224728652.",
"status": "COMPLETED",
"value": "Naples",
},
"gwp_factor": {
"max": 0.9,
"min": 0.023,
"source": "https://www.sciencedirect.com/science/article/pii/S0306261921012149: \n"
"Average of 27 european countries",
"Average of 27 european countries",
"status": "DEFAULT",
"unit": "kg CO2eq/kWh",
"value": 0.38,
Expand Down Expand Up @@ -476,15 +476,15 @@ async def test_verbose_output_with_empty_usage():
"max": "AMD",
"min": "AMD",
"source": "Completed from name name based on "
"https://docs.google.com/spreadsheets/d/1DqYgQnEDLQVQm5acMAhLgHLD8xXCG9BIrk-_Nv6jF3k/edit#gid=224728652.",
"https://docs.google.com/spreadsheets/d/1DqYgQnEDLQVQm5acMAhLgHLD8xXCG9BIrk-_Nv6jF3k/edit#gid=224728652.",
"status": "COMPLETED",
"value": "AMD",
},
"model_range": {
"max": "EPYC",
"min": "EPYC",
"source": "Completed from name name based on "
"https://docs.google.com/spreadsheets/d/1DqYgQnEDLQVQm5acMAhLgHLD8xXCG9BIrk-_Nv6jF3k/edit#gid=224728652.",
"https://docs.google.com/spreadsheets/d/1DqYgQnEDLQVQm5acMAhLgHLD8xXCG9BIrk-_Nv6jF3k/edit#gid=224728652.",
"status": "COMPLETED",
"value": "EPYC",
},
Expand Down Expand Up @@ -517,7 +517,7 @@ async def test_verbose_output_with_empty_usage():
"max": 200,
"min": 200,
"source": "Completed from name name based on "
"https://docs.google.com/spreadsheets/d/1DqYgQnEDLQVQm5acMAhLgHLD8xXCG9BIrk-_Nv6jF3k/edit#gid=224728652.",
"https://docs.google.com/spreadsheets/d/1DqYgQnEDLQVQm5acMAhLgHLD8xXCG9BIrk-_Nv6jF3k/edit#gid=224728652.",
"status": "COMPLETED",
"unit": "W",
"value": 200,
Expand All @@ -526,7 +526,7 @@ async def test_verbose_output_with_empty_usage():
"max": 64,
"min": 64,
"source": "Completed from name name based on "
"https://docs.google.com/spreadsheets/d/1DqYgQnEDLQVQm5acMAhLgHLD8xXCG9BIrk-_Nv6jF3k/edit#gid=224728652.",
"https://docs.google.com/spreadsheets/d/1DqYgQnEDLQVQm5acMAhLgHLD8xXCG9BIrk-_Nv6jF3k/edit#gid=224728652.",
"status": "COMPLETED",
"value": 64,
},
Expand Down Expand Up @@ -694,7 +694,7 @@ async def test_verbose_output_with_empty_usage():
"max": 0.9,
"min": 0.023,
"source": "https://www.sciencedirect.com/science/article/pii/S0306261921012149: \n"
"Average of 27 european countries",
"Average of 27 european countries",
"status": "DEFAULT",
"unit": "kg CO2eq/kWh",
"value": 0.38,
Expand Down Expand Up @@ -867,7 +867,7 @@ async def test_verbose_output_with_empty_usage():
"max": 0.9,
"min": 0.023,
"source": "https://www.sciencedirect.com/science/article/pii/S0306261921012149: \n"
"Average of 27 european countries",
"Average of 27 european countries",
"status": "DEFAULT",
"unit": "kg CO2eq/kWh",
"value": 0.38,
Expand Down
Loading
Loading