Exported functions and classes#

Functions and methods exported by ImpactHPC.

impacthpc Package#

class impacthpc.CPU(embodied_impacts: Impacts | None = None, electric_power: ReplicableValue | str | None = None, peak_power: ReplicableValue | str | None = None, idle_power: ReplicableValue | str | None = None, name: Name | None = None, tdp: float | None = None, model_range: str | None = None, power_measures: List[PowerMeasure] = [], die_size: ReplicableValue | str | None = None, cpu_family: str | None = None, cores: int | None = None, release_date_range: DateRange | None = None)#

Subclass of Component representing a CPU.

This class uses the same estimation as BoavitzAPI, described in

Thibault Simon, David Ekchajzer, Adrien Berthelot, Eric Fourboul, Samuel Rince, et al.. BoaviztAPI: a bottom-up model to assess the environmental impacts of cloud services. HotCarbon’24 - 3rd Workshop on Sustainable Computer Systems, Jul 2024, Santa Cruz, United States. hal-04621947v3"

See the documentation of BoavitzAPI : https://doc.api.boavizta.org/Explanations/components/cpu/

Examples

from impacthpc import CPU, ExactName

impacts = CPU(name=ExactName("Intel Xeon Gold 6248")).estimate_embodied_impacts()

impacts_climate_change = impacts["gwp"]

print(impacts_climate_change.explain())

If you don’t know the exact name of you CPU, use find_close_cpu_model_name()

from impacthpc import CPU, ExactName, find_close_cpu_model_name

impacts = CPU(name=find_close_cpu_model_name("Intel 6248")).estimate_embodied_impacts()

impacts_climate_change = impacts["gwp"]

print(impacts_climate_change.explain())

Electric power of this cpu :

from impacthpc import CPU, ExactName

power = CPU(name=ExactName("Intel Xeon Gold 6248")).estimate_electric_power()

print(power.explain())
name#

The name of a CPU model present in the database. Can be an instance of ExactName or the return value of find_close_cpu_model_name() for fuzzy matching name. Defaults to None.

Type:

Name, optional

tdp#

The Thermal Design Power of the CPU, used to determine the CPU’s instantaneous power consumption. Defaults to None.

Type:

float | None, optional

model_range#

The model range of the CPU, for example EPYC, Athlon X4, Core i5, Xeon Gold… The supported model ranges are listed in the CSV file at the path defined in the config file under csv > cpu_profile.csv. If tdp or power_measures are provided, model_range will be ignored. Defaults to None.

Type:

str | None, optional

power_measures#

Measurements of the CPU’s power consumption depending on the workload. Defaults to [].

Type:

List[PowerMeasure], optional

die_size#

The surface area of the CPU die. Used to determine the embodied impacts of the CPU. Defaults to None.

Type:

ReplicableValue | None, optional

cpu_family#

The family of the CPU. Ignored if the name is provided and the die size is in the database for the CPU name. Defaults to None.

Type:

str | None, optional

cores#

The number of physical cores of the CPU. Defaults to None.

Type:

int | None, optional

release_date_range#

The date range in which the CPU was released. Used in computations when the exact name of the CPU isn’t known and estimations are done with average values. Defaults to the ten last years.

Type:

DateRange | None, optional

_cpu_profile() tuple[ReplicableValue, ReplicableValue, ReplicableValue, ReplicableValue]#

Estimate the profile of the CPU.

CPU energy consumption is estimated using the formula a * ln(b * (workload + c)) + d, where: - workload is a percentage indicating how much the CPU is being used. - a, b, c, and d are parameters estimated using power measurements and TDP.

The CPU profile is the set of these four parameters: a, b, c, and d. This method is used to estimate them.

If the TDP and/or power measures are known, we use scipy.optimize to find a, b, c, and d values that fit best. Otherwise, we use default values for the model_range.

Returns:

The CPU profile consisting of the four parameters a, b, c, and d.

Return type:

tuple[ReplicableValue, ReplicableValue, ReplicableValue, ReplicableValue]

_estimate_die_size() ReplicableValue#

Estimate the Die size of a CPU.

_static/estimate_die_size_schema.svg
Alt:

Schema that explains the logic used in this method

Returns:

The estimated Die size.

Return type:

ReplicableValue

_get_cpus_matching_by_name() DataFrame#

Return a sub-dataframe of CPUs_specs containing only the row matching name.

Return an empty dataframe with the same columns as CPUs_specs if name is None.

Raises:

ValueErrorname should be an instance of the abstract class Name or None. Therefore, it can be an ExactName, a FuzzymatchSingleResult, a FuzzymatchMultipleResult, or None.

Returns:

A sub-dataframe of CPUs_specs containing only the row matching name.

Return type:

pandas.DataFrame

_linear_regression_core_to_die_size(cpus: DataFrame) SourcedValue#

Perform a linear regression on the die sizes and numbers of cores of different CPUs to estimate the die size of the current CPU.

Parameters:

cpus (pandas.DataFrame) – A dataframe with at least two columns, “cores” and “total_die_size”, which describes CPUs and is used to perform the linear regression.

Raises:

ValueError – all pairs of cores and total_die_size in cpus are (nan, nan).

Returns:

The estimated die size of the CPU.

Return type:

SourcedValue

estimate_electric_power(workload: ReplicableValue | None = None) ReplicableValue#

Estimate the electric power of the CPU.

CPU electric power is estimated using the formula a * ln(b * (workload + c)) + d, where:

  • workload is a percentage indicating how much the CPU is being used.

  • a, b, c, and d are parameters estimated using power measurements and TDP.

These four parameters a, b, c, and d are called the CPU profile and are estimated by the method _cpu_profile().

Parameters:

workload (ReplicableValue, optional) – The :arg:`workload` of the CPU, between 0 and 100, as a ReplicableValue. The unit should be dimensionless. Defaults to the value defined in the config file under default_values_cpu > workload.

Returns:

The estimated instant consumption of the CPU.

Return type:

ReplicableValue

estimate_embodied_impacts() Impacts#

Estimate the embodied impacts of the CPU.

CPU embodied impacts are estimated using: self._die_size_factor * self.die_size + self._base_impact, where:

  • _die_size_factor is the impact of 1 mm² of die. It is defined in the config file under default_values_cpu > die_size_factor.

  • die_size is the surface of the die in mm², either provided by the user or estimated in _estimate_die_size().

  • base_impact is the impact of everything that isn’t the die in a CPU, and is defined in the config file under default_values_cpu > base_impact.

Returns:

The embodied impacts of the CPU.

Return type:

Impact

estimate_idle_power()#

Estimate the static electric power of the CPU when the workload is 0%.

The CPU’s static instant consumption is estimated using the estimate_electric_power() method with a workload of 0%.

Returns:

The electric power of the CPU.

Return type:

Impact

estimate_peak_power()#

Estimate the peak (maximum) electric power of the CPU when the workload is 100%.

The CPU’s peak instant consumption is estimated using the estimate_electric_power() method with a workload of 100%.

Returns:

The electric power of the CPU.

Return type:

Impact

class impacthpc.Case(embodied_impacts: Impacts | None = None, type: CaseType = CaseType.RACK, allocation_method: AllocationMethod | None = None)#

Representes case containing servers, used to computes it’s embodied impacts *

This class uses the same estimation as BoavitzAPI, described in

Thibault Simon, David Ekchajzer, Adrien Berthelot, Eric Fourboul, Samuel Rince, et al.. BoaviztAPI: a bottom-up model to assess the environmental impacts of cloud services. HotCarbon’24 - 3rd Workshop on Sustainable Computer Systems, Jul 2024, Santa Cruz, United States. hal-04621947v3"

