GPU#
- 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)
Bases:
HasConsumptionAndEmbodiedImpacts
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 offind_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
Methods Summary
Methods Documentation
- _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 providedfamily
, 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:
- _get_gpu_within_date_range() DataFrame
Return a sub-dataframe of
gpu_specs
containing only the rows withinrelease_range
.- Returns:
A sub-dataframe of
gpu_specs
containing only the rows withinrelease_range
.- Return type:
pandas.DataFrame
- _get_gpus_matching_by_name() DataFrame
Return a sub-dataframe of
gpu_specs
containing only the row matchingname
.Return an empty dataframe with the same columns as
gpu_specs
ifname
is None.- Raises:
ValueError –
name
should be an instance of the abstract className
or None. Therefore, it can be anExactName
, aFuzzymatchSingleResult
, aFuzzymatchMultipleResult
, or None.- Returns:
A sub-dataframe of
gpu_specs
containing only the row matchingname
.- 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 orname
is not knowm, returns None.- Returns:
the ram size based on the
name
and the database. If the RAM size isn’t in database orname
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:
- 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