Computations#

impacthpc.src Package#

class impacthpc.src.Battery(embodied_impacts: Impacts | None = None, capacity: ReplicableValue | None = None, server_consumption: ReplicableValue | None = None, battery_duration: ReplicableValue | str | None = None, battery_type: str | None = None, allocation_method: AllocationMethod | None = None)#

Represents the emergency batteries and is used to compute their embodied impacts .

Either capacity or both server_consumption and battery_duration must be defined.

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

capacity#

The battery capacity. If None, it will be estimated from server_consumption and battery_duration.

Type:

ReplicableValue | None, optional

server_consumption#

The consumption of the server. Defaults to None.

Type:

ReplicableValue | None, optional

battery_duration#

The battery’s expected duration with a consumption of server_consumption. Defaults to the value in the config file under default_values_battery > duration.

Type:

ReplicableValue | str | None, optional

battery_type#

The type of the battery, which can be VRLA, LFP, LTO, LMO, NCM, NCA, NaNiCl, or VRFB. Defaults to the value in the config file under default_values_battery > type.

Type:

str | None, optional

allocation_method#

The Allocation Method used to attribute a part of the battery’s embodied impacts to a specific job. Defaults to naive_allocation(), where the lifetime is the value in the config file under default_values_battery > lifetime.

Type:

AllocationMethod | None, optional

_battery_density() ReplicableValue#

Calculate the Battery density:, i.e., the energy that can be contained in 1 kilogram of battery.

Raises:

ValueError – Raised if battery_type is not one of VRLA, LFP, LTO, LMO, NCM, NCA, NaNiCl, or VRFB.

Returns:

The energy contained in 1 kilogram of battery.

Return type:

ReplicableValue

_impact_per_kg(battery_type: str) Impacts#

Estimate the impact of 1 kilogram of battery, based on the battery type.

Parameters:

battery_type (str) – The battery type, which can be VRLA, LFP, LTO, LMO, NCM, NCA, NaNiCl, or VRFB.

Raises:

ValueError – If the battery type is not known.

Returns:

The impacts of 1 kilogram of battery.

Return type:

Impact

estimate_embedded_impacts(job_duration: ReplicableValue)#

Estimate the Embedded impacts of the batteries 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 batteries for the job.

Return type:

Impact

estimate_embodied_impacts() Impacts#

Estimate the embodied impacts of the battery.

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

Otherwise, the formula used is: impact_per_kilo * weight, where:

Returns:

The embodied impacts of the Battery.

Return type:

Impact

class impacthpc.src.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.src.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.src.CaseType(*values)#
BLADE = 'BLADE'#
RACK = 'RACK'#
class impacthpc.src.Cooling(cooling_power: ReplicableValue | str, embodied_impacts: Impacts | None = None, allocation_method: AllocationMethod | None = None)#