See the documentation of BoavitzAPI : https://doc.api.boavizta.org/Explanations/components/case/

embodied_impacts#

The embodied impacts of the battery. If the value is known, estimate_embodied_impacts() returns it, otherwise an estimation is done based on other attributes. Defaults to None.

Type:

Impacts | str | None, optional

server_count#

The number of servers cases

Type:

ReplicableValue | str | int | float

embedded_impacts(job_duration: ReplicableValue)#

Estimate the Embedded impacts of the cases for the job.

Internally uses estimate_embodied_impacts() and passes it the allocation_method with the job_duration.

Parameters:

job_duration (ReplicableValue) – The duration of the job we want to allocate the embodied impacts to.

Returns:

The Embedded impacts of the cases for the job.

Return type:

Impact

estimate_embodied_impacts() Impacts#

Estimate the embodied impacts of the cases.

Returns a constant impact depending on the type of case used. These values are defined in the config file under default_value_case.

Returns:

The case embodied impacts .

Return type:

Impact | None

class impacthpc.Cluster(server_model: Server, servers_count: ReplicableValue | str | int | float, PUE: ReplicableValue | None = None)#
class impacthpc.EnergyIntensity(value: Impacts)#

Environnental impact of 1 kWh of electricty. If you don’t know the exact value, you can use the at_location() to find the energy intensity in a country or a region.

value#

the impact of 1 kWh of electricity.

Type:

Impact

__repr__()#

Return repr(self).

static at_location(location: str)#

Find the energy intensity at the specify location. location should be a three letter country code as defined in ISO 3166-1 https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3.

Parameters:

location (str) – three letter country code

Returns:

an Impact instance containing the energy intensity at location.

Return type:

_type_

value: Impacts = <dataclasses._MISSING_TYPE object>#
class impacthpc.ExactName(name: str)#
__repr__()#

Return repr(self).

name: str = <dataclasses._MISSING_TYPE object>#
class impacthpc.GPU(embodied_impacts: Impacts | None = None, electric_power: ReplicableValue | str | None = None, peak_power: ReplicableValue | str | None = None, idle_power: ReplicableValue | str | None = None, name: Name | None = None, tdp: ReplicableValue | None = None, die_size: ReplicableValue | None = None, ram_size: ReplicableValue | None = None, ram_density: ReplicableValue | str | None = None, family: str | None = None, release_range: DateRange | None = None)#

Subclass of Component representing a GPU.

This class uses the same estimation as MLCA, described in

Clément Morand, Anne-Laure Ligozat, Aurélie Névéol. MLCA: a tool for Machine Learning Life Cycle Assessment. 2024 10th International Conference on ICT for Sustainability (ICT4S), Jun 2024, Stockholm, Sweden. pp.227-238, 10.1109/ICT4S64576.2024.00031. hal-04643414"

See the original implementation made by the authors : https://github.com/blubrom/MLCA/blob/d2d8a42a030ea6259959b7d13a2b8637c8501044/boaviztapi/model/components/component.py#L568C7-L568C19

name#

The name of a GPU model present in the database. Can be an instance of ExactName or the return value of find_close_cpu_model_name() for fuzzy matching the name. Defaults to None.

Type:

Name | None, optional

tdp#

The Thermal Design Power of the GPU, used to determine the GPU’s instantaneous power consumption. Defaults to None.

Type:

ReplicableValue | None, optional

die_size#

The die surface size of the GPU. Defaults to None.

Type:

ReplicableValue | None, optional

ram_size#

size of the GPU’s embedded RAM. Defaults to None.

Type:

ReplicableValue | None, optional

family#

Family of the GPU. Defaults to None.

Type:

str | None, optional

release_range#

A range in which the GPU was released. Defaults to the last ten years.

Type:

DateRange, optional

_estimate_die_size() ReplicableValue#

Estimate the die size of the GPU.

If the user provided name, we try to find in the database if the die size is known for this model. If the user provided family, we average the die sizes of GPUs in the same family. Otherwise, we return the average die size of all GPUs in the database.

Returns:

The estimated die size of the GPU.

Return type:

ReplicableValue

_get_gpu_within_date_range() DataFrame#

Return a sub-dataframe of gpu_specs containing only the rows within release_range.

Returns:

A sub-dataframe of gpu_specs containing only the rows within release_range.

Return type:

pandas.DataFrame

_get_gpus_matching_by_name() DataFrame#

Return a sub-dataframe of gpu_specs containing only the row matching name.

Return an empty dataframe with the same columns as gpu_specs if name is None.

Raises:

ValueErrorname should be an instance of the abstract class Name or None. Therefore, it can be an ExactName, a FuzzymatchSingleResult, a FuzzymatchMultipleResult, or None.

Returns:

A sub-dataframe of gpu_specs containing only the row matching name.

Return type:

pandas.DataFrame

_ram_size() ReplicableValue | None#

Returns the ram size based on the name and the database. If the RAM size isn’t in database or name is not knowm, returns None.

Returns:

the ram size based on the name and the database. If the RAM size isn’t in database or name is not knowm, returns None.

Return type:

ReplicableValue | None

estimate_electric_power(workload: ReplicableValue | int | float | None = None) ReplicableValue#

Estimate the electric power of the CPU.

If known, we return the TDP. If it is not known, we average the TDP of the GPUs within the release range. If no GPUs are in the release range, we average all TDPs of GPUs in the database.

Parameters:

workload (ReplicableValue, optional) – The workload of the CPU, between 0 and 100, as a ReplicableValue. The unit should be dimensionless. Defaults to the value defined in the config file under default_values_gpu > workload.

Returns:

The estimated instant consumption of the CPU.

Return type:

ReplicableValue

estimate_embodied_impacts() Impacts#

Estimate the embodied impacts of the GPU.

GPU embodied impacts are estimated using: self._die_size_factor * self.die_size + self._base_impact, where: - _die_size_factor is the impact of 1 mm² of die. It is defined in the config file under default_values_gpu > die_size_factor. - die_size is the surface of the die in mm², either provided by the user or estimated in _estimate_die_size(). - base_impact is the impact of everything that isn’t the die in a GPU, and is defined in the config file under default_values_gpu > base_impact.

To this, we add the RAM impact, estimated using the RAM class.

Returns:

The embodied impacts of the GPU.

Return type:

Impact

estimate_idle_power() ReplicableValue | None#

Returns the minimum consumption of the component, the consumption it has when no job are running

estimate_peak_power() ReplicableValue | None#

Returns the maximum consumption of the component

class impacthpc.HDD(embodied_impacts: Impacts | None = None, electric_power: ReplicableValue | str | None = None, peak_power: ReplicableValue | str | None = None, idle_power: ReplicableValue | str | None = None)#

Subclass of Component representing a HDD disk.

This class uses the same estimation as BoavitzAPI, described in

Thibault Simon, David Ekchajzer, Adrien Berthelot, Eric Fourboul, Samuel Rince, et al.. BoaviztAPI: a bottom-up model to assess the environmental impacts of cloud services. HotCarbon’24 - 3rd Workshop on Sustainable Computer Systems, Jul 2024, Santa Cruz, United States. hal-04621947v3"

See the documentation of BoavitzAPI : https://doc.api.boavizta.org/Explanations/components/hdd/

estimate_electric_power() ReplicableValue | None#

Instant consumption of HDD is ignored.

Returns:

Always returns None.

Return type:

ReplicableValue | None

estimate_embodied_impacts() Impacts#

Estimate the embodied impacts of the HDD.

Simply returns a constant impact defined in the config file under default_value_hdd.

Returns:

