From 0eefdd94c78fcce3867bc5dff2684a4c33563429 Mon Sep 17 00:00:00 2001 From: da-ekchajzer Date: Fri, 30 Jun 2023 13:24:33 +0200 Subject: [PATCH 1/4] refactor die size per core completion --- boaviztapi/model/component/cpu.py | 131 +++++++++++++++++------------- tests/unit/conftest.py | 2 +- tests/unit/test_fuzzymatch.py | 4 +- 3 files changed, 78 insertions(+), 59 deletions(-) diff --git a/boaviztapi/model/component/cpu.py b/boaviztapi/model/component/cpu.py index 559971e4..1a77808b 100644 --- a/boaviztapi/model/component/cpu.py +++ b/boaviztapi/model/component/cpu.py @@ -15,8 +15,6 @@ from boaviztapi.utils.fuzzymatch import fuzzymatch_attr_from_pdf, fuzzymatch_attr_from_cpu_name _cpu_specs = pd.read_csv(os.path.join(data_dir, 'crowdsourcing/cpu_specs.csv')) -_family_df = pd.read_csv(os.path.join(data_dir, 'crowdsourcing/cpu_manufacture.csv')) - def attributes_from_cpu_name(cpu_name: str): return fuzzymatch_attr_from_cpu_name(cpu_name, _cpu_specs) @@ -161,65 +159,28 @@ def __compute_impact_manufacture(self, core_impact: ImpactFactor, cpu_die_impact # COMPLETION def _complete_die_size_per_core(self): - self._complete_from_name() - corrected_family = None - # If we can have a die_size and core_units, we can compute the die_size_per_core - if self.die_size.has_value() and self.core_units.has_value(): - self.die_size_per_core.set_completed(value=float(self.die_size.value/self.core_units.value), source="die_size/core_units") - return None - sub = _family_df.copy() - # If we don't have a family, we use the die_size_per_core from the archetype - if self.die_size_per_core.has_value() and not self.family.has_value(): - return None + # Make sure all data have been completed from name + if self.name.is_set(): + self._complete_from_name() - if self.family.has_value(): - # Check if the family matches one of the families in the database and correct it if necessary - corrected_family = fuzzymatch_attr_from_pdf(self.family.value, "family", sub) - if corrected_family != self.family.value and corrected_family is not None: - self.family.set_changed(corrected_family) - - tmp = sub[sub['family'] == corrected_family] - - if len(tmp) > 0: - sub = tmp.copy() + # If the die_size_per_core have been set we have nothing to do + if self.die_size_per_core.is_set(): + pass - if self.core_units.has_value() and corrected_family is not None: - # Find the closest line to the number of cores provided by the user - sub['core_dif'] = sub[['core_units']].apply(lambda x: abs(x[0] - self.core_units.value), axis=1) - sub = sub.sort_values(by='core_dif', ascending=True) - row = sub.iloc[0] - - # If we have only one row but the number of cores is different, we use the max and min values of the dataframe - if row['core_dif'] != 0 and len(sub) == 1: - self.die_size_per_core.set_completed(float(row['die_size_per_core']), source=row['Source']) - self.die_size_per_core.min = float(float(_family_df['die_size_per_core'].min())) - self.die_size_per_core.max = float(float(_family_df['die_size_per_core'].max())) - return - - row2 = sub.iloc[1] - self.die_size_per_core.set_completed(float(row['die_size_per_core']), source=row['Source']) - - if row['core_dif'] == 0: - self.die_size_per_core.min = float(row['die_size_per_core']) - self.die_size_per_core.max = float(row['die_size_per_core']) - - elif float(row2['die_size_per_core']) > float(row['die_size_per_core']): - self.die_size_per_core.min = float(row['die_size_per_core']) - self.die_size_per_core.max = float(row2['die_size_per_core']) - - else: - self.die_size_per_core.min = float(row2['die_size_per_core']) - self.die_size_per_core.max = float(row['die_size_per_core']) - - return + # If we have a die_size and core_units, we can compute the die_size_per_core + elif self.die_size.is_set() and self.core_units.is_set(): + self.die_size_per_core.set_completed(value=float(self.die_size.value/self.core_units.value), source="die_size/core_units") + return None - source_family = self.family.value if corrected_family is not None else "all families" + # If we cannot have a family, but we have a die_size_per_core we use it + elif self.die_size_per_core.has_value() and not self.family.has_value(): + self.die_size_per_core.set_archetype(self.die_size_per_core.default) + return None - # If we don't have a number of cores, we use the average die size per core for a given family (if provided) - self.die_size_per_core.set_completed(float(sub['die_size_per_core'].mean()), source=f"Average for {source_family}") - self.die_size_per_core.min = float(float(sub['die_size_per_core'].min())) - self.die_size_per_core.max = float(float(sub['die_size_per_core'].max())) + # If tha above completion strategies cannot be applied, we use our cpu specs file + else: + self._complete_die_size_from_cpu_specs() def _complete_from_name(self): if self.name.has_value() and not self.name_completion: @@ -252,3 +213,61 @@ def _complete_from_name(self): # divide by 100 to convert mm2 into cm2 self.die_size.set_completed(die_size/100, min=die_size_min/100, max=die_size_max/100, source=f"{die_size_source} : Completed from name name based on {source}.") self.name_completion = True + + def _complete_die_size_from_cpu_specs(self): + corrected_family = None + sub = _cpu_specs.copy() + sub['die_size_per_core'] = sub[['total_die_size']] / sub[['cores']] + + if self.family.has_value(): + # Check if the family matches one of the families in the database and correct it if necessary + corrected_family = fuzzymatch_attr_from_pdf(self.family.value, "code_name", sub) + if corrected_family != self.family.value and corrected_family is not None: + self.family.set_changed(corrected_family) + + # Filter on the family of interest + tmp = sub[sub['code_name'] == corrected_family] + + # If we have at least one match we keep on going with this df if not we keep the initial df + if len(tmp) > 0: + sub = tmp.copy() + + if self.core_units.has_value(): + # Find the closest line to the number of cores provided by the user + sub['core_dif'] = sub[['cores']].apply(lambda x: abs(x[0] - self.core_units.value), axis=1) + sub = sub.sort_values(by='core_dif', ascending=True) + row = sub.iloc[0] + + # if we have only one row but the number of cores is different, we use the max and min values of the dataframe + if row['core_dif'] != 0 and len(sub) == 1: + self.die_size_per_core.set_completed(float(row['die_size_per_core']), source=row['Source']) + self.die_size_per_core.min = float(float(_cpu_specs['die_size_per_core'].min())) + self.die_size_per_core.max = float(float(_cpu_specs['die_size_per_core'].max())) + return + # else we use the closest cpu + else: + self.die_size_per_core.set_completed(float(row['die_size_per_core']), source=row['Source']) + + row2 = sub.iloc[1] + + # if there are no dif min = max = value + if row['core_dif'] == 0: + self.die_size_per_core.min = float(row['die_size_per_core']) + self.die_size_per_core.max = float(row['die_size_per_core']) + + # else we set the upper/lower band to the second-closest row + elif float(row2['die_size_per_core']) > float(row['die_size_per_core']): + self.die_size_per_core.min = float(row['die_size_per_core']) + self.die_size_per_core.max = float(row2['die_size_per_core']) + + else: + self.die_size_per_core.min = float(row2['die_size_per_core']) + self.die_size_per_core.max = float(row['die_size_per_core']) + + else: + source_family = self.family.value if corrected_family is not None else "all families" + + # If we don't have a number of cores, we use the average die size per core for a given family (if provided) + self.die_size_per_core.set_completed(float(sub['die_size_per_core'].mean()), source=f"Average for {source_family}") + self.die_size_per_core.min = float(float(sub['die_size_per_core'].min())) + self.die_size_per_core.max = float(float(sub['die_size_per_core'].max())) \ No newline at end of file diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py index 5908eefc..5f91b439 100644 --- a/tests/unit/conftest.py +++ b/tests/unit/conftest.py @@ -393,7 +393,7 @@ def cpu_specs_dataframe(): @pytest.fixture(scope="function") def cpu_dataframe(): - return pd.read_csv(data_dir + "/crowdsourcing/cpu_manufacture.csv") + return pd.read_csv(data_dir + "/crowdsourcing/cpu_specs.csv") @pytest.fixture(scope="function") diff --git a/tests/unit/test_fuzzymatch.py b/tests/unit/test_fuzzymatch.py index 3b7e4957..63b77c1c 100644 --- a/tests/unit/test_fuzzymatch.py +++ b/tests/unit/test_fuzzymatch.py @@ -21,8 +21,8 @@ def test_fuzzymatch_attr_from_cpu_name(cpu_specs_dataframe, cpu_name_input, name def test_fuzzymatch_cpu(cpu_dataframe): - assert "broadwell" == fuzzymatch_attr_from_pdf("broadwel", "family", cpu_dataframe).lower() - assert fuzzymatch_attr_from_pdf("cevevvreceerf", "family", cpu_dataframe) is None + assert "broadwell" == fuzzymatch_attr_from_pdf("broadwel", "code_name", cpu_dataframe).lower() + assert fuzzymatch_attr_from_pdf("cevevvreceerf", "code_name", cpu_dataframe) is None def test_fuzzymatch_ssd(ssd_dataframe): From 4ad5ec16f3371e4a360db05b866c899264696912 Mon Sep 17 00:00:00 2001 From: da-ekchajzer Date: Fri, 21 Jul 2023 11:14:30 +0200 Subject: [PATCH 2/4] _complete_die_size_per_core first changes --- boaviztapi/model/component/cpu.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boaviztapi/model/component/cpu.py b/boaviztapi/model/component/cpu.py index 1a77808b..0edf376e 100644 --- a/boaviztapi/model/component/cpu.py +++ b/boaviztapi/model/component/cpu.py @@ -166,7 +166,7 @@ def _complete_die_size_per_core(self): # If the die_size_per_core have been set we have nothing to do if self.die_size_per_core.is_set(): - pass + return None # If we have a die_size and core_units, we can compute the die_size_per_core elif self.die_size.is_set() and self.core_units.is_set(): @@ -178,7 +178,7 @@ def _complete_die_size_per_core(self): self.die_size_per_core.set_archetype(self.die_size_per_core.default) return None - # If tha above completion strategies cannot be applied, we use our cpu specs file + # If the above completion strategies cannot be applied, we use our cpu specs file else: self._complete_die_size_from_cpu_specs() From edff8b1cd6b0e7a19945529ebd7044cd8192815d Mon Sep 17 00:00:00 2001 From: da-ekchajzer Date: Wed, 30 Aug 2023 15:26:16 +0200 Subject: [PATCH 3/4] implementing cpu die_completion from cpu_specs --- .../data/crowdsourcing/cpu_manufacture.csv | 38 - boaviztapi/dto/component/cpu.py | 3 - boaviztapi/model/component/cpu.py | 186 ++-- boaviztapi/routers/utils_router.py | 5 +- docs/README.md | 2 +- docs/docs/Explanations/components/cpu.md | 23 +- docs/docs/getting_started/cpu_component.md | 168 ++-- docs/docs/getting_started/end_user_devices.md | 2 +- .../getting_started/single_cloud_instance.md | 170 ++-- docs/docs/getting_started/single_server.md | 138 ++- tests/api/test_cloud.py | 64 +- tests/api/test_component.py | 890 +++++++++--------- tests/api/test_server.py | 78 +- tests/data/crowdsourcing/cpu_manufacture.csv | 38 - tests/unit/test_bottom_up.py | 12 +- 15 files changed, 870 insertions(+), 947 deletions(-) delete mode 100644 boaviztapi/data/crowdsourcing/cpu_manufacture.csv delete mode 100644 tests/data/crowdsourcing/cpu_manufacture.csv diff --git a/boaviztapi/data/crowdsourcing/cpu_manufacture.csv b/boaviztapi/data/crowdsourcing/cpu_manufacture.csv deleted file mode 100644 index 1ca8c6e0..00000000 --- a/boaviztapi/data/crowdsourcing/cpu_manufacture.csv +++ /dev/null @@ -1,38 +0,0 @@ -manufacturer,family,manufacture_date,process,die_size,core_units,die_size_per_core,Source -Intel,skylake,2017,14,1.0183,2,0.51,https://en.wikichip.org/wiki/intel/microarchitectures/skylake_(client)#Dual-core -Intel,skylake,2017,14,1.223,4,0.31,https://en.wikichip.org/wiki/intel/microarchitectures/skylake_(client)#Quad-core -Intel,skylake,2017,14,3.2544,10,0.33,https://en.wikichip.org/wiki/intel/microarchitectures/skylake_(server)#Low_Core_Count_.28LCC.29 -Intel,skylake,2017,14,4.85,18,0.27,https://en.wikichip.org/wiki/intel/microarchitectures/skylake_(server)#High_Core_Count_.28HCC.29 -Intel,skylake,2017,14,6.94,28,0.25,https://en.wikichip.org/wiki/intel/microarchitectures/skylake_(server)#Extreme_Core_Count_.28XCC.29 -Intel,coffee lake,2017,14,1.26,4,0.32,https://en.wikichip.org/wiki/intel/microarchitectures/coffee_lake#Quad-Core -Intel,coffee lake,2017,14,1.496,6,0.25,https://en.wikichip.org/wiki/intel/microarchitectures/coffee_lake#Hexa-Core -Intel,coffee lake,2017,14,1.74,8,0.22,https://en.wikichip.org/wiki/intel/microarchitectures/coffee_lake#Octa-Core -Intel,broadwell,2014,14,0.82,2,0.41,https://en.wikichip.org/wiki/intel/microarchitectures/broadwell_(client)#Dual-core -Intel,broadwell,2014,14,1.82,4,0.46,https://en.wikichip.org/wiki/intel/microarchitectures/broadwell_(client)#Quad-core_Broadwell_with_Iris_Pro_die -Intel,broadwell,2014,14,2.46,10,0.25,https://en.wikichip.org/wiki/intel/microarchitectures/broadwell_(client)#Deca-core_Broadwell -Intel,broadwell,2014,14,3.0518,14,0.22,https://en.wikichip.org/wiki/intel/microarchitectures/broadwell_(client)#Die_Stats -Intel,broadwell,2014,14,4.5612,24,0.19,https://en.wikichip.org/wiki/intel/microarchitectures/broadwell_(client)#Die_Stats -Intel,haswell,2013,22,1.81,2,0.91,https://en.wikichip.org/wiki/intel/microarchitectures/haswell_(client)#Dual-core_GT3 -Intel,haswell,2013,22,2.6,4,0.65,https://en.wikichip.org/wiki/intel/microarchitectures/haswell_(client)#Quad-core_GT3 -Intel,haswell,2013,22,3.5552,8,0.44,https://en.wikichip.org/wiki/intel/microarchitectures/haswell_(client)#Octa-core -Intel,haswell,2013,22,6.22,18,0.35,https://en.wikichip.org/wiki/intel/microarchitectures/haswell_(client)#Octadeca-core -Intel,ivy bridge,2011,22,1.6,4,0.40,https://en.wikichip.org/wiki/intel/microarchitectures/ivy_bridge_(client)#Quad-core_Ivy_Bridge_die -Intel,ivy bridge,2011,22,5.41,15,0.36,https://en.wikichip.org/wiki/intel/microarchitectures/ivy_bridge_(client)#Pentadeca-Core_Ivy_Bridge_die -Intel,ivy bridge,2011,22,3.41,10,0.34,https://en.wikichip.org/wiki/intel/microarchitectures/ivy_bridge_(client)#Deca-core_Ivy_Bridge_Die -Intel,ivy bridge,2011,22,2.565,6,0.43,https://en.wikichip.org/wiki/intel/microarchitectures/ivy_bridge_(client)#Hexa-core_Ivy_Bridge_Die -Intel,sandy bridge,2010,32,1.49,2,0.75,https://en.wikichip.org/wiki/intel/microarchitectures/sandy_bridge_(client)#Dual-Core_.28GT2.29 -Intel,sandy bridge,2010,32,2.16,4,0.54,https://en.wikichip.org/wiki/intel/microarchitectures/sandy_bridge_(client)#Quad-Core -Intel,kaby lake,2017,14,1.26,4,0.32,https://en.wikichip.org/wiki/intel/microarchitectures/kaby_lake -Intel,ice lake,2019,10,6.28,40,0.16,https://fuse.wikichip.org/news/4734/intel-launches-3rd-gen-ice-lake-xeon-scalable/ -Intel,ice lake,2019,10,1.3,4,0.33,https://medium.com/@ewoutterhoeven/calculating-the-intel-ice-lake-quad-core-die-size-130mm2-ce18a44c5f05 -Intel,ice lake,2019,10,3.7,16,0.23,https://twitter.com/dylan522p/status/1326817993792266241?lang=en -Intel,ice lake,2019,10,5.05,28,0.18,https://twitter.com/dylan522p/status/1326817993792266241?lang=en -Intel,ice lake,2019,10,6.3,42,0.15,https://twitter.com/dylan522p/status/1326817993792266241?lang=en -Amd,Rome,2019,7,13.09,16,0.82,https://www.techarp.com/computer/amd-zen-3-tech-report/ (74mm2*core_units+125mm2) -Amd,Rome,2019,7,10.13,12,0.84,https://www.techarp.com/computer/amd-zen-3-tech-report/ (74mm2*core_units+125mm2) -Amd,Rome,2019,7,7.17,8,0.90,https://www.techarp.com/computer/amd-zen-3-tech-report/ (74mm2*core_units+125mm2) -Amd,Rome,2019,7,5.69,6,0.95,https://www.techarp.com/computer/amd-zen-3-tech-report/ (74mm2*core_units+125mm2) -Amd,Milan,2020,7,14.162,16,0.89,https://www.techarp.com/computer/amd-zen-3-tech-report/ (80.7mm2*core_units+125mm2) -Amd,Milan,2020,7,10.934,12,0.91,https://www.techarp.com/computer/amd-zen-3-tech-report/ (80.7mm2*core_units+125mm2) -Amd,Milan,2020,7,7.706,8,0.96,https://www.techarp.com/computer/amd-zen-3-tech-report/ (80.7mm2*core_units+125mm2) -Amd,Milan,2020,7,6.092,6,1.02,https://www.techarp.com/computer/amd-zen-3-tech-report/ (80.7mm2*core_units+125mm2) \ No newline at end of file diff --git a/boaviztapi/dto/component/cpu.py b/boaviztapi/dto/component/cpu.py index c9e4fe16..57968f27 100644 --- a/boaviztapi/dto/component/cpu.py +++ b/boaviztapi/dto/component/cpu.py @@ -10,9 +10,6 @@ from boaviztapi.service.archetype import get_component_archetype -_cpu_df = pd.read_csv(os.path.join(os.path.dirname(__file__), '../../data/crowdsourcing/cpu_manufacture.csv')) - - class CPU(ComponentDTO): core_units: Optional[int] = None die_size: Optional[float] = None diff --git a/boaviztapi/model/component/cpu.py b/boaviztapi/model/component/cpu.py index 0edf376e..eb373c3c 100644 --- a/boaviztapi/model/component/cpu.py +++ b/boaviztapi/model/component/cpu.py @@ -12,10 +12,11 @@ from boaviztapi.model.impact import ImpactFactor from boaviztapi.service.archetype import get_component_archetype, get_arch_value from boaviztapi.service.factor_provider import get_impact_factor -from boaviztapi.utils.fuzzymatch import fuzzymatch_attr_from_pdf, fuzzymatch_attr_from_cpu_name +from boaviztapi.utils.fuzzymatch import fuzzymatch_attr_from_cpu_name, fuzzymatch_attr_from_pdf _cpu_specs = pd.read_csv(os.path.join(data_dir, 'crowdsourcing/cpu_specs.csv')) + def attributes_from_cpu_name(cpu_name: str): return fuzzymatch_attr_from_cpu_name(cpu_name, _cpu_specs) @@ -33,14 +34,13 @@ def __init__(self, archetype=get_component_archetype(config["default_cpu"], "cpu max=get_arch_value(archetype, 'core_units', 'max') ) self.die_size_per_core = Boattribute( - complete_function=self._complete_die_size_per_core, unit="cm2", default=get_arch_value(archetype, 'die_size_per_core', 'default'), min=get_arch_value(archetype, 'die_size_per_core', 'min'), max=get_arch_value(archetype, 'die_size_per_core', 'max') ) self.die_size = Boattribute( - complete_function=self._complete_from_name, + complete_function=self._complete_die_size, unit="cm2", default=get_arch_value(archetype, 'die_size', 'default'), min=get_arch_value(archetype, 'die_size', 'min'), @@ -118,14 +118,16 @@ def model_power_consumption(self) -> ImpactFactor: cpu_model_range=self.model_range.value, cpu_tdp=self.tdp.value) if type(self.usage.time_workload.value) in (float, int): - self.usage.avg_power.set_completed(self.usage.consumption_profile.apply_consumption_profile(self.usage.time_workload.value)) + self.usage.avg_power.set_completed( + self.usage.consumption_profile.apply_consumption_profile(self.usage.time_workload.value)) else: - self.usage.avg_power.set_completed(self.usage.consumption_profile.apply_multiple_workloads(self.usage.time_workload.value)) + self.usage.avg_power.set_completed( + self.usage.consumption_profile.apply_multiple_workloads(self.usage.time_workload.value)) return ImpactFactor( - value=rd.round_to_sigfig(self.usage.avg_power.value, 5), - min=rd.round_to_sigfig(self.usage.avg_power.value, 5), - max=rd.round_to_sigfig(self.usage.avg_power.value, 5) + value=rd.round_to_sigfig(self.usage.avg_power.value, 5), + min=rd.round_to_sigfig(self.usage.avg_power.value, 5), + max=rd.round_to_sigfig(self.usage.avg_power.value, 5) ) def __get_impact_constants(self, impact_type: str) -> Tuple[ImpactFactor, ImpactFactor, ImpactFactor]: @@ -148,34 +150,38 @@ def __get_impact_constants(self, impact_type: str) -> Tuple[ImpactFactor, Impact return core_impact, cpu_die_impact, cpu_impact def __compute_significant_numbers(self, core_impact: float, cpu_die_impact: float, cpu_impact: float) -> int: - return rd.min_significant_figures(self.die_size_per_core.value, core_impact, cpu_die_impact, cpu_impact) + return rd.min_significant_figures(self.die_size.value, core_impact, cpu_die_impact, cpu_impact) - def __compute_impact_manufacture(self, core_impact: ImpactFactor, cpu_die_impact: ImpactFactor, cpu_impact: ImpactFactor) -> ImpactFactor: + def __compute_impact_manufacture(self, core_impact: ImpactFactor, cpu_die_impact: ImpactFactor, + cpu_impact: ImpactFactor) -> ImpactFactor: return ImpactFactor( - value=(self.core_units.value * self.die_size_per_core.value + core_impact.value) * cpu_die_impact.value + cpu_impact.value, - min=(self.core_units.min * self.die_size_per_core.min + core_impact.min) * cpu_die_impact.min + cpu_impact.min, - max=(self.core_units.max * self.die_size_per_core.max + core_impact.max) * cpu_die_impact.max + cpu_impact.max + value=( + self.die_size.value + core_impact.value) * cpu_die_impact.value + cpu_impact.value, + min=( + self.die_size.min + core_impact.min) * cpu_die_impact.min + cpu_impact.min, + max=( + self.die_size.max + core_impact.max) * cpu_die_impact.max + cpu_impact.max ) # COMPLETION - def _complete_die_size_per_core(self): - + def _complete_die_size(self): # Make sure all data have been completed from name if self.name.is_set(): self._complete_from_name() # If the die_size_per_core have been set we have nothing to do - if self.die_size_per_core.is_set(): + if self.die_size.is_set(): return None - # If we have a die_size and core_units, we can compute the die_size_per_core - elif self.die_size.is_set() and self.core_units.is_set(): - self.die_size_per_core.set_completed(value=float(self.die_size.value/self.core_units.value), source="die_size/core_units") + # If we have a die_size_per_core and core_units, we can compute the die_size + elif self.die_size_per_core.is_set() and self.core_units.is_set(): + self.die_size.set_completed(value=float(self.die_size_per_core.value * self.core_units.value), + source="die_size_per_core*core_units") return None - # If we cannot have a family, but we have a die_size_per_core we use it - elif self.die_size_per_core.has_value() and not self.family.has_value(): - self.die_size_per_core.set_archetype(self.die_size_per_core.default) + # If we cannot have a family, but we have a default die_size we use it + elif self.die_size.has_value() and not self.family.has_value(): + self.die_size.set_archetype(self.die_size.default) return None # If the above completion strategies cannot be applied, we use our cpu specs file @@ -188,86 +194,96 @@ def _complete_from_name(self): if self.name.min != self.name.value or self.name.max != self.name.value: compute_min_max = True - name, manufacturer, family, model_range, tdp, cores, die_size, die_size_source, source = attributes_from_cpu_name(self.name.value) + name, manufacturer, family, model_range, tdp, cores, die_size, die_size_source, source = attributes_from_cpu_name( + self.name.value) if compute_min_max: - name_min, manufacturer_min, family_min, model_range_min, tdp_min, cores_min, die_size_min, die_size_source_min, source_min = attributes_from_cpu_name(self.name.min) - name_max, manufacturer_max, family_max, model_range_max, tdp_max, cores_max, die_size_max, die_size_source_max, source_max = attributes_from_cpu_name(self.name.max) + name_min, manufacturer_min, family_min, model_range_min, tdp_min, cores_min, die_size_min, die_size_source_min, source_min = attributes_from_cpu_name( + self.name.min) + name_max, manufacturer_max, family_max, model_range_max, tdp_max, cores_max, die_size_max, die_size_source_max, source_max = attributes_from_cpu_name( + self.name.max) else: - name_min, manufacturer_min, family_min, model_range_min, tdp_min, cores_min, die_size_min, die_size_source_min, source_min = name, manufacturer, family, model_range, tdp, cores, die_size, die_size_source, source - name_max, manufacturer_max, family_max, model_range_max, tdp_max, cores_max, die_size_max, die_size_source_max, source_max = name, manufacturer, family, model_range, tdp, cores, die_size, die_size_source, source + name_min, manufacturer_min, family_min, model_range_min, tdp_min, cores_min, die_size_min, die_size_source_min, source_min = name, manufacturer, family, model_range, tdp, cores, die_size, die_size_source, source + name_max, manufacturer_max, family_max, model_range_max, tdp_max, cores_max, die_size_max, die_size_source_max, source_max = name, manufacturer, family, model_range, tdp, cores, die_size, die_size_source, source if name is not None: self.name.set_completed(name, min=name_min, max=name_max, source="fuzzy match") if manufacturer is not None: - self.manufacturer.set_completed(manufacturer, min=manufacturer_min, max=manufacturer_max, source=f"Completed from name name based on {source}.") + self.manufacturer.set_completed(manufacturer, min=manufacturer_min, max=manufacturer_max, + source=f"Completed from name name based on {source}.") if family is not None: - self.family.set_completed(family, min=family_min, max=family_max, source=f"Completed from name name based on {source}.") + self.family.set_completed(family, min=family_min, max=family_max, + source=f"Completed from name name based on {source}.") if model_range is not None: - self.model_range.set_completed(model_range, min=model_range_min, max=model_range_max, source=f"Completed from name name based on {source}.") + self.model_range.set_completed(model_range, min=model_range_min, max=model_range_max, + source=f"Completed from name name based on {source}.") if tdp is not None: - self.tdp.set_completed(tdp, min=tdp_min, max=tdp_max, source=f"Completed from name name based on {source}.") + self.tdp.set_completed(tdp, min=tdp_min, max=tdp_max, + source=f"Completed from name name based on {source}.") if cores is not None: - self.core_units.set_completed(cores, min=cores_min, max=cores_max, source=f"Completed from name name based on {source}.") + self.core_units.set_completed(cores, min=cores_min, max=cores_max, + source=f"Completed from name name based on {source}.") if die_size is not None: # divide by 100 to convert mm2 into cm2 - self.die_size.set_completed(die_size/100, min=die_size_min/100, max=die_size_max/100, source=f"{die_size_source} : Completed from name name based on {source}.") + self.die_size.set_completed(die_size / 100, min=die_size_min / 100, max=die_size_max / 100, + source=f"{die_size_source} : Completed from name name based on {source}.") self.name_completion = True def _complete_die_size_from_cpu_specs(self): - corrected_family = None - sub = _cpu_specs.copy() - sub['die_size_per_core'] = sub[['total_die_size']] / sub[['cores']] - - if self.family.has_value(): - # Check if the family matches one of the families in the database and correct it if necessary - corrected_family = fuzzymatch_attr_from_pdf(self.family.value, "code_name", sub) - if corrected_family != self.family.value and corrected_family is not None: - self.family.set_changed(corrected_family) - - # Filter on the family of interest - tmp = sub[sub['code_name'] == corrected_family] - - # If we have at least one match we keep on going with this df if not we keep the initial df - if len(tmp) > 0: - sub = tmp.copy() - - if self.core_units.has_value(): - # Find the closest line to the number of cores provided by the user - sub['core_dif'] = sub[['cores']].apply(lambda x: abs(x[0] - self.core_units.value), axis=1) - sub = sub.sort_values(by='core_dif', ascending=True) - row = sub.iloc[0] - - # if we have only one row but the number of cores is different, we use the max and min values of the dataframe - if row['core_dif'] != 0 and len(sub) == 1: - self.die_size_per_core.set_completed(float(row['die_size_per_core']), source=row['Source']) - self.die_size_per_core.min = float(float(_cpu_specs['die_size_per_core'].min())) - self.die_size_per_core.max = float(float(_cpu_specs['die_size_per_core'].max())) - return - # else we use the closest cpu - else: - self.die_size_per_core.set_completed(float(row['die_size_per_core']), source=row['Source']) - - row2 = sub.iloc[1] - - # if there are no dif min = max = value - if row['core_dif'] == 0: - self.die_size_per_core.min = float(row['die_size_per_core']) - self.die_size_per_core.max = float(row['die_size_per_core']) + df = _cpu_specs[_cpu_specs["total_die_size"].notna()] + + # Fuzzymatch on the available code_name + family = fuzzymatch_attr_from_pdf(self.family.value, "code_name", + df) if self.family.has_value() else None + + if family is not None: + if family != self.family.value: + self.family.set_changed(family) + # Filter the cpu_specs file to get only the rows that match the family + df = df[(_cpu_specs["code_name"] == self.family.value)] + + # If we don't have a core_units, we take the average of the df + if self.core_units.is_none(): + self.die_size.set_completed( + value=rd.round_to_sigfig(df["total_die_size"].mean() / 100, 3), + min=rd.round_to_sigfig(df["total_die_size"].min() / 100, 3), + max=rd.round_to_sigfig(df["total_die_size"].max() / 100, 3), + source=f"Average value for {self.family.value if family else 'all families'}" + ) - # else we set the upper/lower band to the second-closest row - elif float(row2['die_size_per_core']) > float(row['die_size_per_core']): - self.die_size_per_core.min = float(row['die_size_per_core']) - self.die_size_per_core.max = float(row2['die_size_per_core']) + # If we have the good number of cores in the cpu_specs file, we take the value + elif self.core_units.value in df["cores"].values: + df_value = df[(df["cores"] == self.core_units.value)] + df_min = df[(df["cores"] == self.core_units.min)] + df_max = df[(df["cores"] == self.core_units.max)] + self.die_size.set_completed( + value=rd.round_to_sigfig(df_value["total_die_size"].mean() / 100, 3), + min=rd.round_to_sigfig(df_min["total_die_size"].min() / 100, 3), + max=rd.round_to_sigfig(df_max["total_die_size"].max() / 100, 3), + source=f"Average value of {self.family.value if family else 'all families'} with {self.core_units.value} cores" + ) - else: - self.die_size_per_core.min = float(row2['die_size_per_core']) - self.die_size_per_core.max = float(row['die_size_per_core']) + # If all rows have the same number of cores but different from the given cores_units + elif len(df.index) == 1 or (not df.isnull and (df["cores"] == df["cores"].iloc[0]).all()): + self.die_size.set_completed( + value=rd.round_to_sigfig((df["total_die_size"].iloc[0] * self.core_units.value / df['cores'].iloc[0]) / 100, 3), + min=rd.round_to_sigfig((df["total_die_size"].min() * self.core_units.min / df['cores'].iloc[0]) / 100, 3), + max=rd.round_to_sigfig((df["total_die_size"].max() * self.core_units.max / df['cores'].iloc[0]) / 100, 3), + source=f"Rule of three on {df['name'].iloc[0]}" + ) + # If none of the above works, we compute a linear regression else: - source_family = self.family.value if corrected_family is not None else "all families" - - # If we don't have a number of cores, we use the average die size per core for a given family (if provided) - self.die_size_per_core.set_completed(float(sub['die_size_per_core'].mean()), source=f"Average for {source_family}") - self.die_size_per_core.min = float(float(sub['die_size_per_core'].min())) - self.die_size_per_core.max = float(float(sub['die_size_per_core'].max())) \ No newline at end of file + cores = df["cores"].values + total_die_size = df["total_die_size"].values + x̄ = cores.mean() + ȳ = total_die_size.mean() + b = ((cores - x̄) * (total_die_size - ȳ)).sum() / ((cores - x̄) ** 2).sum() + a = ȳ - b * x̄ + + self.die_size.set_completed( + value=rd.round_to_sigfig((a + b * self.core_units.value) / 100, 3), + min=rd.round_to_sigfig((a + b * self.core_units.min) / 100, 3), + max=rd.round_to_sigfig((a + b * self.core_units.max) / 100, 3), + source=f"Linear regression on {self.family.value if family else 'all families'}" + ) \ No newline at end of file diff --git a/boaviztapi/routers/utils_router.py b/boaviztapi/routers/utils_router.py index b2e94fb3..3215ab6b 100644 --- a/boaviztapi/routers/utils_router.py +++ b/boaviztapi/routers/utils_router.py @@ -19,7 +19,6 @@ data_dir = os.path.join(os.path.dirname(__file__), '../data') _cpu_specs = pd.read_csv(os.path.join(data_dir, 'crowdsourcing/cpu_specs.csv')) -_cpu_manuf = pd.read_csv(os.path.join(data_dir, 'crowdsourcing/cpu_manufacture.csv')) _ssd_manuf = pd.read_csv(os.path.join(data_dir, 'crowdsourcing/ssd_manufacture.csv')) _ram_manuf = pd.read_csv(os.path.join(data_dir, 'crowdsourcing/ram_manufacture.csv')) @@ -31,8 +30,8 @@ async def utils_get_all_countries(): @utils_router.get('/cpu_family', description=cpu_family) async def utils_get_all_cpu_family(): - df = _cpu_manuf[_cpu_manuf["family"].notna()] - return [*df["family"].unique()] + df = _cpu_specs[_cpu_specs["code_name"].notna()] + return [*df["code_name"].unique()] @utils_router.get('/cpu_model_range', description=cpu_model_range) diff --git a/docs/README.md b/docs/README.md index a398dcbe..16ff5d83 100644 --- a/docs/README.md +++ b/docs/README.md @@ -17,7 +17,7 @@ Documentation is generated from markdown using `mkdocs` with the `material` them ```bash # install mkdocs and its extensions -pip install mkdocs mkdocs-render-swagger-plugin mkdocs-material +pip install mkdocs mkdocs-render-swagger-plugin mkdocs-material mkdocs-macros-plugin ``` 💡 Do not mixup _pip_ and _brew_ installation of `mkdocs` (see [troubleshooting](https://jimandreas.github.io/mkdocs-material/troubleshooting/)). diff --git a/docs/docs/Explanations/components/cpu.md b/docs/docs/Explanations/components/cpu.md index e206bc24..2c59bd40 100644 --- a/docs/docs/Explanations/components/cpu.md +++ b/docs/docs/Explanations/components/cpu.md @@ -8,8 +8,8 @@ | usage | None | See Usage | See usage | .. | | core_units | None | 24;1;64 | Number of physical core on one CPU | 12 | | die_size | cm2 | None | Size of the die | 1.1 | -| embeddedr | None | None | Name of the CPU embeddedr | AMD | -| die_size_per_core | cm2 | (avg;min;max) in our dataset | Size of the die divided by the number of core | 0.245 | +| embedded | None | None | Name of the CPU embedded | AMD | +| die_size_per_core | cm2 | None | Size of the die divided by the number of core | 0.245 | | model_range | None | None | Name of the cpu range or brand | i7 | | family | None | None | Name of the architectural family (Generation) | Skylake | | name | None | None | Complete commercial name of the CPU | Intel Core i7-1065 | @@ -25,21 +25,20 @@ If CPU ```name``` is given, ```model_range```, ```tdp```, ```die_size``` and ```family``` can be retrieved from a fuzzy matching on our cpu name repository. !!!warning - Note that the cpu name repository is not complete and that the completion can return a different cpu than the one given by the user. + Note that the cpu name repository is not complete and the completion can return a different cpu than the one given by the user. -### Completion of the ```die_size_per_core``` from ```family``` and/or ```core_units``` +### Completion of the ```die_size``` from ```family``` and/or ```core_units``` -if ```die_size``` and ```core_units``` are given : +if ```die_size_per_core``` and ```core_units``` are given : -$$ \text{die_size_per_core} = \frac{\text{core_units}}{\text{die_size}}$$ +$$ \text{die_size_per_core} = {\text{core_units}}*{\text{die_size}}$$ -Otherwise, if ```family``` is given, ```die_size_per_core``` can be retrieved from a fuzzy matching on our cpu repository. +Otherwise, if ```family``` is given, ```die_size``` can be retrieved from a fuzzy matching on our cpu repository. -If several cpu matches the given ```family```, the closest value in terms of ```core_units``` is used (if ```core_units``` given by the user). ```min``` and ```max``` will be set if the closest value does not correspond to the exact same ```core_units``` value provided by the user. - -If ```core_units``` is not provided, the average value is given and min and max value are used as ```min``` and ```max``` fields. - -If no cpu is found either because the cpu is unknown or not enough data have been given by the user the archetype data are used. +If several cpu matches the given ```family```, we use the ```core_units``` attributes : +* If ```core_units``` matches one to many cpu, the average value is given and min and max value are used as ```min``` and ```max``` fields. +* If ```core_units``` does not match any cpu, we infer the ```die_size``` with a rule of three or a linear regression (when multiple cpus are available). +* If ```core_units``` is not provided, the average value is given and min and max value are used as ```min``` and ```max``` fields. ## Embedded impacts diff --git a/docs/docs/getting_started/cpu_component.md b/docs/docs/getting_started/cpu_component.md index 28f2b49e..8dff486f 100644 --- a/docs/docs/getting_started/cpu_component.md +++ b/docs/docs/getting_started/cpu_component.md @@ -36,10 +36,10 @@ Result : { "gwp": { "embedded": { - "value": 21.927, + "value": 13.2, "significant_figures": 5, - "min": 10.6, - "max": 44.149, + "min": 13.062, + "max": 13.594, "warnings": [ "End of life is not included in the calculation" ] @@ -48,17 +48,17 @@ Result : "value": 944.95, "significant_figures": 5, "min": 57.195, - "max": 2814 + "max": 2814.0 }, "unit": "kgCO2eq", "description": "Total climate change" }, "adp": { "embedded": { - "value": 0.020404, + "value": 0.020401, "significant_figures": 5, - "min": 0.0204, - "max": 0.02041, + "min": 0.020401, + "max": 0.020401, "warnings": [ "End of life is not included in the calculation" ] @@ -74,19 +74,19 @@ Result : }, "pe": { "embedded": { - "value": 328.01, + "value": 210.62, "significant_figures": 5, - "min": 175.64, - "max": 626.93, + "min": 208.76, + "max": 215.92, "warnings": [ "End of life is not included in the calculation" ] }, "use": { - "value": 32012, + "value": 32012.0, "significant_figures": 5, "min": 32.327, - "max": 1164200 + "max": 1164200.0 }, "unit": "MJ", "description": "Consumption of primary energy" @@ -120,10 +120,10 @@ Result : "impacts": { "gwp": { "embedded": { - "value": 21.927, + "value": 13.2, "significant_figures": 5, - "min": 10.6, - "max": 44.149, + "min": 13.062, + "max": 13.594, "warnings": [ "End of life is not included in the calculation" ] @@ -132,7 +132,7 @@ Result : "value": 944.95, "significant_figures": 5, "min": 57.195, - "max": 2814 + "max": 2814.0 }, "unit": "kgCO2eq", "description": "Total climate change" @@ -142,10 +142,10 @@ Result : "impacts": { "gwp": { "embedded": { - "value": 21.927, + "value": 13.2, "significant_figures": 5, - "min": 10.6, - "max": 44.149, + "min": 13.062, + "max": 13.594, "warnings": [ "End of life is not included in the calculation" ] @@ -154,31 +154,25 @@ Result : "value": 944.95, "significant_figures": 5, "min": 57.195, - "max": 2814 + "max": 2814.0 }, "unit": "kgCO2eq", "description": "Total climate change" } }, "units": { - "value": 1, + "value": 1.0, "status": "ARCHETYPE", - "min": 1, - "max": 1 + "min": 1.0, + "max": 1.0 }, - "core_units": { - "value": 24, - "status": "ARCHETYPE", - "min": 1, - "max": 64 - }, - "die_size_per_core": { - "value": 0.25, + "die_size": { + "value": 1.57, "status": "COMPLETED", "unit": "cm2", - "source": "https://en.wikichip.org/wiki/intel/microarchitectures/skylake_(server)#Extreme_Core_Count_.28XCC.29", - "min": 0.25, - "max": 0.27 + "source": "Average value for Skylake", + "min": 1.5, + "max": 1.77 }, "model_range": { "value": "Xeon Gold", @@ -195,9 +189,11 @@ Result : "max": "Intel" }, "family": { - "value": "skylake", - "status": "CHANGED", - "source": "Completed from name name based on https://github.com/cloud-carbon-footprint/cloud-carbon-coefficients/tree/main/data." + "value": "Skylake", + "status": "COMPLETED", + "source": "Completed from name name based on https://github.com/cloud-carbon-footprint/cloud-carbon-coefficients/tree/main/data.", + "min": "Skylake", + "max": "Skylake" }, "name": { "value": "Intel Xeon Gold 6134", @@ -207,7 +203,7 @@ Result : "max": "Intel Xeon Gold 6134" }, "duration": { - "value": 26280, + "value": 26280.0, "unit": "hours" }, "avg_power": { @@ -218,11 +214,11 @@ Result : "max": 94.624 }, "time_workload": { - "value": 50, + "value": 50.0, "status": "ARCHETYPE", "unit": "%", - "min": 0, - "max": 100 + "min": 0.0, + "max": 100.0 }, "usage_location": { "value": "EEE", @@ -230,18 +226,18 @@ Result : "unit": "CodSP3 - NCS Country Codes - NATO" }, "use_time_ratio": { - "value": 1, + "value": 1.0, "status": "ARCHETYPE", "unit": "/1", - "min": 1, - "max": 1 + "min": 1.0, + "max": 1.0 }, "hours_life_time": { - "value": 26280, + "value": 26280.0, "status": "ARCHETYPE", "unit": "hours", - "min": 26280, - "max": 26280 + "min": 26280.0, + "max": 26280.0 }, "params": { "value": { @@ -276,23 +272,23 @@ curl -X 'POST' \ -H 'Content-Type: application/json' \ -d '{ "core_units": 24, - "family": "Skylake" + "family": "skylake" }' ``` Result : * This query returns will compute the gwp and adp impacts since we add the `criteria=gwp&criteria=adp` flags. -* Since only lowercase is used, the API will correct Skylake to skylake (CHANGED) and complete the missing attributes from the given attributes (COMPLETED) or by default ones (ARCEHTYPE). +* The API will correct skylake to Skylake (CHANGED) and complete the missing attributes from the given attributes (COMPLETED) or by default ones (ARCHETYPE). ```json { "impacts": { "gwp": { "embedded": { - "value": 21.927, + "value": 18.913, "significant_figures": 5, - "min": 21.927, - "max": 22.873, + "min": 18.913, + "max": 18.913, "warnings": [ "End of life is not included in the calculation" ] @@ -308,10 +304,10 @@ Result : }, "adp": { "embedded": { - "value": 0.020404, + "value": 0.020403, "significant_figures": 5, - "min": 0.020404, - "max": 0.020404, + "min": 0.020403, + "max": 0.020403, "warnings": [ "End of life is not included in the calculation" ] @@ -330,10 +326,10 @@ Result : "impacts": { "gwp": { "embedded": { - "value": 21.927, + "value": 18.913, "significant_figures": 5, - "min": 21.927, - "max": 22.873, + "min": 18.913, + "max": 18.913, "warnings": [ "End of life is not included in the calculation" ] @@ -349,10 +345,10 @@ Result : }, "adp": { "embedded": { - "value": 0.020404, + "value": 0.020403, "significant_figures": 5, - "min": 0.020404, - "max": 0.020404, + "min": 0.020403, + "max": 0.020403, "warnings": [ "End of life is not included in the calculation" ] @@ -368,29 +364,29 @@ Result : } }, "units": { - "value": 1, + "value": 1.0, "status": "ARCHETYPE", - "min": 1, - "max": 1 + "min": 1.0, + "max": 1.0 }, "core_units": { "value": 24, "status": "INPUT" }, - "die_size_per_core": { - "value": 0.25, + "die_size": { + "value": 4.47, "status": "COMPLETED", "unit": "cm2", - "source": "https://en.wikichip.org/wiki/intel/microarchitectures/skylake_(server)#Extreme_Core_Count_.28XCC.29", - "min": 0.25, - "max": 0.27 + "source": "Linear regression on Skylake", + "min": 4.47, + "max": 4.47 }, "family": { - "value": "skylake", + "value": "Skylake", "status": "CHANGED" }, "duration": { - "value": 26280, + "value": 26280.0, "unit": "hours" }, "avg_power": { @@ -401,11 +397,11 @@ Result : "max": 182.23 }, "time_workload": { - "value": 50, + "value": 50.0, "status": "ARCHETYPE", "unit": "%", - "min": 0, - "max": 100 + "min": 0.0, + "max": 100.0 }, "usage_location": { "value": "EEE", @@ -413,18 +409,18 @@ Result : "unit": "CodSP3 - NCS Country Codes - NATO" }, "use_time_ratio": { - "value": 1, + "value": 1.0, "status": "ARCHETYPE", "unit": "/1", - "min": 1, - "max": 1 + "min": 1.0, + "max": 1.0 }, "hours_life_time": { - "value": 26280, + "value": 26280.0, "status": "ARCHETYPE", "unit": "hours", - "min": 26280, - "max": 26280 + "min": 26280.0, + "max": 26280.0 }, "params": { "value": { @@ -483,10 +479,10 @@ Result : { "gwp": { "embedded": { - "value": 0.0016687, + "value": 0.0010046, "significant_figures": 5, - "min": 0.00080668, - "max": 0.0033599, + "min": 0.00099408, + "max": 0.0010346, "warnings": [ "End of life is not included in the calculation" ] @@ -531,10 +527,10 @@ Result : { "gwp": { "embedded": { - "value": 21.927, + "value": 13.2, "significant_figures": 5, - "min": 10.6, - "max": 44.149, + "min": 13.062, + "max": 13.594, "warnings": [ "End of life is not included in the calculation" ] diff --git a/docs/docs/getting_started/end_user_devices.md b/docs/docs/getting_started/end_user_devices.md index 49c239eb..90bc2d76 100644 --- a/docs/docs/getting_started/end_user_devices.md +++ b/docs/docs/getting_started/end_user_devices.md @@ -94,7 +94,7 @@ curl -X 'POST' \ This query returns : -- The impacts for the both gwp and adp criteria since ```criteria=gwp&criteria=adp``` +* The impacts for both gwp and adp criteria since ```criteria=gwp&criteria=adp``` * The API will use an average electrical consumption of 70 Watt/hours 30% of the time (since ```use_time_ratio=0.3```) for one year (since duration is set at 8760 hours). * Usage impacts will be assessed for the French electrical mix impacts since ```usage_location='FRA'``` * Embedded impacts will be allocated on one year (since duration is set at 8760 hours). diff --git a/docs/docs/getting_started/single_cloud_instance.md b/docs/docs/getting_started/single_cloud_instance.md index 7163e718..55c48b4e 100644 --- a/docs/docs/getting_started/single_cloud_instance.md +++ b/docs/docs/getting_started/single_cloud_instance.md @@ -97,10 +97,10 @@ Response : "impacts": { "gwp": { "embedded": { - "value": 5.3431, + "value": 5.3747, "significant_figures": 5, - "min": 194.02, - "max": 590.64, + "min": 196.05, + "max": 592.66, "warnings": [ "End of life is not included in the calculation" ] @@ -109,17 +109,17 @@ Response : "value": 17.747, "significant_figures": 5, "min": 62.027, - "max": 4069 + "max": 4069.0 }, "unit": "kgCO2eq", "description": "Total climate change" }, "adp": { "embedded": { - "value": 0.00057378, + "value": 0.00057379, "significant_figures": 5, - "min": 0.025378, - "max": 0.053353, + "min": 0.025379, + "max": 0.053354, "warnings": [ "End of life is not included in the calculation" ] @@ -136,7 +136,7 @@ Response : }, "verbose": { "duration": { - "value": 8760, + "value": 8760.0, "unit": "hours" }, "ASSEMBLY-1": { @@ -177,7 +177,7 @@ Response : "max": 1 }, "duration": { - "value": 8760, + "value": 8760.0, "unit": "hours" } }, @@ -185,10 +185,10 @@ Response : "impacts": { "gwp": { "embedded": { - "value": 2.7514, + "value": 4.7775, "significant_figures": 5, - "min": 2.7514, - "max": 2.7514, + "min": 4.7775, + "max": 4.7775, "warnings": [ "End of life is not included in the calculation" ] @@ -204,10 +204,10 @@ Response : }, "adp": { "embedded": { - "value": 0.0051001, + "value": 0.0051007, "significant_figures": 5, - "min": 0.0051001, - "max": 0.0051001, + "min": 0.0051007, + "max": 0.0051007, "warnings": [ "End of life is not included in the calculation" ] @@ -223,10 +223,10 @@ Response : } }, "units": { - "value": 1, + "value": 1.0, "status": "ARCHETYPE", - "min": 1, - "max": 1 + "min": 1.0, + "max": 1.0 }, "core_units": { "value": 64, @@ -235,21 +235,13 @@ Response : "min": 64, "max": 64 }, - "die_size_per_core": { - "value": 0.007125, - "status": "COMPLETED", - "unit": "cm2", - "source": "die_size/core_units", - "min": 0.007125, - "max": 0.007125 - }, "die_size": { - "value": 0.456, + "value": 4.57, "status": "COMPLETED", "unit": "cm2", - "source": "https://en.wikichip.org/wiki/annapurna_labs/alpine/alc12b00 : Completed from name name based on https://docs.google.com/spreadsheets/d/1DqYgQnEDLQVQm5acMAhLgHLD8xXCG9BIrk-_Nv6jF3k/edit#gid=224728652.", - "min": 0.456, - "max": 0.456 + "source": "Average value of Graviton2 with 64 cores", + "min": 4.57, + "max": 4.57 }, "model_range": { "value": "Graviton2", @@ -288,7 +280,7 @@ Response : "max": 150 }, "duration": { - "value": 8760, + "value": 8760.0, "unit": "hours" }, "avg_power": { @@ -302,11 +294,11 @@ Response : ] }, "time_workload": { - "value": 50, + "value": 50.0, "status": "ARCHETYPE", "unit": "%", - "min": 0, - "max": 100 + "min": 0.0, + "max": 100.0 }, "usage_location": { "value": "EEE", @@ -314,29 +306,29 @@ Response : "unit": "CodSP3 - NCS Country Codes - NATO" }, "use_time_ratio": { - "value": 1, + "value": 1.0, "status": "ARCHETYPE", "unit": "/1", - "min": 1, - "max": 1 + "min": 1.0, + "max": 1.0 }, "hours_life_time": { - "value": 35040, + "value": 35040.0, "status": "COMPLETED", "unit": "hours", "source": "from device", - "min": 35040, - "max": 35040 + "min": 35040.0, + "max": 35040.0 }, "workloads": { "value": [ { "load_percentage": 0, - "power_watt": 18 + "power_watt": 18.0 }, { "load_percentage": 10, - "power_watt": 48 + "power_watt": 48.0 }, { "load_percentage": 50, @@ -344,7 +336,7 @@ Response : }, { "load_percentage": 100, - "power_watt": 153 + "power_watt": 153.0 } ], "status": "COMPLETED", @@ -419,17 +411,17 @@ Response : } }, "units": { - "value": 16, + "value": 16.0, "status": "ARCHETYPE", - "min": 16, - "max": 16 + "min": 16.0, + "max": 16.0 }, "capacity": { - "value": 32, + "value": 32.0, "status": "ARCHETYPE", "unit": "GB", - "min": 32, - "max": 32 + "min": 32.0, + "max": 32.0 }, "density": { "value": 1.2443636363636363, @@ -440,7 +432,7 @@ Response : "max": 2.375 }, "duration": { - "value": 8760, + "value": 8760.0, "unit": "hours" }, "avg_power": { @@ -454,11 +446,11 @@ Response : ] }, "time_workload": { - "value": 50, + "value": 50.0, "status": "ARCHETYPE", "unit": "%", - "min": 0, - "max": 100 + "min": 0.0, + "max": 100.0 }, "usage_location": { "value": "EEE", @@ -466,19 +458,19 @@ Response : "unit": "CodSP3 - NCS Country Codes - NATO" }, "use_time_ratio": { - "value": 1, + "value": 1.0, "status": "ARCHETYPE", "unit": "/1", - "min": 1, - "max": 1 + "min": 1.0, + "max": 1.0 }, "hours_life_time": { - "value": 35040, + "value": 35040.0, "status": "COMPLETED", "unit": "hours", "source": "from device", - "min": 35040, - "max": 35040 + "min": 35040.0, + "max": 35040.0 }, "params": { "value": { @@ -508,10 +500,10 @@ Response : "impacts": { "gwp": { "embedded": { - "value": 0, + "value": 0.0, "significant_figures": 5, - "min": 0, - "max": 0, + "min": 0.0, + "max": 0.0, "warnings": [ "End of life is not included in the calculation" ] @@ -522,10 +514,10 @@ Response : }, "adp": { "embedded": { - "value": 0, + "value": 0.0, "significant_figures": 5, - "min": 0, - "max": 0, + "min": 0.0, + "max": 0.0, "warnings": [ "End of life is not included in the calculation" ] @@ -536,17 +528,17 @@ Response : } }, "units": { - "value": 0, + "value": 0.0, "status": "ARCHETYPE", - "min": 0, - "max": 0 + "min": 0.0, + "max": 0.0 }, "capacity": { - "value": 0, + "value": 0.0, "status": "ARCHETYPE", "unit": "GB", - "min": 0, - "max": 0 + "min": 0.0, + "max": 0.0 }, "density": { "value": 54.8842105263158, @@ -554,10 +546,10 @@ Response : "unit": "GB/cm2", "source": "Average of 19 rows", "min": 16.4, - "max": 128 + "max": 128.0 }, "duration": { - "value": 8760, + "value": 8760.0, "unit": "hours" } }, @@ -593,20 +585,20 @@ Response : } }, "units": { - "value": 2, + "value": 2.0, "status": "ARCHETYPE", - "min": 2, - "max": 2 + "min": 2.0, + "max": 2.0 }, "unit_weight": { "value": 2.99, "status": "ARCHETYPE", "unit": "kg", - "min": 1, - "max": 5 + "min": 1.0, + "max": 5.0 }, "duration": { - "value": 8760, + "value": 8760.0, "unit": "hours" } }, @@ -652,7 +644,7 @@ Response : "status": "ARCHETYPE" }, "duration": { - "value": 8760, + "value": 8760.0, "unit": "hours" } }, @@ -694,7 +686,7 @@ Response : "max": 1 }, "duration": { - "value": 8760, + "value": 8760.0, "unit": "hours" } }, @@ -711,18 +703,18 @@ Response : "unit": "CodSP3 - NCS Country Codes - NATO" }, "use_time_ratio": { - "value": 1, + "value": 1.0, "status": "ARCHETYPE", "unit": "/1", - "min": 1, - "max": 1 + "min": 1.0, + "max": 1.0 }, "hours_life_time": { - "value": 35040, + "value": 35040.0, "status": "ARCHETYPE", "unit": "hours", - "min": 35040, - "max": 35040 + "min": 35040.0, + "max": 35040.0 }, "other_consumption_ratio": { "value": 0.33, @@ -732,7 +724,7 @@ Response : "max": 0.6 }, "instance_per_server": { - "value": 64, + "value": 64.0, "status": "ARCHETYPE" }, "gwp_factor": { @@ -758,7 +750,7 @@ Response : "max": 1 } } -} +}( ``` ## Get the impacts of a cloud instance with custom usage data diff --git a/docs/docs/getting_started/single_server.md b/docs/docs/getting_started/single_server.md index dd2ae978..a42afd1e 100644 --- a/docs/docs/getting_started/single_server.md +++ b/docs/docs/getting_started/single_server.md @@ -114,10 +114,10 @@ It will return: "impacts": { "gwp": { "embedded": { - "value": 661.28, + "value": 625.51, "significant_figures": 5, - "min": 256.4, - "max": 1980.9, + "min": 252.18, + "max": 2010.6, "warnings": [ "End of life is not included in the calculation" ] @@ -126,7 +126,7 @@ It will return: "value": 6937.1, "significant_figures": 5, "min": 193.81, - "max": 48551 + "max": 48551.0 }, "unit": "kgCO2eq", "description": "Total climate change" @@ -134,7 +134,7 @@ It will return: }, "verbose": { "duration": { - "value": 35040, + "value": 35040.0, "unit": "hours" }, "ASSEMBLY-1": { @@ -161,7 +161,7 @@ It will return: "max": 1 }, "duration": { - "value": 35040, + "value": 35040.0, "unit": "hours" } }, @@ -169,10 +169,10 @@ It will return: "impacts": { "gwp": { "embedded": { - "value": 65.757, + "value": 29.986, "significant_figures": 5, - "min": 14.835, - "max": 297.63, + "min": 10.619, + "max": 327.26, "warnings": [ "End of life is not included in the calculation" ] @@ -181,34 +181,28 @@ It will return: "value": 4852.9, "significant_figures": 5, "min": 146.86, - "max": 28903 + "max": 28903.0 }, "unit": "kgCO2eq", "description": "Total climate change" } }, "units": { - "value": 2, + "value": 2.0, "status": "ARCHETYPE", - "min": 1, - "max": 4 - }, - "core_units": { - "value": 24, - "status": "ARCHETYPE", - "min": 16, - "max": 32 + "min": 1.0, + "max": 4.0 }, - "die_size_per_core": { - "value": 0.48162162162162164, + "die_size": { + "value": 2.48, "status": "COMPLETED", "unit": "cm2", - "source": "Average for all families", - "min": 0.15, - "max": 1.02 + "source": "Average value for all families", + "min": 0.26, + "max": 36.4 }, "duration": { - "value": 35040, + "value": 35040.0, "unit": "hours" }, "avg_power": { @@ -222,11 +216,11 @@ It will return: ] }, "time_workload": { - "value": 50, + "value": 50.0, "status": "ARCHETYPE", "unit": "%", - "min": 0, - "max": 100 + "min": 0.0, + "max": 100.0 }, "usage_location": { "value": "EEE", @@ -234,19 +228,19 @@ It will return: "unit": "CodSP3 - NCS Country Codes - NATO" }, "use_time_ratio": { - "value": 1, + "value": 1.0, "status": "ARCHETYPE", "unit": "/1", - "min": 1, - "max": 1 + "min": 1.0, + "max": 1.0 }, "hours_life_time": { - "value": 35040, + "value": 35040.0, "status": "COMPLETED", "unit": "hours", "source": "from device", - "min": 35040, - "max": 35040 + "min": 35040.0, + "max": 35040.0 }, "params": { "value": { @@ -289,17 +283,17 @@ It will return: } }, "units": { - "value": 6, + "value": 6.0, "status": "ARCHETYPE", - "min": 4, - "max": 8 + "min": 4.0, + "max": 8.0 }, "capacity": { - "value": 16, + "value": 16.0, "status": "ARCHETYPE", "unit": "GB", - "min": 8, - "max": 32 + "min": 8.0, + "max": 32.0 }, "density": { "value": 1.2443636363636363, @@ -310,7 +304,7 @@ It will return: "max": 2.375 }, "duration": { - "value": 35040, + "value": 35040.0, "unit": "hours" }, "avg_power": { @@ -324,11 +318,11 @@ It will return: ] }, "time_workload": { - "value": 50, + "value": 50.0, "status": "ARCHETYPE", "unit": "%", - "min": 0, - "max": 100 + "min": 0.0, + "max": 100.0 }, "usage_location": { "value": "EEE", @@ -336,19 +330,19 @@ It will return: "unit": "CodSP3 - NCS Country Codes - NATO" }, "use_time_ratio": { - "value": 1, + "value": 1.0, "status": "ARCHETYPE", "unit": "/1", - "min": 1, - "max": 1 + "min": 1.0, + "max": 1.0 }, "hours_life_time": { - "value": 35040, + "value": 35040.0, "status": "COMPLETED", "unit": "hours", "source": "from device", - "min": 35040, - "max": 35040 + "min": 35040.0, + "max": 35040.0 }, "params": { "value": { @@ -390,11 +384,11 @@ It will return: "max": 1 }, "capacity": { - "value": 500, + "value": 500.0, "status": "ARCHETYPE", "unit": "GB", - "min": 100, - "max": 2000 + "min": 100.0, + "max": 2000.0 }, "density": { "value": 54.8842105263158, @@ -402,10 +396,10 @@ It will return: "unit": "GB/cm2", "source": "Average of 19 rows", "min": 16.4, - "max": 128 + "max": 128.0 }, "duration": { - "value": 35040, + "value": 35040.0, "unit": "hours" } }, @@ -416,7 +410,7 @@ It will return: "value": 145.31, "significant_figures": 5, "min": 24.3, - "max": 243, + "max": 243.0, "warnings": [ "End of life is not included in the calculation" ] @@ -427,20 +421,20 @@ It will return: } }, "units": { - "value": 2, + "value": 2.0, "status": "ARCHETYPE", - "min": 1, - "max": 2 + "min": 1.0, + "max": 2.0 }, "unit_weight": { "value": 2.99, "status": "ARCHETYPE", "unit": "kg", - "min": 1, - "max": 5 + "min": 1.0, + "max": 5.0 }, "duration": { - "value": 35040, + "value": 35040.0, "unit": "hours" } }, @@ -448,10 +442,10 @@ It will return: "impacts": { "gwp": { "embedded": { - "value": 150, + "value": 150.0, "significant_figures": 5, "min": 85.9, - "max": 150, + "max": 150.0, "warnings": [ "End of life is not included in the calculation" ] @@ -472,7 +466,7 @@ It will return: "status": "ARCHETYPE" }, "duration": { - "value": 35040, + "value": 35040.0, "unit": "hours" } }, @@ -500,7 +494,7 @@ It will return: "max": 1 }, "duration": { - "value": 35040, + "value": 35040.0, "unit": "hours" } }, @@ -517,18 +511,18 @@ It will return: "unit": "CodSP3 - NCS Country Codes - NATO" }, "use_time_ratio": { - "value": 1, + "value": 1.0, "status": "ARCHETYPE", "unit": "/1", - "min": 1, - "max": 1 + "min": 1.0, + "max": 1.0 }, "hours_life_time": { - "value": 35040, + "value": 35040.0, "status": "ARCHETYPE", "unit": "hours", - "min": 35040, - "max": 35040 + "min": 35040.0, + "max": 35040.0 }, "other_consumption_ratio": { "value": 0.33, diff --git a/tests/api/test_cloud.py b/tests/api/test_cloud.py index 78693795..4fdd5d29 100644 --- a/tests/api/test_cloud.py +++ b/tests/api/test_cloud.py @@ -28,10 +28,10 @@ async def test_empty_usage(): 'significant_figures': 3, 'value': 0.000155}}, 'gwp': {'description': 'Total climate change', - 'embedded': {'max': 630.0, + 'embedded': {'max': 600.0, 'min': 260.0, 'significant_figures': 2, - 'value': 460.0, + 'value': 450.0, 'warnings': ['End of life is not included in the ' 'calculation']}, 'unit': 'kgCO2eq', @@ -40,10 +40,10 @@ async def test_empty_usage(): 'significant_figures': 2, 'value': 920.0}}, 'pe': {'description': 'Consumption of primary energy', - 'embedded': {'max': 8800.0, + 'embedded': {'max': 8400.0, 'min': 3600.0, 'significant_figures': 2, - 'value': 6400.0, + 'value': 6300.0, 'warnings': ['End of life is not included in the ' 'calculation']}, 'unit': 'MJ', @@ -118,10 +118,10 @@ async def test_empty_usage_1(): 'significant_figures': 3, 'value': 7.77e-05}}, 'gwp': {'description': 'Total climate change', - 'embedded': {'max': 630.0, + 'embedded': {'max': 600.0, 'min': 260.0, 'significant_figures': 2, - 'value': 230.0, + 'value': 220.0, 'warnings': ['End of life is not included in the ' 'calculation']}, 'unit': 'kgCO2eq', @@ -130,10 +130,10 @@ async def test_empty_usage_1(): 'significant_figures': 2, 'value': 460.0}}, 'pe': {'description': 'Consumption of primary energy', - 'embedded': {'max': 8800.0, + 'embedded': {'max': 8400.0, 'min': 3600.0, 'significant_figures': 2, - 'value': 3200.0, + 'value': 3100.0, 'warnings': ['End of life is not included in the ' 'calculation']}, 'unit': 'MJ', @@ -160,10 +160,10 @@ async def test_empty_usage_2(): 'significant_figures': 3, 'value': 0.000774}}, 'gwp': {'description': 'Total climate change', - 'embedded': {'max': 3500.0, + 'embedded': {'max': 3400.0, 'min': 1200.0, 'significant_figures': 2, - 'value': 1000.0, + 'value': 990.0, 'warnings': ['End of life is not included in the ' 'calculation']}, 'unit': 'kgCO2eq', @@ -172,7 +172,7 @@ async def test_empty_usage_2(): 'significant_figures': 2, 'value': 4600.0}}, 'pe': {'description': 'Consumption of primary energy', - 'embedded': {'max': 45000.0, + 'embedded': {'max': 44000.0, 'min': 15000.0, 'significant_figures': 2, 'value': 13000.0, @@ -243,10 +243,10 @@ async def test_usage_1(): 'significant_figures': 3, 'value': 0.000598}}, 'gwp': {'description': 'Total climate change', - 'embedded': {'max': 1300.0, - 'min': 470.0, + 'embedded': {'max': 1200.0, + 'min': 460.0, 'significant_figures': 2, - 'value': 830.0, + 'value': 780.0, 'warnings': ['End of life is not included in the ' 'calculation']}, 'unit': 'kgCO2eq', @@ -255,10 +255,10 @@ async def test_usage_1(): 'significant_figures': 2, 'value': 3500.0}}, 'pe': {'description': 'Consumption of primary energy', - 'embedded': {'max': 17000.0, - 'min': 6300.0, + 'embedded': {'max': 16000.0, + 'min': 6100.0, 'significant_figures': 2, - 'value': 11000.0, + 'value': 10000.0, 'warnings': ['End of life is not included in the ' 'calculation']}, 'unit': 'MJ', @@ -290,10 +290,10 @@ async def test_usage_2(): 'significant_figures': 3, 'value': 0.00102}}, 'gwp': {'description': 'Total climate change', - 'embedded': {'max': 1300.0, - 'min': 470.0, + 'embedded': {'max': 1200.0, + 'min': 460.0, 'significant_figures': 2, - 'value': 830.0, + 'value': 780.0, 'warnings': ['End of life is not included in the ' 'calculation']}, 'unit': 'kgCO2eq', @@ -302,10 +302,10 @@ async def test_usage_2(): 'significant_figures': 2, 'value': 6000.0}}, 'pe': {'description': 'Consumption of primary energy', - 'embedded': {'max': 17000.0, - 'min': 6300.0, + 'embedded': {'max': 16000.0, + 'min': 6100.0, 'significant_figures': 2, - 'value': 11000.0, + 'value': 10000.0, 'warnings': ['End of life is not included in the ' 'calculation']}, 'unit': 'MJ', @@ -336,10 +336,10 @@ async def test_usage_3(): 'significant_figures': 3, 'value': 2.25e-08}}, 'gwp': {'description': 'Total climate change', - 'embedded': {'max': 0.037, + 'embedded': {'max': 0.035, 'min': 0.013, 'significant_figures': 2, - 'value': 0.024, + 'value': 0.022, 'warnings': ['End of life is not included in the ' 'calculation']}, 'unit': 'kgCO2eq', @@ -348,10 +348,10 @@ async def test_usage_3(): 'significant_figures': 2, 'value': 0.13}}, 'pe': {'description': 'Consumption of primary energy', - 'embedded': {'max': 0.5, - 'min': 0.18, + 'embedded': {'max': 0.46, + 'min': 0.17, 'significant_figures': 2, - 'value': 0.32, + 'value': 0.3, 'warnings': ['End of life is not included in the ' 'calculation']}, 'unit': 'MJ', @@ -394,7 +394,7 @@ async def test_usage(): 'significant_figures': 6, 'value': 3.41354e-09}}, 'gwp': {'description': 'Total climate change', - 'embedded': {'max': 0.036, + 'embedded': {'max': 0.034, 'min': 0.015, 'significant_figures': 2, 'value': 0.026, @@ -406,14 +406,14 @@ async def test_usage(): 'significant_figures': 2, 'value': 0.0069}}, 'pe': {'description': 'Consumption of primary energy', - 'embedded': {'max': 0.5, + 'embedded': {'max': 0.48, 'min': 0.2, 'significant_figures': 2, - 'value': 0.37, + 'value': 0.36, 'warnings': ['End of life is not included in the ' 'calculation']}, 'unit': 'MJ', 'use': {'max': 1.0139, 'min': 0.7157, 'significant_figures': 5, - 'value': 0.79324}}} + 'value': 0.79324}}} \ No newline at end of file diff --git a/tests/api/test_component.py b/tests/api/test_component.py index b2f93264..ecafa7ee 100644 --- a/tests/api/test_component.py +++ b/tests/api/test_component.py @@ -55,139 +55,145 @@ async def test_complete_cpu_verbose(): res = await ac.post('/v1/component/cpu?verbose=true', json={"core_units": 12, "die_size_per_core": 0.245}) assert res.json() == {'impacts': {'adp': {'description': 'Use of minerals and fossil ressources', - 'embedded': {'max': 0.02, - 'min': 0.02, - 'significant_figures': 2, - 'value': 0.02, - 'warnings': ['End of life is not included in ' - 'the calculation']}, - 'unit': 'kgSbeq', - 'use': {'max': 0.0013, - 'min': 6.3e-05, - 'significant_figures': 2, - 'value': 0.00031}}, - 'gwp': {'description': 'Total climate change', - 'embedded': {'max': 15.9, - 'min': 15.9, - 'significant_figures': 3, - 'value': 15.9, - 'warnings': ['End of life is not included in ' - 'the calculation']}, - 'unit': 'kgCO2eq', - 'use': {'max': 4300.0, - 'min': 110.0, - 'significant_figures': 2, - 'value': 1800.0}}, - 'pe': {'description': 'Consumption of primary energy', - 'embedded': {'max': 247.0, - 'min': 247.0, - 'significant_figures': 3, - 'value': 247.0, - 'warnings': ['End of life is not included in ' - 'the calculation']}, - 'unit': 'MJ', - 'use': {'max': 2200000.0, - 'min': 62.0, - 'significant_figures': 2, - 'value': 62000.0}}}, - 'verbose': {'adp_factor': {'max': 2.656e-07, - 'min': 1.32e-08, - 'source': 'ADEME Base IMPACTS ®', - 'status': 'DEFAULT', - 'unit': 'kg Sbeq/kWh', - 'value': 6.42e-08}, - 'avg_power': {'max': 182.22, - 'min': 182.22, - 'status': 'COMPLETED', - 'unit': 'W', - 'value': 182.22}, - 'core_units': {'status': 'INPUT', 'value': 12}, - 'die_size_per_core': {'status': 'INPUT', - 'unit': 'cm2', - 'value': 0.245}, - 'duration': {'unit': 'hours', 'value': 26280.0}, - 'gwp_factor': {'max': 0.9, - 'min': 0.023, - 'source': 'https://www.sciencedirect.com/science/article/pii/S0306261921012149: \n' - 'Average of 27 european countries', - 'status': 'DEFAULT', - 'unit': 'kg CO2eq/kWh', - 'value': 0.38}, - 'hours_life_time': {'max': 26280.0, - 'min': 26280.0, - 'status': 'ARCHETYPE', - 'unit': 'hours', - 'value': 26280.0}, - 'impacts': {'adp': {'description': 'Use of minerals and fossil ' - 'ressources', - 'embedded': {'max': 0.02, - 'min': 0.02, - 'significant_figures': 2, - 'value': 0.02, - 'warnings': ['End of life is not ' - 'included in the ' - 'calculation']}, - 'unit': 'kgSbeq', - 'use': {'max': 0.0013, - 'min': 6.3e-05, - 'significant_figures': 2, - 'value': 0.00031}}, - 'gwp': {'description': 'Total climate change', - 'embedded': {'max': 15.9, - 'min': 15.9, - 'significant_figures': 3, - 'value': 15.9, - 'warnings': ['End of life is not ' - 'included in the ' - 'calculation']}, - 'unit': 'kgCO2eq', - 'use': {'max': 4300.0, - 'min': 110.0, - 'significant_figures': 2, - 'value': 1800.0}}, - 'pe': {'description': 'Consumption of primary energy', - 'embedded': {'max': 247.0, - 'min': 247.0, - 'significant_figures': 3, - 'value': 247.0, - 'warnings': ['End of life is not ' - 'included in the ' - 'calculation']}, - 'unit': 'MJ', - 'use': {'max': 2200000.0, - 'min': 62.0, - 'significant_figures': 2, - 'value': 62000.0}}}, - 'model_range': {'status': 'ARCHETYPE', 'value': 'Xeon Platinum'}, - 'params': {'source': 'From CPU model range', - 'status': 'COMPLETED', - 'value': {'a': 171.1813, - 'b': 0.0354, - 'c': 36.8953, - 'd': -10.1336}}, - 'pe_factor': {'max': 468.15, - 'min': 0.013, - 'source': 'ADPf / (1-%renewable_energy)', - 'status': 'DEFAULT', - 'unit': 'MJ/kWh', - 'value': 12.874}, - 'time_workload': {'max': 100.0, - 'min': 0.0, - 'status': 'ARCHETYPE', - 'unit': '%', - 'value': 50.0}, - 'units': {'max': 1.0, - 'min': 1.0, - 'status': 'ARCHETYPE', - 'value': 1.0}, - 'usage_location': {'status': 'DEFAULT', - 'unit': 'CodSP3 - NCS Country Codes - NATO', - 'value': 'EEE'}, - 'use_time_ratio': {'max': 1.0, - 'min': 1.0, - 'status': 'ARCHETYPE', - 'unit': '/1', - 'value': 1.0}}} + 'embedded': {'max': 0.02, + 'min': 0.02, + 'significant_figures': 2, + 'value': 0.02, + 'warnings': ['End of life is not included in ' + 'the calculation']}, + 'unit': 'kgSbeq', + 'use': {'max': 0.0013, + 'min': 6.3e-05, + 'significant_figures': 2, + 'value': 0.00031}}, + 'gwp': {'description': 'Total climate change', + 'embedded': {'max': 15.9, + 'min': 15.9, + 'significant_figures': 3, + 'value': 15.9, + 'warnings': ['End of life is not included in ' + 'the calculation']}, + 'unit': 'kgCO2eq', + 'use': {'max': 4300.0, + 'min': 110.0, + 'significant_figures': 2, + 'value': 1800.0}}, + 'pe': {'description': 'Consumption of primary energy', + 'embedded': {'max': 247.0, + 'min': 247.0, + 'significant_figures': 3, + 'value': 247.0, + 'warnings': ['End of life is not included in ' + 'the calculation']}, + 'unit': 'MJ', + 'use': {'max': 2200000.0, + 'min': 62.0, + 'significant_figures': 2, + 'value': 62000.0}}}, + 'verbose': {'adp_factor': {'max': 2.656e-07, + 'min': 1.32e-08, + 'source': 'ADEME Base IMPACTS ®', + 'status': 'DEFAULT', + 'unit': 'kg Sbeq/kWh', + 'value': 6.42e-08}, + 'avg_power': {'max': 182.22, + 'min': 182.22, + 'status': 'COMPLETED', + 'unit': 'W', + 'value': 182.22}, + 'core_units': {'status': 'INPUT', 'value': 12}, + 'die_size': {'max': 2.94, + 'min': 2.94, + 'source': 'die_size_per_core*core_units', + 'status': 'COMPLETED', + 'unit': 'cm2', + 'value': 2.94}, + 'die_size_per_core': {'status': 'INPUT', + 'unit': 'cm2', + 'value': 0.245}, + 'duration': {'unit': 'hours', 'value': 26280.0}, + 'gwp_factor': {'max': 0.9, + 'min': 0.023, + 'source': 'https://www.sciencedirect.com/science/article/pii/S0306261921012149: \n' + 'Average of 27 european countries', + 'status': 'DEFAULT', + 'unit': 'kg CO2eq/kWh', + 'value': 0.38}, + 'hours_life_time': {'max': 26280.0, + 'min': 26280.0, + 'status': 'ARCHETYPE', + 'unit': 'hours', + 'value': 26280.0}, + 'impacts': {'adp': {'description': 'Use of minerals and fossil ' + 'ressources', + 'embedded': {'max': 0.02, + 'min': 0.02, + 'significant_figures': 2, + 'value': 0.02, + 'warnings': ['End of life is not ' + 'included in the ' + 'calculation']}, + 'unit': 'kgSbeq', + 'use': {'max': 0.0013, + 'min': 6.3e-05, + 'significant_figures': 2, + 'value': 0.00031}}, + 'gwp': {'description': 'Total climate change', + 'embedded': {'max': 15.9, + 'min': 15.9, + 'significant_figures': 3, + 'value': 15.9, + 'warnings': ['End of life is not ' + 'included in the ' + 'calculation']}, + 'unit': 'kgCO2eq', + 'use': {'max': 4300.0, + 'min': 110.0, + 'significant_figures': 2, + 'value': 1800.0}}, + 'pe': {'description': 'Consumption of primary energy', + 'embedded': {'max': 247.0, + 'min': 247.0, + 'significant_figures': 3, + 'value': 247.0, + 'warnings': ['End of life is not ' + 'included in the ' + 'calculation']}, + 'unit': 'MJ', + 'use': {'max': 2200000.0, + 'min': 62.0, + 'significant_figures': 2, + 'value': 62000.0}}}, + 'model_range': {'status': 'ARCHETYPE', 'value': 'Xeon Platinum'}, + 'params': {'source': 'From CPU model range', + 'status': 'COMPLETED', + 'value': {'a': 171.1813, + 'b': 0.0354, + 'c': 36.8953, + 'd': -10.1336}}, + 'pe_factor': {'max': 468.15, + 'min': 0.013, + 'source': 'ADPf / (1-%renewable_energy)', + 'status': 'DEFAULT', + 'unit': 'MJ/kWh', + 'value': 12.874}, + 'time_workload': {'max': 100.0, + 'min': 0.0, + 'status': 'ARCHETYPE', + 'unit': '%', + 'value': 50.0}, + 'units': {'max': 1.0, + 'min': 1.0, + 'status': 'ARCHETYPE', + 'value': 1.0}, + 'usage_location': {'status': 'DEFAULT', + 'unit': 'CodSP3 - NCS Country Codes - NATO', + 'value': 'EEE'}, + 'use_time_ratio': {'max': 1.0, + 'min': 1.0, + 'status': 'ARCHETYPE', + 'unit': '/1', + 'value': 1.0}}} @pytest.mark.asyncio @@ -239,41 +245,41 @@ async def test_empty_cpu(): res = await ac.post('/v1/component/cpu?verbose=false', json={}) assert res.json() == {'adp': {'description': 'Use of minerals and fossil ressources', - 'embedded': {'max': 0.02, - 'min': 0.02, - 'significant_figures': 2, - 'value': 0.02, - 'warnings': ['End of life is not included in the ' - 'calculation']}, - 'unit': 'kgSbeq', - 'use': {'max': 0.0013, - 'min': 6.3e-05, - 'significant_figures': 2, - 'value': 0.00031}}, - 'gwp': {'description': 'Total climate change', - 'embedded': {'max': 22.7, - 'min': 11.1, - 'significant_figures': 3, - 'value': 21.7, - 'warnings': ['End of life is not included in the ' - 'calculation']}, - 'unit': 'kgCO2eq', - 'use': {'max': 4300.0, - 'min': 110.0, - 'significant_figures': 2, - 'value': 1800.0}}, - 'pe': {'description': 'Consumption of primary energy', - 'embedded': {'max': 339.0, - 'min': 182.0, - 'significant_figures': 3, - 'value': 325.0, - 'warnings': ['End of life is not included in the ' - 'calculation']}, - 'unit': 'MJ', - 'use': {'max': 2200000.0, - 'min': 62.0, - 'significant_figures': 2, - 'value': 62000.0}}} + 'embedded': {'max': 0.02, + 'min': 0.02, + 'significant_figures': 2, + 'value': 0.02, + 'warnings': ['End of life is not included in the ' + 'calculation']}, + 'unit': 'kgSbeq', + 'use': {'max': 0.0013, + 'min': 6.3e-05, + 'significant_figures': 2, + 'value': 0.00031}}, + 'gwp': {'description': 'Total climate change', + 'embedded': {'max': 81.8, + 'min': 10.6, + 'significant_figures': 3, + 'value': 15.0, + 'warnings': ['End of life is not included in the ' + 'calculation']}, + 'unit': 'kgCO2eq', + 'use': {'max': 4300.0, + 'min': 110.0, + 'significant_figures': 2, + 'value': 1800.0}}, + 'pe': {'description': 'Consumption of primary energy', + 'embedded': {'max': 1130.0, + 'min': 176.0, + 'significant_figures': 3, + 'value': 235.0, + 'warnings': ['End of life is not included in the ' + 'calculation']}, + 'unit': 'MJ', + 'use': {'max': 2200000.0, + 'min': 62.0, + 'significant_figures': 2, + 'value': 62000.0}}} @pytest.mark.asyncio @@ -327,143 +333,143 @@ async def test_incomplete_cpu_verbose(): "core_units": 24, "family": "Skylake"}) assert res.json() == {'impacts': {'adp': {'description': 'Use of minerals and fossil ressources', - 'embedded': {'max': 0.02, - 'min': 0.02, - 'significant_figures': 2, - 'value': 0.02, - 'warnings': ['End of life is not included in ' - 'the calculation']}, - 'unit': 'kgSbeq', - 'use': {'max': 0.0013, - 'min': 6.3e-05, - 'significant_figures': 2, - 'value': 0.00031}}, - 'gwp': {'description': 'Total climate change', - 'embedded': {'max': 23.0, - 'min': 22.0, - 'significant_figures': 2, - 'value': 22.0, - 'warnings': ['End of life is not included in ' - 'the calculation']}, - 'unit': 'kgCO2eq', - 'use': {'max': 4300.0, - 'min': 110.0, - 'significant_figures': 2, - 'value': 1800.0}}, - 'pe': {'description': 'Consumption of primary energy', - 'embedded': {'max': 340.0, - 'min': 330.0, - 'significant_figures': 2, - 'value': 330.0, - 'warnings': ['End of life is not included in ' - 'the calculation']}, - 'unit': 'MJ', - 'use': {'max': 2200000.0, - 'min': 62.0, - 'significant_figures': 2, - 'value': 62000.0}}}, - 'verbose': {'adp_factor': {'max': 2.656e-07, - 'min': 1.32e-08, - 'source': 'ADEME Base IMPACTS ®', - 'status': 'DEFAULT', - 'unit': 'kg Sbeq/kWh', - 'value': 6.42e-08}, - 'avg_power': {'max': 182.22, - 'min': 182.22, - 'status': 'COMPLETED', - 'unit': 'W', - 'value': 182.22}, - 'core_units': {'status': 'INPUT', 'value': 24}, - 'die_size_per_core': {'max': 0.27, - 'min': 0.25, - 'source': 'https://en.wikichip.org/wiki/intel/microarchitectures/skylake_(server)#Extreme_Core_Count_.28XCC.29', - 'status': 'COMPLETED', - 'unit': 'cm2', - 'value': 0.25}, - 'duration': {'unit': 'hours', 'value': 26280.0}, - 'family': {'status': 'CHANGED', 'value': 'skylake'}, - 'gwp_factor': {'max': 0.9, - 'min': 0.023, - 'source': 'https://www.sciencedirect.com/science/article/pii/S0306261921012149: \n' - 'Average of 27 european countries', - 'status': 'DEFAULT', - 'unit': 'kg CO2eq/kWh', - 'value': 0.38}, - 'hours_life_time': {'max': 26280.0, - 'min': 26280.0, - 'status': 'ARCHETYPE', - 'unit': 'hours', - 'value': 26280.0}, - 'impacts': {'adp': {'description': 'Use of minerals and fossil ' - 'ressources', - 'embedded': {'max': 0.02, - 'min': 0.02, - 'significant_figures': 2, - 'value': 0.02, - 'warnings': ['End of life is not ' - 'included in the ' - 'calculation']}, - 'unit': 'kgSbeq', - 'use': {'max': 0.0013, - 'min': 6.3e-05, - 'significant_figures': 2, - 'value': 0.00031}}, - 'gwp': {'description': 'Total climate change', - 'embedded': {'max': 23.0, - 'min': 22.0, - 'significant_figures': 2, - 'value': 22.0, - 'warnings': ['End of life is not ' - 'included in the ' - 'calculation']}, - 'unit': 'kgCO2eq', - 'use': {'max': 4300.0, - 'min': 110.0, - 'significant_figures': 2, - 'value': 1800.0}}, - 'pe': {'description': 'Consumption of primary energy', - 'embedded': {'max': 340.0, - 'min': 330.0, - 'significant_figures': 2, - 'value': 330.0, - 'warnings': ['End of life is not ' - 'included in the ' - 'calculation']}, - 'unit': 'MJ', - 'use': {'max': 2200000.0, - 'min': 62.0, - 'significant_figures': 2, - 'value': 62000.0}}}, - 'model_range': {'status': 'ARCHETYPE', 'value': 'Xeon Platinum'}, - 'params': {'source': 'From CPU model range', - 'status': 'COMPLETED', - 'value': {'a': 171.1813, - 'b': 0.0354, - 'c': 36.8953, - 'd': -10.1336}}, - 'pe_factor': {'max': 468.15, - 'min': 0.013, - 'source': 'ADPf / (1-%renewable_energy)', - 'status': 'DEFAULT', - 'unit': 'MJ/kWh', - 'value': 12.874}, - 'time_workload': {'max': 100.0, - 'min': 0.0, - 'status': 'ARCHETYPE', - 'unit': '%', - 'value': 50.0}, - 'units': {'max': 1.0, - 'min': 1.0, - 'status': 'ARCHETYPE', - 'value': 1.0}, - 'usage_location': {'status': 'DEFAULT', - 'unit': 'CodSP3 - NCS Country Codes - NATO', - 'value': 'EEE'}, - 'use_time_ratio': {'max': 1.0, - 'min': 1.0, - 'status': 'ARCHETYPE', - 'unit': '/1', - 'value': 1.0}}} + 'embedded': {'max': 0.02, + 'min': 0.02, + 'significant_figures': 2, + 'value': 0.02, + 'warnings': ['End of life is not included in ' + 'the calculation']}, + 'unit': 'kgSbeq', + 'use': {'max': 0.0013, + 'min': 6.3e-05, + 'significant_figures': 2, + 'value': 0.00031}}, + 'gwp': {'description': 'Total climate change', + 'embedded': {'max': 18.9, + 'min': 18.9, + 'significant_figures': 3, + 'value': 18.9, + 'warnings': ['End of life is not included in ' + 'the calculation']}, + 'unit': 'kgCO2eq', + 'use': {'max': 4300.0, + 'min': 110.0, + 'significant_figures': 2, + 'value': 1800.0}}, + 'pe': {'description': 'Consumption of primary energy', + 'embedded': {'max': 287.0, + 'min': 287.0, + 'significant_figures': 3, + 'value': 287.0, + 'warnings': ['End of life is not included in ' + 'the calculation']}, + 'unit': 'MJ', + 'use': {'max': 2200000.0, + 'min': 62.0, + 'significant_figures': 2, + 'value': 62000.0}}}, + 'verbose': {'adp_factor': {'max': 2.656e-07, + 'min': 1.32e-08, + 'source': 'ADEME Base IMPACTS ®', + 'status': 'DEFAULT', + 'unit': 'kg Sbeq/kWh', + 'value': 6.42e-08}, + 'avg_power': {'max': 182.22, + 'min': 182.22, + 'status': 'COMPLETED', + 'unit': 'W', + 'value': 182.22}, + 'core_units': {'status': 'INPUT', 'value': 24}, + 'die_size': {'max': 4.47, + 'min': 4.47, + 'source': 'Linear regression on Skylake', + 'status': 'COMPLETED', + 'unit': 'cm2', + 'value': 4.47}, + 'duration': {'unit': 'hours', 'value': 26280.0}, + 'family': {'status': 'INPUT', 'value': 'Skylake'}, + 'gwp_factor': {'max': 0.9, + 'min': 0.023, + 'source': 'https://www.sciencedirect.com/science/article/pii/S0306261921012149: \n' + 'Average of 27 european countries', + 'status': 'DEFAULT', + 'unit': 'kg CO2eq/kWh', + 'value': 0.38}, + 'hours_life_time': {'max': 26280.0, + 'min': 26280.0, + 'status': 'ARCHETYPE', + 'unit': 'hours', + 'value': 26280.0}, + 'impacts': {'adp': {'description': 'Use of minerals and fossil ' + 'ressources', + 'embedded': {'max': 0.02, + 'min': 0.02, + 'significant_figures': 2, + 'value': 0.02, + 'warnings': ['End of life is not ' + 'included in the ' + 'calculation']}, + 'unit': 'kgSbeq', + 'use': {'max': 0.0013, + 'min': 6.3e-05, + 'significant_figures': 2, + 'value': 0.00031}}, + 'gwp': {'description': 'Total climate change', + 'embedded': {'max': 18.9, + 'min': 18.9, + 'significant_figures': 3, + 'value': 18.9, + 'warnings': ['End of life is not ' + 'included in the ' + 'calculation']}, + 'unit': 'kgCO2eq', + 'use': {'max': 4300.0, + 'min': 110.0, + 'significant_figures': 2, + 'value': 1800.0}}, + 'pe': {'description': 'Consumption of primary energy', + 'embedded': {'max': 287.0, + 'min': 287.0, + 'significant_figures': 3, + 'value': 287.0, + 'warnings': ['End of life is not ' + 'included in the ' + 'calculation']}, + 'unit': 'MJ', + 'use': {'max': 2200000.0, + 'min': 62.0, + 'significant_figures': 2, + 'value': 62000.0}}}, + 'model_range': {'status': 'ARCHETYPE', 'value': 'Xeon Platinum'}, + 'params': {'source': 'From CPU model range', + 'status': 'COMPLETED', + 'value': {'a': 171.1813, + 'b': 0.0354, + 'c': 36.8953, + 'd': -10.1336}}, + 'pe_factor': {'max': 468.15, + 'min': 0.013, + 'source': 'ADPf / (1-%renewable_energy)', + 'status': 'DEFAULT', + 'unit': 'MJ/kWh', + 'value': 12.874}, + 'time_workload': {'max': 100.0, + 'min': 0.0, + 'status': 'ARCHETYPE', + 'unit': '%', + 'value': 50.0}, + 'units': {'max': 1.0, + 'min': 1.0, + 'status': 'ARCHETYPE', + 'value': 1.0}, + 'usage_location': {'status': 'DEFAULT', + 'unit': 'CodSP3 - NCS Country Codes - NATO', + 'value': 'EEE'}, + 'use_time_ratio': {'max': 1.0, + 'min': 1.0, + 'status': 'ARCHETYPE', + 'unit': '/1', + 'value': 1.0}}} @pytest.mark.asyncio @@ -473,143 +479,143 @@ async def test_incomplete_cpu_verbose_2(): "core_units": 24, "family": "skylak"}) assert res.json() == {'impacts': {'adp': {'description': 'Use of minerals and fossil ressources', - 'embedded': {'max': 0.02, - 'min': 0.02, - 'significant_figures': 2, - 'value': 0.02, - 'warnings': ['End of life is not included in ' - 'the calculation']}, - 'unit': 'kgSbeq', - 'use': {'max': 0.0013, - 'min': 6.3e-05, - 'significant_figures': 2, - 'value': 0.00031}}, - 'gwp': {'description': 'Total climate change', - 'embedded': {'max': 23.0, - 'min': 22.0, - 'significant_figures': 2, - 'value': 22.0, - 'warnings': ['End of life is not included in ' - 'the calculation']}, - 'unit': 'kgCO2eq', - 'use': {'max': 4300.0, - 'min': 110.0, - 'significant_figures': 2, - 'value': 1800.0}}, - 'pe': {'description': 'Consumption of primary energy', - 'embedded': {'max': 340.0, - 'min': 330.0, - 'significant_figures': 2, - 'value': 330.0, - 'warnings': ['End of life is not included in ' - 'the calculation']}, - 'unit': 'MJ', - 'use': {'max': 2200000.0, - 'min': 62.0, - 'significant_figures': 2, - 'value': 62000.0}}}, - 'verbose': {'adp_factor': {'max': 2.656e-07, - 'min': 1.32e-08, - 'source': 'ADEME Base IMPACTS ®', - 'status': 'DEFAULT', - 'unit': 'kg Sbeq/kWh', - 'value': 6.42e-08}, - 'avg_power': {'max': 182.22, - 'min': 182.22, - 'status': 'COMPLETED', - 'unit': 'W', - 'value': 182.22}, - 'core_units': {'status': 'INPUT', 'value': 24}, - 'die_size_per_core': {'max': 0.27, - 'min': 0.25, - 'source': 'https://en.wikichip.org/wiki/intel/microarchitectures/skylake_(server)#Extreme_Core_Count_.28XCC.29', - 'status': 'COMPLETED', - 'unit': 'cm2', - 'value': 0.25}, - 'duration': {'unit': 'hours', 'value': 26280.0}, - 'family': {'status': 'CHANGED', 'value': 'skylake'}, - 'gwp_factor': {'max': 0.9, - 'min': 0.023, - 'source': 'https://www.sciencedirect.com/science/article/pii/S0306261921012149: \n' - 'Average of 27 european countries', - 'status': 'DEFAULT', - 'unit': 'kg CO2eq/kWh', - 'value': 0.38}, - 'hours_life_time': {'max': 26280.0, - 'min': 26280.0, - 'status': 'ARCHETYPE', - 'unit': 'hours', - 'value': 26280.0}, - 'impacts': {'adp': {'description': 'Use of minerals and fossil ' - 'ressources', - 'embedded': {'max': 0.02, - 'min': 0.02, - 'significant_figures': 2, - 'value': 0.02, - 'warnings': ['End of life is not ' - 'included in the ' - 'calculation']}, - 'unit': 'kgSbeq', - 'use': {'max': 0.0013, - 'min': 6.3e-05, - 'significant_figures': 2, - 'value': 0.00031}}, - 'gwp': {'description': 'Total climate change', - 'embedded': {'max': 23.0, - 'min': 22.0, - 'significant_figures': 2, - 'value': 22.0, - 'warnings': ['End of life is not ' - 'included in the ' - 'calculation']}, - 'unit': 'kgCO2eq', - 'use': {'max': 4300.0, - 'min': 110.0, - 'significant_figures': 2, - 'value': 1800.0}}, - 'pe': {'description': 'Consumption of primary energy', - 'embedded': {'max': 340.0, - 'min': 330.0, - 'significant_figures': 2, - 'value': 330.0, - 'warnings': ['End of life is not ' - 'included in the ' - 'calculation']}, - 'unit': 'MJ', - 'use': {'max': 2200000.0, - 'min': 62.0, - 'significant_figures': 2, - 'value': 62000.0}}}, - 'model_range': {'status': 'ARCHETYPE', 'value': 'Xeon Platinum'}, - 'params': {'source': 'From CPU model range', - 'status': 'COMPLETED', - 'value': {'a': 171.1813, - 'b': 0.0354, - 'c': 36.8953, - 'd': -10.1336}}, - 'pe_factor': {'max': 468.15, - 'min': 0.013, - 'source': 'ADPf / (1-%renewable_energy)', - 'status': 'DEFAULT', - 'unit': 'MJ/kWh', - 'value': 12.874}, - 'time_workload': {'max': 100.0, - 'min': 0.0, - 'status': 'ARCHETYPE', - 'unit': '%', - 'value': 50.0}, - 'units': {'max': 1.0, - 'min': 1.0, - 'status': 'ARCHETYPE', - 'value': 1.0}, - 'usage_location': {'status': 'DEFAULT', - 'unit': 'CodSP3 - NCS Country Codes - NATO', - 'value': 'EEE'}, - 'use_time_ratio': {'max': 1.0, - 'min': 1.0, - 'status': 'ARCHETYPE', - 'unit': '/1', - 'value': 1.0}}} + 'embedded': {'max': 0.02, + 'min': 0.02, + 'significant_figures': 2, + 'value': 0.02, + 'warnings': ['End of life is not included in ' + 'the calculation']}, + 'unit': 'kgSbeq', + 'use': {'max': 0.0013, + 'min': 6.3e-05, + 'significant_figures': 2, + 'value': 0.00031}}, + 'gwp': {'description': 'Total climate change', + 'embedded': {'max': 47.7, + 'min': 11.6, + 'significant_figures': 3, + 'value': 19.7, + 'warnings': ['End of life is not included in ' + 'the calculation']}, + 'unit': 'kgCO2eq', + 'use': {'max': 4300.0, + 'min': 110.0, + 'significant_figures': 2, + 'value': 1800.0}}, + 'pe': {'description': 'Consumption of primary energy', + 'embedded': {'max': 675.0, + 'min': 189.0, + 'significant_figures': 3, + 'value': 298.0, + 'warnings': ['End of life is not included in ' + 'the calculation']}, + 'unit': 'MJ', + 'use': {'max': 2200000.0, + 'min': 62.0, + 'significant_figures': 2, + 'value': 62000.0}}}, + 'verbose': {'adp_factor': {'max': 2.656e-07, + 'min': 1.32e-08, + 'source': 'ADEME Base IMPACTS ®', + 'status': 'DEFAULT', + 'unit': 'kg Sbeq/kWh', + 'value': 6.42e-08}, + 'avg_power': {'max': 182.22, + 'min': 182.22, + 'status': 'COMPLETED', + 'unit': 'W', + 'value': 182.22}, + 'core_units': {'status': 'INPUT', 'value': 24}, + 'die_size': {'max': 19.1, + 'min': 0.74, + 'source': 'Average value of all families with 24 cores', + 'status': 'COMPLETED', + 'unit': 'cm2', + 'value': 4.85}, + 'duration': {'unit': 'hours', 'value': 26280.0}, + 'family': {'status': 'INPUT', 'value': 'skylak'}, + 'gwp_factor': {'max': 0.9, + 'min': 0.023, + 'source': 'https://www.sciencedirect.com/science/article/pii/S0306261921012149: \n' + 'Average of 27 european countries', + 'status': 'DEFAULT', + 'unit': 'kg CO2eq/kWh', + 'value': 0.38}, + 'hours_life_time': {'max': 26280.0, + 'min': 26280.0, + 'status': 'ARCHETYPE', + 'unit': 'hours', + 'value': 26280.0}, + 'impacts': {'adp': {'description': 'Use of minerals and fossil ' + 'ressources', + 'embedded': {'max': 0.02, + 'min': 0.02, + 'significant_figures': 2, + 'value': 0.02, + 'warnings': ['End of life is not ' + 'included in the ' + 'calculation']}, + 'unit': 'kgSbeq', + 'use': {'max': 0.0013, + 'min': 6.3e-05, + 'significant_figures': 2, + 'value': 0.00031}}, + 'gwp': {'description': 'Total climate change', + 'embedded': {'max': 47.7, + 'min': 11.6, + 'significant_figures': 3, + 'value': 19.7, + 'warnings': ['End of life is not ' + 'included in the ' + 'calculation']}, + 'unit': 'kgCO2eq', + 'use': {'max': 4300.0, + 'min': 110.0, + 'significant_figures': 2, + 'value': 1800.0}}, + 'pe': {'description': 'Consumption of primary energy', + 'embedded': {'max': 675.0, + 'min': 189.0, + 'significant_figures': 3, + 'value': 298.0, + 'warnings': ['End of life is not ' + 'included in the ' + 'calculation']}, + 'unit': 'MJ', + 'use': {'max': 2200000.0, + 'min': 62.0, + 'significant_figures': 2, + 'value': 62000.0}}}, + 'model_range': {'status': 'ARCHETYPE', 'value': 'Xeon Platinum'}, + 'params': {'source': 'From CPU model range', + 'status': 'COMPLETED', + 'value': {'a': 171.1813, + 'b': 0.0354, + 'c': 36.8953, + 'd': -10.1336}}, + 'pe_factor': {'max': 468.15, + 'min': 0.013, + 'source': 'ADPf / (1-%renewable_energy)', + 'status': 'DEFAULT', + 'unit': 'MJ/kWh', + 'value': 12.874}, + 'time_workload': {'max': 100.0, + 'min': 0.0, + 'status': 'ARCHETYPE', + 'unit': '%', + 'value': 50.0}, + 'units': {'max': 1.0, + 'min': 1.0, + 'status': 'ARCHETYPE', + 'value': 1.0}, + 'usage_location': {'status': 'DEFAULT', + 'unit': 'CodSP3 - NCS Country Codes - NATO', + 'value': 'EEE'}, + 'use_time_ratio': {'max': 1.0, + 'min': 1.0, + 'status': 'ARCHETYPE', + 'unit': '/1', + 'value': 1.0}}} @pytest.mark.asyncio diff --git a/tests/api/test_server.py b/tests/api/test_server.py index e7ffd3e6..61f35b94 100644 --- a/tests/api/test_server.py +++ b/tests/api/test_server.py @@ -174,41 +174,41 @@ async def test_dell_r740_server(): }) assert res.json() == {'adp': {'description': 'Use of minerals and fossil ressources', - 'embedded': {'max': 0.15, - 'min': 0.15, - 'significant_figures': 2, - 'value': 0.15, - 'warnings': ['End of life is not included in the ' - 'calculation']}, - 'unit': 'kgSbeq', - 'use': {'max': 0.00881, - 'min': 0.000219, - 'significant_figures': 3, - 'value': 0.00142}}, - 'gwp': {'description': 'Total climate change', - 'embedded': {'max': 970.0, - 'min': 970.0, - 'significant_figures': 2, - 'value': 970.0, - 'warnings': ['End of life is not included in the ' - 'calculation']}, - 'unit': 'kgCO2eq', - 'use': {'max': 30000.0, - 'min': 380.0, - 'significant_figures': 2, - 'value': 8400.0}}, - 'pe': {'description': 'Consumption of primary energy', - 'embedded': {'max': 13000.0, - 'min': 13000.0, + 'embedded': {'max': 0.15, + 'min': 0.15, 'significant_figures': 2, - 'value': 13000.0, + 'value': 0.15, + 'warnings': ['End of life is not included in the ' + 'calculation']}, + 'unit': 'kgSbeq', + 'use': {'max': 0.00881, + 'min': 0.000219, + 'significant_figures': 3, + 'value': 0.00142}}, + 'gwp': {'description': 'Total climate change', + 'embedded': {'max': 970.0, + 'min': 970.0, + 'significant_figures': 2, + 'value': 970.0, 'warnings': ['End of life is not included in the ' 'calculation']}, - 'unit': 'MJ', - 'use': {'max': 15535000.0, - 'min': 215.7, - 'significant_figures': 5, - 'value': 284100.0}}} + 'unit': 'kgCO2eq', + 'use': {'max': 30000.0, + 'min': 380.0, + 'significant_figures': 2, + 'value': 8400.0}}, + 'pe': {'description': 'Consumption of primary energy', + 'embedded': {'max': 13000.0, + 'min': 13000.0, + 'significant_figures': 2, + 'value': 13000.0, + 'warnings': ['End of life is not included in the ' + 'calculation']}, + 'unit': 'MJ', + 'use': {'max': 15535000.0, + 'min': 215.7, + 'significant_figures': 5, + 'value': 284100.0}}} @pytest.mark.asyncio @@ -271,7 +271,7 @@ async def test_partial_server_1(): 'embedded': {'max': 2800000.0, 'min': 15000.0, 'significant_figures': 2, - 'value': 17000.0, + 'value': 16000.0, 'warnings': ['End of life is not included in the ' 'calculation']}, 'unit': 'MJ', @@ -333,8 +333,8 @@ async def test_partial_server_2(): 'significant_figures': 3, 'value': 0.00125}}, 'gwp': {'description': 'Total climate change', - 'embedded': {'max': 9800.0, - 'min': 910.0, + 'embedded': {'max': 9900.0, + 'min': 900.0, 'significant_figures': 2, 'value': 1400.0, 'warnings': ['End of life is not included in the ' @@ -393,9 +393,9 @@ async def test_partial_server_3(): 'value': 0.00114}}, 'gwp': {'description': 'Total climate change', 'embedded': {'max': 2800000.0, - 'min': 760.0, + 'min': 750.0, 'significant_figures': 2, - 'value': 900.0, + 'value': 890.0, 'warnings': ['End of life is not included in the ' 'calculation']}, 'unit': 'kgCO2eq', @@ -440,9 +440,9 @@ async def test_custom_usage_1(): 'value': 4.3e-07}}, 'gwp': {'description': 'Total climate change', 'embedded': {'max': 760000.0, - 'min': 51.0, + 'min': 50.0, 'significant_figures': 2, - 'value': 830.0, + 'value': 820.0, 'warnings': ['End of life is not included in the ' 'calculation']}, 'unit': 'kgCO2eq', diff --git a/tests/data/crowdsourcing/cpu_manufacture.csv b/tests/data/crowdsourcing/cpu_manufacture.csv deleted file mode 100644 index 55f1482f..00000000 --- a/tests/data/crowdsourcing/cpu_manufacture.csv +++ /dev/null @@ -1,38 +0,0 @@ -manufacturer,family,manufacture_date,process,die_size,core_units,die_size_per_core,Source -Intel,skylake,2017,14,1.0183,2,0.51,https://en.wikichip.org/wiki/intel/microarchitectures/skylake_(client)#Dual-core -Intel,skylake,2017,14,1.223,4,0.31,https://en.wikichip.org/wiki/intel/microarchitectures/skylake_(client)#Quad-core -Intel,skylake,2017,14,3.2544,10,0.33,https://en.wikichip.org/wiki/intel/microarchitectures/skylake_(server)#Low_Core_Count_.28LCC.29 -Intel,skylake,2017,14,4.85,18,0.27,https://en.wikichip.org/wiki/intel/microarchitectures/skylake_(server)#High_Core_Count_.28HCC.29 -Intel,skylake,2017,14,6.94,28,0.25,https://en.wikichip.org/wiki/intel/microarchitectures/skylake_(server)#Extreme_Core_Count_.28XCC.29 -Intel,coffee lake,2017,14,1.26,4,0.32,https://en.wikichip.org/wiki/intel/microarchitectures/coffee_lake#Quad-Core -Intel,coffee lake,2017,14,1.496,6,0.25,https://en.wikichip.org/wiki/intel/microarchitectures/coffee_lake#Hexa-Core -Intel,coffee lake,2017,14,1.74,8,0.22,https://en.wikichip.org/wiki/intel/microarchitectures/coffee_lake#Octa-Core -Intel,broadwell,2014,14,0.82,2,0.41,https://en.wikichip.org/wiki/intel/microarchitectures/broadwell_(client)#Dual-core -Intel,broadwell,2014,14,1.82,4,0.46,https://en.wikichip.org/wiki/intel/microarchitectures/broadwell_(client)#Quad-core_Broadwell_with_Iris_Pro_die -Intel,broadwell,2014,14,2.46,10,0.25,https://en.wikichip.org/wiki/intel/microarchitectures/broadwell_(client)#Deca-core_Broadwell -Intel,broadwell,2014,14,3.0518,14,0.22,https://en.wikichip.org/wiki/intel/microarchitectures/broadwell_(client)#Die_Stats -Intel,broadwell,2014,14,4.5612,24,0.19,https://en.wikichip.org/wiki/intel/microarchitectures/broadwell_(client)#Die_Stats -Intel,haswell,2013,22,1.81,2,0.91,https://en.wikichip.org/wiki/intel/microarchitectures/haswell_(client)#Dual-core_GT3 -Intel,haswell,2013,22,2.6,4,0.65,https://en.wikichip.org/wiki/intel/microarchitectures/haswell_(client)#Quad-core_GT3 -Intel,haswell,2013,22,3.5552,8,0.44,https://en.wikichip.org/wiki/intel/microarchitectures/haswell_(client)#Octa-core -Intel,haswell,2013,22,6.22,18,0.35,https://en.wikichip.org/wiki/intel/microarchitectures/haswell_(client)#Octadeca-core -Intel,ivy bridge,2011,22,1.6,4,0.40,https://en.wikichip.org/wiki/intel/microarchitectures/ivy_bridge_(client)#Quad-core_Ivy_Bridge_die -Intel,ivy bridge,2011,22,5.41,15,0.36,https://en.wikichip.org/wiki/intel/microarchitectures/ivy_bridge_(client)#Pentadeca-Core_Ivy_Bridge_die -Intel,ivy bridge,2011,22,3.41,10,0.34,https://en.wikichip.org/wiki/intel/microarchitectures/ivy_bridge_(client)#Deca-core_Ivy_Bridge_Die -Intel,ivy bridge,2011,22,2.565,6,0.43,https://en.wikichip.org/wiki/intel/microarchitectures/ivy_bridge_(client)#Hexa-core_Ivy_Bridge_Die -Intel,sandy bridge,2010,32,1.49,2,0.75,https://en.wikichip.org/wiki/intel/microarchitectures/sandy_bridge_(client)#Dual-Core_.28GT2.29 -Intel,sandy bridge,2010,32,2.16,4,0.54,https://en.wikichip.org/wiki/intel/microarchitectures/sandy_bridge_(client)#Quad-Core -Intel,kaby lake,2017,14,1.26,4,0.32,https://en.wikichip.org/wiki/intel/microarchitectures/kaby_lake -Intel,ice lake,2019,10,6.28,40,0.16,https://fuse.wikichip.org/news/4734/intel-launches-3rd-gen-ice-lake-xeon-scalable/ -Intel,ice lake,2019,10,1.3,4,0.33,https://medium.com/@ewoutterhoeven/calculating-the-intel-ice-lake-quad-core-die-size-130mm2-ce18a44c5f05 -Intel,ice lake,2019,10,3.7,16,0.23,https://twitter.com/dylan522p/status/1326817993792266241?lang=en -Intel,ice lake,2019,10,5.05,28,0.18,https://twitter.com/dylan522p/status/1326817993792266241?lang=en -Intel,ice lake,2019,10,6.3,42,0.15,https://twitter.com/dylan522p/status/1326817993792266241?lang=en -Amd,zen2,2019,7,13.09,16,0.82,https://www.techarp.com/computer/amd-zen-3-tech-report/ (74mm2*core_units+125mm2) -Amd,zen2,2019,7,10.13,12,0.84,https://www.techarp.com/computer/amd-zen-3-tech-report/ (74mm2*core_units+125mm2) -Amd,zen2,2019,7,7.17,8,0.90,https://www.techarp.com/computer/amd-zen-3-tech-report/ (74mm2*core_units+125mm2) -Amd,zen2,2019,7,5.69,6,0.95,https://www.techarp.com/computer/amd-zen-3-tech-report/ (74mm2*core_units+125mm2) -Amd,zen3,2020,7,14.162,16,0.89,https://www.techarp.com/computer/amd-zen-3-tech-report/ (80.7mm2*core_units+125mm2) -Amd,zen3,2020,7,10.934,12,0.91,https://www.techarp.com/computer/amd-zen-3-tech-report/ (80.7mm2*core_units+125mm2) -Amd,zen3,2020,7,7.706,8,0.96,https://www.techarp.com/computer/amd-zen-3-tech-report/ (80.7mm2*core_units+125mm2) -Amd,zen3,2020,7,6.092,6,1.02,https://www.techarp.com/computer/amd-zen-3-tech-report/ (80.7mm2*core_units+125mm2) \ No newline at end of file diff --git a/tests/unit/test_bottom_up.py b/tests/unit/test_bottom_up.py index 1fee7c3d..7bdbb43d 100644 --- a/tests/unit/test_bottom_up.py +++ b/tests/unit/test_bottom_up.py @@ -16,10 +16,10 @@ def test_bottom_up_component_cpu_empty(empty_cpu_model): 'significant_figures': 2, 'value': 0.00031}}, 'gwp': {'description': 'Total climate change', - 'embedded': {'max': 22.7, - 'min': 11.1, + 'embedded': {'max': 81.8, + 'min': 10.6, 'significant_figures': 3, - 'value': 21.7, + 'value': 15.0, 'warnings': ['End of life is not included in the ' 'calculation']}, 'unit': 'kgCO2eq', @@ -28,10 +28,10 @@ def test_bottom_up_component_cpu_empty(empty_cpu_model): 'significant_figures': 2, 'value': 1800.0}}, 'pe': {'description': 'Consumption of primary energy', - 'embedded': {'max': 339.0, - 'min': 182.0, + 'embedded': {'max': 1130.0, + 'min': 176.0, 'significant_figures': 3, - 'value': 325.0, + 'value': 235.0, 'warnings': ['End of life is not included in the ' 'calculation']}, 'unit': 'MJ', From 4c8bd91e3ed4d02151af6417dee869002868c88d Mon Sep 17 00:00:00 2001 From: da-ekchajzer Date: Wed, 30 Aug 2023 15:32:44 +0200 Subject: [PATCH 4/4] correcting die_size from die_size_per_core in doc --- docs/docs/Explanations/components/cpu.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/Explanations/components/cpu.md b/docs/docs/Explanations/components/cpu.md index 2c59bd40..d9963016 100644 --- a/docs/docs/Explanations/components/cpu.md +++ b/docs/docs/Explanations/components/cpu.md @@ -31,7 +31,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_per_core} = {\text{core_units}}*{\text{die_size}}$$ +$$ \text{die_size} = {\text{core_units}}*{\text{die_size}}$$ Otherwise, if ```family``` is given, ```die_size``` can be retrieved from a fuzzy matching on our cpu repository.