Represents the cooling system and is used to compute its embodied impacts <TODO : REPLACE WITH ONTOLOGY OF EMBODIED IMPACTS>`_.

embodied_impacts#

The embodied impacts of the cooling system. 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

cooling_power#

The cooling power, in watts.

Type:

ReplicableValue | str

allocation_method#

An Allocation Method used to attribute a part of the embodied impact of the cooling system to a specific job.

Type:

AllocationMethod

embedded_impacts(job_duration: ReplicableValue) Impacts#

Estimate the Embedded impacts of the cooling system 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 cooling system for the job.

Return type:

Impact

estimate_embodied_impacts() Impacts#

Estimate the embodied impacts of the cooling system.

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

The embodied impacts of the cooling system are reduced to the impact of the refrigeration unit.

Interpolation factors are defined for the different phases. The extrapolation factor for a refrigeration unit of X watts is a number close to 1, which, when multiplied by the reference impacts (defined in the config file under csv > cooling_impacts), gives the impact of a refrigeration unit of X watts. For our estimation, we interpolate between the two closest extrapolation factors (defined in the config file under csv > cooling_extrapolation_factors).

For example, if the cooling_power is 355 W, to compute the impact of the manufacturing phase, we will interpolate between the two closest extrapolation factors: for 346 W it’s 1.12, and for 380 W it’s 1.099. The interpolated factor is then multiplied by the reference impact (for the GWP impact, it’s 60.4 kg CO2eq) to give the impact of the 355 W refrigeration unit.

Returns:

The embodied impact of the cooling system.

Return type:

Impact

class impacthpc.src.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.src.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.src.HasConsumptionAndEmbodiedImpacts(embodied_impacts: Impacts | None = None, electric_power: ReplicableValue | str | None = None, peak_power: ReplicableValue | str | None = None, idle_power: ReplicableValue | str | None = None)#

Abstract class defining the methods for estimating electric power, peak power and idle power

embodied_impacts#

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

Type:

Impacts | None, optional

electric_power#

The electric power of the component. If the value is known, estimate_electric_power() returns it, otherwise an estimation is done based on other attributes. Defaults to None.

Type:

ReplicableValue | str | None, optional

peak_power#

The peak power of the component. If the value is known, estimate_peak_power() returns it, otherwise an estimation is done based on other attributes . Defaults to None.

Type:

ReplicableValue | str | None, optional

idle_power#

The idle power of the component. If the value is known, estimate_idle_power() returns it, otherwise an estimation is done based on other attributes. Defaults to None.

Type:

ReplicableValue | str | None, optional

__repr__()#

Return repr(self).

abstractmethod estimate_electric_power() ReplicableValue | 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.src.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.src.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.src.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.src.PowerMeasure(workload_percent: Quantity | str, power: Quantity | str)#
class impacthpc.src.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.src.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.src.SSD(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, manufacturer: str | None = None, layers: int | 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/ssd/

size#

The SSD size. Defaults to the value in the config file under default_values_ssd > size.

Type:

ReplicableValue | str | None, optional

density#

The SSD density. Defaults to an estimation made by _estimate_density().

Type:

ReplicableValue | str | None, optional

manufacturer#

_description_. Defaults to None.

Type:

str | None, optional

layers#

_description_. Defaults to None.

Type:

int | None, optional

_estimate_density() ReplicableValue#

Estimate the SSD density of the RAM stick.

This estimation uses the manufacturer and the layers. We first average the density of the SSD in the file defined in the config file under csv > ssd_manufacture that have the same manufacturer and the same number of layers.

If there are no SSD like that, we average the density of SSD with the same manufacturer. If there are still no matching SSD, we average the density of the SSD with the same number of layers. If no SSD match at all, we return the average density of all SSDs.

Returns:

The estimated RAM density of the RAM stick.

Return type:

ReplicableValue

estimate_electric_power() ReplicableValue | None#

SSD electrical consumption is ignored

Returns:

always returns None

Return type:

ReplicableValue | None

estimate_embodied_impacts() Impacts#

Estimate the embodied impacts of the SSD.

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

  • _surface_impact_factor is the impact of 1 cm² of SSD. It is defined in the config file under default_values_ssd > surface_impact_factor.

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

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

Returns:

The embodied impacts of the SSD.

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.src.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

Classes#

Battery([embodied_impacts, capacity, ...])

HasConsumptionAndEmbodiedImpacts([...])

Cooling(cooling_power[, embodied_impacts, ...])

Represents the cooling system and is used to compute its embodied impacts <TODO : REPLACE WITH ONTOLOGY OF EMBODIED IMPACTS>`_.

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

Subclass of Component representing a CPU.

PowerMeasure(workload_percent, power)

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.

Case([embodied_impacts, type, allocation_method])

CaseType(*values)

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

Represents a power supply and computes its impacts.

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

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

EnergyIntensity(value)

Environnental impact of 1 kWh of electricty.

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

Subclass of Component representing a RAM stick.

Server(embodied_impacts, components, ...)

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

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

Subclass of Component representing a RAM stick.

Class Inheritance Diagram#

digraph inheritance31af109fc8 { 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"]; "Battery" [URL="#impacthpc.src.Battery",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 the emergency batteries and is used to compute their `embodied impacts <TODO : REPLACE WITH ONTOLOGY OF EMBODIED IMPACT>`_ ."]; "HasEmbodiedImpacts" -> "Battery" [arrowsize=0.5,style="setlinewidth(0.5)"]; "CPU" [URL="exposed.html#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="exposed.html#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)"]; "CaseType" [URL="#impacthpc.src.CaseType",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"]; "Enum" -> "CaseType" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Cooling" [URL="#impacthpc.src.Cooling",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 the cooling system and is used to compute its `embodied impacts <TODO : REPLACE WITH ONTOLOGY OF EMBODIED IMPACTS>`_`."]; "HasEmbodiedImpacts" -> "Cooling" [arrowsize=0.5,style="setlinewidth(0.5)"]; "EnergyIntensity" [URL="exposed.html#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."]; "GPU" [URL="exposed.html#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)"]; "HasConsumptionAndEmbodiedImpacts" [URL="#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)"]; "Job" [URL="exposed.html#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="exposed.html#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)"]; "Park" [URL="exposed.html#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="exposed.html#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="exposed.html#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="exposed.html#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)"]; "SSD" [URL="#impacthpc.src.SSD",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" -> "SSD" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Server" [URL="exposed.html#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)"]; }