The HDD embodied impacts .

Return type:

Impact | None

estimate_idle_power() ReplicableValue | None#

Returns the minimum consumption of the component, the consumption it has when no job are running

estimate_peak_power() ReplicableValue | None#

Returns the maximum consumption of the component

class impacthpc.HTMLFormatter(uncertainty_format: UncertaintyFormat = UncertaintyFormat.STANDARD_DEVIATION)#
format_extracted_important_values(name: str | None, value: Quantity, min: Quantity, max: Quantity, standard_deviation: Quantity, source: str, explaination: str | None, warnings: List[str], ontology: Ontology | None) str#

Format extracted values which are the ReplicableValue instances with the Replicable.important boolean set to true. These values are extracted and can be used to format the final result in format_result().

Parameters:
  • name (str | None) – Name of the SourcedValue, if any. It is unique.

  • value (Quantity) – The central value, with units.

  • min (Quantity) – Minimum plausible value.

  • max (Quantity) – Maximum plausible value.

  • standard_deviation (Quantity) – Standard deviation (uncertainty) of the value.

  • source (str) – The source (quote, link, etc.) of the value.

  • warnings (List[str]) – List of warnings or notes about the value.

  • explanation (str | None) – Optional explanation or description.

  • ontology (str | None) – Optional ontology tag for semantic annotation.

Returns:

Formatted extracted important source value.

Return type:

T

format_operation(formula: str, name: str | None, value: Quantity, min: Quantity, max: Quantity, standard_deviation: Quantity, operator: str, operands: list[str], isInfix: bool, explaination: str | None, warnings: List[str], ontology: Ontology | None, recursion_level: int, already_seen: bool, important: bool) str#

Format an Operation instance. This method must be implemented.

Parameters:
  • formula (str) – A string representing the formula that the Operation represents, returned by Operation._as_formula().

  • name (str | None) – Name of the SourcedValue, if any. It is unique.

  • value (Quantity) – The central value, with units.

  • min (Quantity) – Minimum plausible value.

  • max (Quantity) – Maximum plausible value.

  • standard_deviation (Quantity) – Standard deviation (uncertainty) of the value.

  • operator (str) – The operator of this operation.

  • operands (list[T]) – List of the operands used in this operation, already formatted.

  • isInfix (bool) – True if the operation is infix (i.e., it’s a binary operation and the operator is placed between the operands, like A + B). False if the operation is prefix (i.e., the operation can have any number of parameters and is written as a function, like ln(a)).

  • warnings (List[str]) – List of warnings or notes about the value.

  • explanation (str | None) – Optional explanation or description.

  • ontology (str | None) – Optional ontology tag for semantic annotation.

  • recursion_level (int) – Recursion level is the depth of this value in the tree represented by the ReplicableValue on which we called ReplicableValue.explain().

  • already_seen (bool) – Whether the value has already been formatted in a previously traversed branch of the tree represented by the ReplicableValue on which we called ReplicableValue.explain(). The Operation._explain_rec() method uses Depth-First Search and respects the order of the Operation.operands list.

  • important (bool) – True if the value is an important intermediate result. If true, it will be extracted and passed to format_result() in the list of extracted important values.

Returns:

The formatted Operation.

Return type:

T

format_result(result: str, extracted_important_values: List[str]) str#

Format the final result. Does nothing by default, but can be overridden to process or modify the final result before ReplicableValue.explain() returns it.

For example, TextFormatter overrides format_result() in order to add the extracted important values at the beginning of the explanation. JSONFormatter override format_result() to use json.dumps() on the final dict returned by format_operation() and format_sourced_value()

Parameters:
  • result (T) – The formatted result of ReplicableValue._explain_rec().

  • extracted_important_values (list[T]) – The extracted important values. These can be used to add a quick recap of the important results at the beginning of the explanation.

Returns:

By default, returns the result parameter as is. Can be overridden to modify the final result before ReplicableValue.explain() returns it.

Return type:

T

format_sourced_value(name: str | None, value: Quantity, min: Quantity, max: Quantity, standard_deviation: Quantity, source: str, explaination: str | None, warnings: List[str], ontology: Ontology | None, recursion_level: int, already_seen: bool, important: bool) str#

Format a SourcedValue instance. This method must be implemented.

name#

Name of the SourcedValue, if any.

Type:

str | None

value#

The central value, with units.

Type:

Quantity

min#

Minimum plausible value.

Type:

Quantity

max#

Maximum plausible value.

Type:

Quantity

standard_deviation#

Standard deviation (uncertainty) of the value.

Type:

Quantity

source#

The source (quote, link, etc.) of the value.

Type:

str

warnings#

List of warnings or notes about the value.

Type:

List[str]

explanation#

Optional explanation or description.

Type:

str | None

ontology#

Optional ontology tag for semantic annotation.

Type:

str | None

recursion_level#

Recursion level is the depth of this value in the tree represented by the ReplicableValue on which we called ReplicableValue.explain().

Type:

int

already_seen#

Whether the value has already been formatted in a previously traversed branch of the tree represented by the ReplicableValue on which we called ReplicableValue.explain(). The Operation._explain_rec() method uses Depth-First Search and respects the order of the Operation.operands list.

Type:

bool

important#

True if the value is an important intermediate result. If true, it will be extracted and passed to format_result() in the list of extracted important values.

Type:

bool

Returns:

The formatted SourcedValue.

Return type:

T

class impacthpc.Impacts(impact_per_criteria: dict[str, ReplicableValue])#
__add__(other: Impacts | ReplicableValue | int) Impacts#
__mul__(other: Impacts | ReplicableValue | int) Impacts#
__sub__(other: Impacts | ReplicableValue | int) Impacts#
__truediv__(other: Impacts | ReplicableValue | int) Impacts#
static from_config(name: str, configEntry: dict[str, dict[str, Any]]) Impacts#

Creates an Impact object from a configuration entry. The configEntry should be a dictionary where keys are criteria names and values are dictionaries with ‘value’ and ‘source’ keys.

keys() list[str]#
make_intermediate_result(name: str, explainations: str | None = None, ontology: Ontology | None = None)#

Call impacthpc.src.core.ReplicableValue.make_intermediate_result() on the impacthpc.src.core.ReplicableValue of this Impcats.

static sum(values: List[Impacts]) Impacts#
values() list[ReplicableValue]#
class impacthpc.JSONFormatter(uncertainty_format: UncertaintyFormat = UncertaintyFormat.STANDARD_DEVIATION)#
format_extracted_important_values(name: str | None, value: Quantity, min: Quantity, max: Quantity, standard_deviation: Quantity, source: str, explaination: str | None, warnings: List[str], ontology: Ontology | None) dict#

Format extracted values which are the ReplicableValue instances with the Replicable.important boolean set to true. These values are extracted and can be used to format the final result in format_result().

Parameters:
  • name (str | None) – Name of the SourcedValue, if any. It is unique.

  • value (Quantity) – The central value, with units.

  • min (Quantity) – Minimum plausible value.

  • max (Quantity) – Maximum plausible value.

  • standard_deviation (Quantity) – Standard deviation (uncertainty) of the value.

  • source (str) – The source (quote, link, etc.) of the value.

  • warnings (List[str]) – List of warnings or notes about the value.

  • explanation (str | None) – Optional explanation or description.

  • ontology (str | None) – Optional ontology tag for semantic annotation.

Returns:

Formatted extracted important source value.

Return type:

T

format_operation(formula: str, name: str | None, value: Quantity, min: Quantity, max: Quantity, standard_deviation: Quantity, operator: str, operands: list[dict], isInfix: bool, explaination: str | None, warnings: List[str], ontology: Ontology | None, recursion_level: int, already_seen: bool, important: bool) dict#

Format an Operation instance. This method must be implemented.

Parameters:
  • formula (str) – A string representing the formula that the Operation represents, returned by Operation._as_formula().

  • name (str | None) – Name of the SourcedValue, if any. It is unique.

  • value (Quantity) – The central value, with units.

  • min (Quantity) – Minimum plausible value.

  • max (Quantity) – Maximum plausible value.

  • standard_deviation (Quantity) – Standard deviation (uncertainty) of the value.

  • operator (str) – The operator of this operation.

  • operands (list[T]) – List of the operands used in this operation, already formatted.

  • isInfix (bool) – True if the operation is infix (i.e., it’s a binary operation and the operator is placed between the operands, like A + B). False if the operation is prefix (i.e., the operation can have any number of parameters and is written as a function, like ln(a)).

  • warnings (List[str]) – List of warnings or notes about the value.

  • explanation (str | None) – Optional explanation or description.

  • ontology (str | None) – Optional ontology tag for semantic annotation.

  • recursion_level (int) – Recursion level is the depth of this value in the tree represented by the ReplicableValue on which we called ReplicableValue.explain().

  • already_seen (bool) – Whether the value has already been formatted in a previously traversed branch of the tree represented by the ReplicableValue on which we called ReplicableValue.explain(). The Operation._explain_rec() method uses Depth-First Search and respects the order of the Operation.operands list.

  • important (bool) – True if the value is an important intermediate result. If true, it will be extracted and passed to format_result() in the list of extracted important values.

Returns:

The formatted Operation.

Return type:

T

format_result(result: dict, extracted_important_values: List[dict]) str#

Format the final result. Does nothing by default, but can be overridden to process or modify the final result before ReplicableValue.explain() returns it.

For example, TextFormatter overrides format_result() in order to add the extracted important values at the beginning of the explanation. JSONFormatter override format_result() to use json.dumps() on the final dict returned by format_operation() and format_sourced_value()

Parameters:
  • result (T) – The formatted result of ReplicableValue._explain_rec().

  • extracted_important_values (list[T]) – The extracted important values. These can be used to add a quick recap of the important results at the beginning of the explanation.

Returns:

By default, returns the result parameter as is. Can be overridden to modify the final result before ReplicableValue.explain() returns it.

Return type:

T

format_sourced_value(name: str | None, value: Quantity, min: Quantity, max: Quantity, standard_deviation: Quantity, source: str, explaination: str | None, warnings: List[str], ontology: Ontology | None, recursion_level: int, already_seen: bool, important: bool) dict#

Format a SourcedValue instance. This method must be implemented.

name#

Name of the SourcedValue, if any.

Type:

str | None

value#

The central value, with units.

Type:

Quantity

min#

Minimum plausible value.

Type:

Quantity

max#

Maximum plausible value.

Type:

Quantity

standard_deviation#

Standard deviation (uncertainty) of the value.

Type:

Quantity

source#

The source (quote, link, etc.) of the value.

Type:

str

warnings#

List of warnings or notes about the value.

Type:

List[str]

explanation#

Optional explanation or description.

Type:

str | None

ontology#

Optional ontology tag for semantic annotation.

Type:

str | None

recursion_level#

Recursion level is the depth of this value in the tree represented by the ReplicableValue on which we called ReplicableValue.explain().

Type:

int

already_seen#

Whether the value has already been formatted in a previously traversed branch of the tree represented by the ReplicableValue on which we called ReplicableValue.explain(). The Operation._explain_rec() method uses Depth-First Search and respects the order of the Operation.operands list.

Type:

bool

important#

True if the value is an important intermediate result. If true, it will be extracted and passed to format_result() in the list of extracted important values.

Type:

bool

Returns:

The formatted SourcedValue.

Return type:

T

class impacthpc.Job(cluster_name: str, servers_count: ReplicableValue | str | int | float, duration: ReplicableValue | str, cpu_workload: ReplicableValue | str | int | float | None = None)#

A class representing a job executed on a Park.

cluster_name#

The name of the cluster this job is executed on. Should match one cluster defined in Park.clusters.

Type:

str

nodes_count#

The number of nodes used in the cluster by this job.

Type:

ReplicableValue | str | int | float

duration#

The duration of the job.

Type:

ReplicableValue | str

cpu_workload#

The CPU workload of the CPUs (a number between 0 and 100). Defaults to None.

Type:

ReplicableValue | int | float | None, optional

class impacthpc.MotherBoard(embodied_impacts: Impacts | None = None, electric_power: ReplicableValue | str | None = None, peak_power: ReplicableValue | str | None = None, idle_power: ReplicableValue | str | None = None)#

Subclass of Component representing a Motherboard.

This class uses the same estimation as BoavitzAPI, described in

Thibault Simon, David Ekchajzer, Adrien Berthelot, Eric Fourboul, Samuel Rince, et al.. BoaviztAPI: a bottom-up model to assess the environmental impacts of cloud services. HotCarbon’24 - 3rd Workshop on Sustainable Computer Systems, Jul 2024, Santa Cruz, United States. hal-04621947v3"

See the documentation of BoavitzAPI : https://doc.api.boavizta.org/Explanations/components/motherboard/

estimate_electric_power() ReplicableValue | None#

Instant consumption of motherboard is ignored.

Returns:

always returns None

Return type:

ReplicableValue | None

estimate_embodied_impacts() Impacts#

Estimate the embodied impacts of the motherboard.

Simply returns a constant impact defined in the config file under motherboard_embodied_impact.

Returns:

The motherboard embodied impacts .

Return type:

Impact | None

estimate_idle_power() ReplicableValue | None#

Returns the minimum consumption of the component, the consumption it has when no job are running

estimate_peak_power() ReplicableValue | None#

Returns the maximum consumption of the component

class impacthpc.Park(clusters: dict[str, Cluster], embodied_impacts: Impacts | None = None, electric_power: ReplicableValue | str | None = None, peak_power: ReplicableValue | str | None = None, idle_power: ReplicableValue | str | None = None, energy_intensity: EnergyIntensity | None = None, PUE: ReplicableValue | None = None, cooling: Cooling | None = None, batteries: list[Battery] | None = None)#

Represents a park of servers, a datacenter, or an HPC center.

embodied_impacts#

The embodied impacts of the park. If the value is known, estimate_embodied_impacts() returns it, otherwise an estimation is done based on other attributes. Defaults to None.

Type:

Impacts | str | None, optional

clusters#

A dictionary whose keys are names and values are clusters. Clusters are sets of nodes with the same specifications.

Type:

dict[str, Cluster]

energy_intensity#

Energy intensity of the electrical mix of the region where the park is running. This represents the impacts of producing 1 kWh of electricity. Defaults to the average energy intensity of Europe.

Type:

EnergyIntensity, optional

PUE#

The Power Usage Effectiveness of the park. This value is overridden by the PUE of the cluster if provided. Defaults to the value in the config file under default_values_park > PUE.

Type:

ReplicableValue, optional

cooling#

An instance of Cooling representing the cooling system. Only used for embodied impacts; consumption is estimated using the PUE. Defaults to an estimation of the cooling power installed based on the servers’ consumption.

Type:

Cooling | None, optional

batteries#

A list of Battery instances representing the emergency batteries. Defaults to an estimation based on the server consumption and the time to start the emergency power supply (this duration is defined in the config file under default_values_battery > duration).

Type:

list[Battery] | None, optional

estimate_electric_power() ReplicableValue#

Estimate the electric power of the park.

Sums the servers’ consumption, multiplied by their PUE (the PUE of the cluster if defined, otherwise the park’s PUE).

Returns:

The estimated instant consumption of the park.

Return type:

ReplicableValue

estimate_embodied_impacts() Impacts#

Estimate the embodied impacts of the park.

If embodied_impacts is not None, this method only returns it.

Otherwise, sums the embodied impacts of the servers in clusters, the batteries, and the cooling.

Returns:

The embodied impacts of the park.

Return type:

Impact

estimate_idle_power() ReplicableValue#

Estimate the static consumption (when 0% workload) of the park.

Sums the static consumption of the servers, multiplied by their PUE.

Returns:

The static consumption of the park.

Return type:

ReplicableValue

estimate_peak_power() ReplicableValue#

Estimate the peak consumption (maximum consumption, when maximal workload) of the park.

Sums the servers’ peak consumptions, multiplied by their PUE.

Returns:

The peak consumption of the park.

Return type:

ReplicableValue

job_impact(job: Job) Impacts#

Estimate the environmental impact of a job running on this park. This takes into account the impact of the electricity consumption of the job, as well as the embodied impact of the park attributed to this job.

This includes:

  • The Embedded impacts of the servers attributed to the job.

  • The impacts of electricity consumption of the job, based on energy_intensity.

  • The Embedded impacts of the batteries, using the Battery’s allocation method in addition to an allocation based on the proportion of the total consumption of the park that this job’s servers use.

  • The Embedded impacts of the cooling, using the Cooling’s allocation method in addition to an allocation based on the proportion of the total consumption of the park that this job’s servers use.

Parameters:

job (Job) – A job running on a cluster of the park. Its cluster must exist in the park.

Returns:

The total impact of the job.

Return type:

Impact

servers_power() ReplicableValue#

Estimate the consumption of all servers in the park, without accounting for the PUE.

Returns:

The sum of the consumptions of the servers in the park.

Return type:

ReplicableValue

class impacthpc.PowerMeasure(workload_percent: Quantity | str, power: Quantity | str)#
class impacthpc.PowerSupply(weight: ReplicableValue | None = None, embodied_impacts: Impacts | None = None, electric_power: ReplicableValue | str | None = None, peak_power: ReplicableValue | str | None = None, idle_power: ReplicableValue | str | None = None)#

Represents a power supply and computes its impacts.

This class uses the same estimation as BoavitzAPI, described in

Thibault Simon, David Ekchajzer, Adrien Berthelot, Eric Fourboul, Samuel Rince, et al.. BoaviztAPI: a bottom-up model to assess the environmental impacts of cloud services. HotCarbon’24 - 3rd Workshop on Sustainable Computer Systems, Jul 2024, Santa Cruz, United States. hal-04621947v3"

See the documentation of BoavitzAPI : https://doc.api.boavizta.org/Explanations/components/power_supply/

weight#

The weight of the power supply. Defaults to the value in the config file under default_value_power_supply > weight.

Type:

ReplicableValue | None, optional

estimate_electric_power() ReplicableValue | None#

Instant consumption of HDD is ignored.

Returns:

Always returns None.

Return type:

ReplicableValue | None

estimate_embodied_impacts() Impacts#

Estimate the embodied impacts of the CPU.

This is done by multiplying the weight by an impact factor defined in the config file under default_value_power_supply > impact_factor.

Returns:

The estimated embodied impacts of the CPU.

Return type:

Impact | None

estimate_idle_power() ReplicableValue | None#

Returns the minimum consumption of the component, the consumption it has when no job are running

estimate_peak_power() ReplicableValue | None#

Returns the maximum consumption of the component

class impacthpc.RAM(embodied_impacts: Impacts | None = None, electric_power: ReplicableValue | str | None = None, peak_power: ReplicableValue | str | None = None, idle_power: ReplicableValue | str | None = None, size: ReplicableValue | str | None = None, density: ReplicableValue | str | None = None, engraving_process_thickness: ReplicableValue | str | None = None, manufacturer: str | None = None)#

Subclass of Component representing a RAM stick.

This class uses the same estimation as BoavitzAPI, described in

Thibault Simon, David Ekchajzer, Adrien Berthelot, Eric Fourboul, Samuel Rince, et al.. BoaviztAPI: a bottom-up model to assess the environmental impacts of cloud services. HotCarbon’24 - 3rd Workshop on Sustainable Computer Systems, Jul 2024, Santa Cruz, United States. hal-04621947v3"

See the documentation of BoavitzAPI : https://doc.api.boavizta.org/Explanations/components/ram/

size#

The RAM size. Defaults to the value in the config file under default_values_ram > size.

Type:

ReplicableValue | str | None, optional

density#

RAM density is the quantity of data (in gigabytes) that a cm² of RAM contains. This value is expressed in GB/cm². Defaults to an estimation made by _estimate_density().

Type:

ReplicableValue | None, optional

engraving_process_thickness#

The thickness of the engraving process for manufacturing this RAM stick. If density is provided, this attribute is ignored. Defaults to None.

Type:

ReplicableValue | str | None, optional

manufacturer#

The manufacturing company. If density is provided, this attribute is ignored. Defaults to None.

Type:

str | None, optional

_estimate_density() ReplicableValue#

Estimate the RAM density of the RAM stick.

This estimation uses the manufacturer and the engraving_process_thickness. We first average the density of the RAM sticks in the file defined in the config file under csv > ram_manufacture that have the same manufacturer and the same engraving process thickness.

If there are no sticks like that, we average the density of sticks with the same manufacturer. If there are still no matching sticks, we average the density of the sticks with the same engraving process thickness. If no sticks match at all, we return the average density of all RAM sticks.

Returns:

The estimated RAM density of the RAM stick.

Return type:

ReplicableValue

estimate_electric_power() ReplicableValue#

Estimate the electric power of the RAM stick.

The estimation is based on the size and a factor indicating the consumption per gigabyte of RAM. This factor is defined in the config file under default_values_ram > electrical_consumption_per_gigabyte.

Returns:

The electric power of the RAM stick.

Return type:

ReplicableValue

estimate_embodied_impacts() Impacts#

Estimate the embodied impacts of the RAM.

The embodied impacts of the RAM are estimated using the formula: self._surface_impact_factor * surface + self._base_impact, where:

  • _surface_impact_factor is the impact of 1 cm² of RAM stick. It is defined in the config file under default_values_ram > surface_impact_factor.

  • surface is the surface of the RAM stick estimated from its size and its density.

  • _base_impact is a constant impact of every RAM stick, which includes packaging, transport, etc. It is defined in the config file under default_values_ram > base_impact.

Returns:

The embodied impacts of the RAM.

Return type:

Impact

estimate_idle_power() ReplicableValue | None#

Returns the minimum consumption of the component, the consumption it has when no job are running

estimate_peak_power()#

Estimate the peak (maximum) electric power of the CPU when the workload is 100%.

The CPU’s peak instant consumption is estimated using the estimate_electric_power() method with a workload of 100%.

Returns:

The electric power of the CPU.

Return type:

Impact

class impacthpc.Server(embodied_impacts: ~impacthpc.src.core.impacts.Impacts | None = None, components: ~typing.List[~typing.Tuple[Component, int]] = [], case: ~impacthpc.src.other_components.Case = <impacthpc.src.other_components.Case object>, allocation_method: AllocationMethod | None = None, usage_rate: ~impacthpc.src.core.ReplicableValue.ReplicableValue | None = None)#

Represents a Server / Node and is used to compute its impacts.

embodied_impacts#

The embodied impacts of the server. If the value is known, estimate_embodied_impacts() returns it, otherwise an estimation is done based on other attributes. Defaults to None.

Type:

Impacts | str | None, optional

components#

A list of the Component instances that represent the electronic components of the server, along with the number of each component in the server. Defaults to [].

Type:

List[Tuple[Component, int]], optional

allocation_method#

An allocation method for the server. Defaults to naive_allocation() for the default lifetime of a server, defined in the config file under default_values_server > lifetime.

Type:

AllocationMethod | None, optional

usage_rate#

The usage rate of the server, between 0 and 1. Defaults to the value defined in the config file under default_values_server > usage_rate.

Type:

ReplicableValue | None, optional

Example:#

Server(
    components=[
        (CPU(name=ExactName("Intel Xeon Gold 6132")), 2),
        (RAM(size=SourcedValue(name="ram_size", value="3 TB", source="User Input")), 1),
        (GPU(name=find_close_gpu_model_name("Nvidia Tesla V100")), 4), # In the spec, we don't know the exact variant of Nvidia V100 used, so we can use find_close_gpu_model_name result and it will average the matching GPUs
        (MotherBoard(), 1),
    ]
)

This represents a server with two Intel Xeon Gold 6132 CPUs, three terabytes of RAM, four Nvidia Tesla V100 GPUs, and a motherboard.

estimate_electric_power() ReplicableValue#

Estimate the electric power of the server.

The server’s instant consumption is the sum of its components’ power consumptions.

For Uncertainties, the sum of the components of the same type is done in dependent mode, i.e., CPUs’ consumptions are considered positively correlated (correlation = 1) with other CPUs’ consumptions, RAM sticks are correlated with other RAM sticks, etc.

The final sum of each group of the correlated consumptions is done in independent mode, i.e., they are considered uncorrelated (correlation = 0).

Returns:

The electric power of the server.

Return type:

ReplicableValue

estimate_embedded_impacts(job_duration: ReplicableValue) Impacts#

Estimate the Embedded impacts of the server for the job.

Internally uses estimate_embodied_impacts() and passes it the allocation_method with the job_duration.

Parameters:

job_duration (ReplicableValue) – The duration of the job we want to allocate the embodied impacts to.

Returns:

The Embedded impacts of the server for the job.

Return type:

Impact

estimate_embodied_impacts() Impacts#

Estimate the embodied impacts of the server.

The server’s embodied impacts are the sum of its components’ embodied impacts.

For Uncertainties, the sum of the components of the same type is done in dependent mode, i.e., CPUs’ impacts are considered positively correlated (correlation = 1) with other CPUs’ impacts, RAM sticks are correlated with other RAM sticks, etc.

The final sum of each group of the correlated impacts is done in independent mode, i.e., they are considered uncorrelated (correlation = 0).

Returns:

The embodied impacts of the server.

Return type:

Impact

estimate_idle_power() ReplicableValue#

Estimate the idle power of the server.

The server’s static consumption is the sum of its components’ power consumptions at idle.

For Uncertainties, the sum of the components of the same type is done in dependent mode, i.e., CPUs’ consumptions are considered positively correlated (correlation = 1) with other CPUs’ consumptions, RAM sticks are correlated with other RAM sticks, etc.

The final sum of each group of the correlated consumptions is done in independent mode, i.e., they are considered uncorrelated (correlation = 0).

Returns:

The idle power of the server.

Return type:

ReplicableValue

estimate_peak_power() ReplicableValue#

Estimate the peak power of the server.

The server’s peak consumption is the sum of its components’ peak power consumptions.

For Uncertainties, the sum of the components of the same type is done in dependent mode, i.e., CPUs’ consumptions are considered positively correlated (correlation = 1) with other CPUs’ consumptions, RAM sticks are correlated with other RAM sticks, etc.

The final sum of each group of the correlated consumptions is done in independent mode, i.e., they are considered uncorrelated (correlation = 0).

Returns:

The peak power of the server.

Return type:

ReplicableValue

class impacthpc.SourcedValue(name: str, value: Quantity | str, min: Quantity | str | None = None, max: Quantity | str | None = None, source: str = 'No source available', standard_deviation: Quantity | str | None = None, warnings: List[str] = [], explaination: str | None = None, ontology: Ontology | None = None, important: bool = False)#

Subclass of ReplicableValue representing a leaf of the tree, as opposed to Operation, which represents the composed nodes of a tree.

In addition to the attributes of ReplicableValue, Operations have an operator and operands and can represent infix operations (like a + b, where the + operator is between the two operands) or prefix operations (like ln(a), where the operator is a function name before the operands).

source#

The source of this value, for example, a quote from a scientific article.

Type:

str

_as_formula() str#

Returns a string representing the formula this ReplicableValue represents.

For SourcedValue, returns the SourcedValue.name of the Sourcedvalue or a string representation of its value if name is None.

_explain_rec(formatter: ~impacthpc.src.core.formatters.Formatter[~typing.Any, T] = <impacthpc.src.core.formatters.TextFormatter object>, recursion_level: int = 0, already_seen_values: set[int] = {}) T#

Provides an explanation of the current object using the specified formatter. Calls the Formatter.format_sourced_value() of formatter and return its results.

Parameters:
  • formatter (Formatter[T], optional) – The formatter used to format the explanation. Defaults to TextFormatter.

  • recursion_level (int, optional) – The current recursion depth, used to control nested explanations . Defaults to 0.

Returns:

the resutl returned by Formatter.format_sourced_value()

Return type:

T

static from_argument(name: str, argument: ReplicableValue | str | int | float | None) ReplicableValue | None#

Creates a ReplicableValue from argument if it is not already one.

If argument is a ReplicableValue, it is returned as is. Otherwise, a new SourcedValue is created with the name name, the value argument, and the source "Argument". If argument is None, returns None.

Parameters:
  • name (str) – The name of the SourcedValue created if argument is not a ReplicableValue.

  • argument (ReplicableValue | str | int | float) – If it’s a ReplicableValue, it is returned as is. If it’s a string, a SourcedValue is created with this string as the value. If it is a number, it is converted into a string (with no unit) and a SourcedValue is created.

Returns:

The resulting ReplicableValue.

Return type:

ReplicableValue

static from_config(name: str, configEntry: dict[str, Any]) SourcedValue#

Create a SourcedValue from an entry of impacthpc.src.core.config.config

Example use :

SourcedValue.from_config("lifetime", config["default_values_ram"]["lifetime"])
Parameters:
  • name (str) – the name of the SourcedValue created

  • configEntry (dict[str, Any]) – a config entry

class impacthpc.TextFormatter(uncertainty_format: UncertaintyFormat = UncertaintyFormat.STANDARD_DEVIATION)#
format_extracted_important_values(name: str | None, value: Quantity, min: Quantity, max: Quantity, standard_deviation: Quantity, source: str, explaination: str | None, warnings: List[str], ontology: Ontology | None) str#

Format extracted values which are the ReplicableValue instances with the Replicable.important boolean set to true. These values are extracted and can be used to format the final result in format_result().

Parameters:
  • name (str | None) – Name of the SourcedValue, if any. It is unique.

  • value (Quantity) – The central value, with units.

  • min (Quantity) – Minimum plausible value.

  • max (Quantity) – Maximum plausible value.

  • standard_deviation (Quantity) – Standard deviation (uncertainty) of the value.

  • source (str) – The source (quote, link, etc.) of the value.

  • warnings (List[str]) – List of warnings or notes about the value.

  • explanation (str | None) – Optional explanation or description.

  • ontology (str | None) – Optional ontology tag for semantic annotation.

Returns:

Formatted extracted important source value.

Return type:

T

format_operation(formula: str, name: str | None, value: Quantity, min: Quantity, max: Quantity, standard_deviation: Quantity, operator: str, operands: list[str], isInfix: bool, explaination: str | None, warnings: List[str], ontology: Ontology | None, recursion_level: int, already_seen: bool, important: bool) str#

Format an Operation instance. This method must be implemented.

Parameters:
  • formula (str) – A string representing the formula that the Operation represents, returned by Operation._as_formula().

  • name (str | None) – Name of the SourcedValue, if any. It is unique.

  • value (Quantity) – The central value, with units.

  • min (Quantity) – Minimum plausible value.

  • max (Quantity) – Maximum plausible value.

  • standard_deviation (Quantity) – Standard deviation (uncertainty) of the value.

  • operator (str) – The operator of this operation.

  • operands (list[T]) – List of the operands used in this operation, already formatted.

  • isInfix (bool) – True if the operation is infix (i.e., it’s a binary operation and the operator is placed between the operands, like A + B). False if the operation is prefix (i.e., the operation can have any number of parameters and is written as a function, like ln(a)).

  • warnings (List[str]) – List of warnings or notes about the value.

  • explanation (str | None) – Optional explanation or description.

  • ontology (str | None) – Optional ontology tag for semantic annotation.

  • recursion_level (int) – Recursion level is the depth of this value in the tree represented by the ReplicableValue on which we called ReplicableValue.explain().

  • already_seen (bool) – Whether the value has already been formatted in a previously traversed branch of the tree represented by the ReplicableValue on which we called ReplicableValue.explain(). The Operation._explain_rec() method uses Depth-First Search and respects the order of the Operation.operands list.

  • important (bool) – True if the value is an important intermediate result. If true, it will be extracted and passed to format_result() in the list of extracted important values.

Returns:

The formatted Operation.

Return type:

T

format_result(result: str, extracted_important_values: list[str])#

Format the final result. Does nothing by default, but can be overridden to process or modify the final result before ReplicableValue.explain() returns it.

For example, TextFormatter overrides format_result() in order to add the extracted important values at the beginning of the explanation. JSONFormatter override format_result() to use json.dumps() on the final dict returned by format_operation() and format_sourced_value()

Parameters:
  • result (T) – The formatted result of ReplicableValue._explain_rec().

  • extracted_important_values (list[T]) – The extracted important values. These can be used to add a quick recap of the important results at the beginning of the explanation.

Returns:

By default, returns the result parameter as is. Can be overridden to modify the final result before ReplicableValue.explain() returns it.

Return type:

T

format_sourced_value(name: str | None, value: Quantity, min: Quantity, max: Quantity, standard_deviation: Quantity, source: str, explaination: str | None, warnings: List[str], ontology: Ontology | None, recursion_level: int, already_seen: bool, important: bool) str#

Format a SourcedValue instance. This method must be implemented.

name#

Name of the SourcedValue, if any.

Type:

str | None

value#

The central value, with units.

Type:

Quantity

min#

Minimum plausible value.

Type:

Quantity

max#

Maximum plausible value.

Type:

Quantity

standard_deviation#

Standard deviation (uncertainty) of the value.

Type:

Quantity

source#

The source (quote, link, etc.) of the value.

Type:

str

warnings#

List of warnings or notes about the value.

Type:

List[str]

explanation#

Optional explanation or description.

Type:

str | None

ontology#

Optional ontology tag for semantic annotation.

Type:

str | None

recursion_level#

Recursion level is the depth of this value in the tree represented by the ReplicableValue on which we called ReplicableValue.explain().

Type:

int

already_seen#

Whether the value has already been formatted in a previously traversed branch of the tree represented by the ReplicableValue on which we called ReplicableValue.explain(). The Operation._explain_rec() method uses Depth-First Search and respects the order of the Operation.operands list.

Type:

bool

important#

True if the value is an important intermediate result. If true, it will be extracted and passed to format_result() in the list of extracted important values.

Type:

bool

Returns:

The formatted SourcedValue.

Return type:

T

class impacthpc.UncertaintyFormat(*values)#

The way the uncertainties should be formatted. See Uncertainty

MIN_MAX = Minimum and maximum values
STANDARD_DEVIATION = the standard deviation of the
MIN_MAX = 0#
STANDARD_DEVIATION = 1#
impacthpc.decrease_over_time_allocation(age: ReplicableValue | str) AllocationMethod#

First year of commissioning is 50% of the embodied impact, second year is 25%, third year is 12.5%, etc.

impacthpc.find_close_cpu_model_name(name: str, threshold: float = 90) FuzzymatchResult | None#

Fuzzymatch search for close CPU model names from a dataset using fuzzy matching on name, code name, and generation. This method can return zero (None),one (FuzzymatchSingleResult) or several matches (FuzzymatchMultipleResult). Returns the exact name of the CPU, making it suitable to use with CPU class.

Parameters:
  • name (str) – The user input string to search for.

  • threshold (float, optional) – The minimum similarity score (0–100) to consider a match. Defaults to 90.

Returns:

  • FuzzymatchSingleResult if a single good match is found.

  • FuzzymatchMultipleResult if multiple results are above the threshold.

  • None if no suitable match is found.

Return type:

FuzzymatchResult | None

impacthpc.find_close_gpu_model_name(name: str, threshold: float = 80) FuzzymatchResult | None#

Fuzzymatch search for close GPU model names from a dataset using fuzzy matching on name and variant. This method can return zero (None),one (FuzzymatchSingleResult) or several matches (FuzzymatchMultipleResult). Returns the exact name of the GPU, making it suitable to use with GPU class.

Parameters:
  • name (str) – The user input string to search for.

  • threshold (float, optional) – The minimum similarity score (0–100) to consider a match. Defaults to 80.

Returns:

  • FuzzymatchSingleResult if a single good match is found.

  • FuzzymatchMultipleResult if multiple results are above the threshold.

  • None if no suitable match is found.

Return type:

FuzzymatchResult | None

impacthpc.find_close_ram_manufacturer_name(name: str, threshold: float = 80) FuzzymatchResult | None#

Fuzzymatch search for close RAM manufacturer names from a dataset using fuzzy matching on name, variant and memory size. This method can return zero (None),one (FuzzymatchSingleResult) or several matches (FuzzymatchMultipleResult). Returns the exact name of the RAM, making it suitable to use with RAM class.

Parameters:
  • name (str) – The user input string to search for.

  • threshold (float, optional) – The minimum similarity score (0–100) to consider a match. Defaults to 80.

Returns:

  • FuzzymatchSingleResult if a single good match is found.

  • FuzzymatchMultipleResult if multiple results are above the threshold.

  • None if no suitable match is found.

Return type:

FuzzymatchResult | None

impacthpc.find_close_ssd_manufacturer_name(name: str, threshold: float = 80) FuzzymatchResult | None#

Fuzzymatch search for close SSD manufacturer names from a dataset using fuzzy matching on name, variant and memory size. This method can return zero (None),one (FuzzymatchSingleResult) or several matches (FuzzymatchMultipleResult). Returns the exact name of the SSD, making it suitable to use with SSD class.

Parameters:
  • name (str) – The user input string to search for.

  • threshold (float, optional) – The minimum similarity score (0–100) to consider a match. Defaults to 80.

Returns:

  • FuzzymatchSingleResult if a single good match is found.

  • FuzzymatchMultipleResult if multiple results are above the threshold.

  • None if no suitable match is found.

Return type:

FuzzymatchResult | None

impacthpc.naive_allocation(lifetime: ReplicableValue | str) AllocationMethod#

Naive allocation method consist of dividing the embodied impact of a component by its lifetime.

Functions#

find_close_cpu_model_name(name[, threshold])

Fuzzymatch search for close CPU model names from a dataset using fuzzy matching on name, code name, and generation.

find_close_gpu_model_name(name[, threshold])

Fuzzymatch search for close GPU model names from a dataset using fuzzy matching on name and variant.

find_close_ram_manufacturer_name(name[, ...])

Fuzzymatch search for close RAM manufacturer names from a dataset using fuzzy matching on name, variant and memory size.

find_close_ssd_manufacturer_name(name[, ...])

Fuzzymatch search for close SSD manufacturer names from a dataset using fuzzy matching on name, variant and memory size.

naive_allocation(lifetime)

Naive allocation method consist of dividing the embodied impact of a component by its lifetime.

decrease_over_time_allocation(age)

First year of commissioning is 50% of the embodied impact, second year is 25%, third year is 12.5%, etc.

Classes#

CPU([embodied_impacts, electric_power, ...])

Subclass of Component representing a CPU.

Server(embodied_impacts, components, ...)

Represents a Server / Node and is used to compute its impacts.

RAM([embodied_impacts, electric_power, ...])

Subclass of Component representing a RAM stick.

Park(clusters[, embodied_impacts, ...])

Represents a park of servers, a datacenter, or an HPC center.

HDD([embodied_impacts, electric_power, ...])

Subclass of Component representing a HDD disk.

PowerSupply([weight, embodied_impacts, ...])

Represents a power supply and computes its impacts.

Case([embodied_impacts, type, allocation_method])

ExactName(name)

SourcedValue(name, value[, min, max, ...])

Subclass of ReplicableValue representing a leaf of the tree, as opposed to Operation, which represents the composed nodes of a tree.

PowerMeasure(workload_percent, power)

TextFormatter([uncertainty_format])

HTMLFormatter([uncertainty_format])

JSONFormatter([uncertainty_format])

Cluster(server_model, servers_count[, PUE])

GPU([embodied_impacts, electric_power, ...])

Subclass of Component representing a GPU.

Job(cluster_name, servers_count, duration[, ...])

A class representing a job executed on a Park.

MotherBoard([embodied_impacts, ...])

Subclass of Component representing a Motherboard.

Impacts(impact_per_criteria)

UncertaintyFormat(*values)

The way the uncertainties should be formatted.

EnergyIntensity(value)

Environnental impact of 1 kWh of electricty.

Class Inheritance Diagram#

digraph inheritancee8475ee3df { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [URL="https://docs.python.org/3/library/abc.html#abc.ABC",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Helper class that provides a standard way to create an ABC using"]; "CPU" [URL="#impacthpc.CPU",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Subclass of :class:`Component` representing a CPU."]; "HasConsumptionAndEmbodiedImpacts" -> "CPU" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Case" [URL="#impacthpc.Case",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Representes case containing servers, used to computes it's `embodied impacts <TODO : REPLACE WITH ONTOLOGY OF EMBODIED IMPACT>`_ *"]; "HasEmbodiedImpacts" -> "Case" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Cluster" [URL="#impacthpc.Cluster",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "EnergyIntensity" [URL="#impacthpc.EnergyIntensity",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Environnental impact of 1 kWh of electricty. If you don't know the exact value, you can use the :meth:`at_location` to find the energy intensity in a country or a region."]; "Enum" [URL="https://docs.python.org/3/library/enum.html#enum.Enum",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Create a collection of name/value pairs."]; "ExactName" [URL="#impacthpc.ExactName",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="ExactName(name: str)"]; "Name" -> "ExactName" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Formatter" [URL="core.html#impacthpc.src.core.Formatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Abstract class Formatter defines a simple API for formatting the :class:`ReplicableValue` in the :meth:`ReplicableValue.explain` method."]; "ABC" -> "Formatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Generic" -> "Formatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "GPU" [URL="#impacthpc.GPU",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Subclass of :class:`Component` representing a GPU."]; "HasConsumptionAndEmbodiedImpacts" -> "GPU" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Generic" [URL="https://docs.python.org/3/library/typing.html#typing.Generic",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Abstract base class for generic types."]; "HDD" [URL="#impacthpc.HDD",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Subclass of :class:`Component` representing a HDD disk."]; "HasConsumptionAndEmbodiedImpacts" -> "HDD" [arrowsize=0.5,style="setlinewidth(0.5)"]; "HTMLFormatter" [URL="#impacthpc.HTMLFormatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "Formatter" -> "HTMLFormatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "HasConsumptionAndEmbodiedImpacts" [URL="computation.html#impacthpc.src.HasConsumptionAndEmbodiedImpacts",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Abstract class defining the methods for estimating `electric power <TODO : REPLACE WITH ONTOLOGY OF ELECTRIC POWER>`_, `peak power <TODO : REPLACE WITH ONTOLOGY OF ELECTRIC POWER>`_ and `idle power <TODO : REPLACE WITH ONTOLOGY OF ELECTRIC POWER>`_"]; "HasEmbodiedImpacts" -> "HasConsumptionAndEmbodiedImpacts" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ABC" -> "HasConsumptionAndEmbodiedImpacts" [arrowsize=0.5,style="setlinewidth(0.5)"]; "HasEmbodiedImpacts" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "ABC" -> "HasEmbodiedImpacts" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Impacts" [URL="#impacthpc.Impacts",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "JSONFormatter" [URL="#impacthpc.JSONFormatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "Formatter" -> "JSONFormatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Job" [URL="#impacthpc.Job",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A class representing a job executed on a :class:`Park`."]; "MotherBoard" [URL="#impacthpc.MotherBoard",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Subclass of :class:`Component` representing a Motherboard."]; "HasConsumptionAndEmbodiedImpacts" -> "MotherBoard" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Name" [URL="core.html#impacthpc.src.core.Name",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Name()"]; "ABC" -> "Name" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Park" [URL="#impacthpc.Park",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Represents a park of servers, a datacenter, or an HPC center."]; "HasConsumptionAndEmbodiedImpacts" -> "Park" [arrowsize=0.5,style="setlinewidth(0.5)"]; "PowerMeasure" [URL="#impacthpc.PowerMeasure",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "PowerSupply" [URL="#impacthpc.PowerSupply",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Represents a power supply and computes its impacts."]; "HasConsumptionAndEmbodiedImpacts" -> "PowerSupply" [arrowsize=0.5,style="setlinewidth(0.5)"]; "RAM" [URL="#impacthpc.RAM",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Subclass of :class:`Component` representing a RAM stick."]; "HasConsumptionAndEmbodiedImpacts" -> "RAM" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ReplicableValue" [URL="core.html#impacthpc.src.core.ReplicableValue",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="ReplicableValue is a core class of ImpactHPC for representing numerical values with associated uncertainties and provenance."]; "ABC" -> "ReplicableValue" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Server" [URL="#impacthpc.Server",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Represents a :ref:`server` and is used to compute its impacts."]; "HasConsumptionAndEmbodiedImpacts" -> "Server" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SourcedValue" [URL="#impacthpc.SourcedValue",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Subclass of :class:`ReplicableValue` representing a leaf of the tree, as opposed to :class:`Operation`, which represents the composed nodes of a tree."]; "ReplicableValue" -> "SourcedValue" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TextFormatter" [URL="#impacthpc.TextFormatter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "Formatter" -> "TextFormatter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "UncertaintyFormat" [URL="#impacthpc.UncertaintyFormat",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="The way the uncertainties should be formatted. See :ref:`uncertainty`"]; "Enum" -> "UncertaintyFormat" [arrowsize=0.5,style="setlinewidth(0.5)"]; }