Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

The impact of RAM and CPU usage is counted twice #287

Open
da-ekchajzer opened this issue Apr 19, 2024 · 0 comments
Open

The impact of RAM and CPU usage is counted twice #287

da-ekchajzer opened this issue Apr 19, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@da-ekchajzer
Copy link
Collaborator

da-ekchajzer commented Apr 19, 2024

Bug description

RAM and CPUs power are assessed for the number of units. When their impacts are assessed, we also apply the number of units. RAM and CPU impacts. It has no consequences on the server and cloud impact calculation since we use diretcly use the power for RAM and CPU

CPU consumption

  def model_power_consumption(self) -> ImpactFactor:
        self.usage.consumption_profile = CPUConsumptionProfileModel()

        self.usage.consumption_profile.compute_consumption_profile_model(cpu_manufacturer=self.manufacturer.value,
                                                                         cpu_model_range=self.model_range.value,
                                                                         cpu_tdp=self.tdp.value)

        if type(self.usage.time_workload.value) in (float, int):
            self.usage.avg_power.set_completed(
                self.usage.consumption_profile.apply_consumption_profile(self.usage.time_workload.value))
        else:
            self.usage.avg_power.set_completed(
                self.usage.consumption_profile.apply_multiple_workloads(self.usage.time_workload.value))

        return ImpactFactor(
            value=rd.round_to_sigfig(self.usage.avg_power.value, 5) * self.units.value,
            min=rd.round_to_sigfig(self.usage.avg_power.value, 5) * self.units.min,
            max=rd.round_to_sigfig(self.usage.avg_power.value, 5) * self.units.max
        )

RAM consumption

    def model_power_consumption(self, ) -> ImpactFactor:
        self.usage.consumption_profile = RAMConsumptionProfileModel()
        self.usage.consumption_profile.compute_consumption_profile_model(ram_capacity=self.capacity.value)

        if type(self.usage.time_workload.value) in (float, int):
            self.usage.avg_power.set_completed(
                self.usage.consumption_profile.apply_consumption_profile(self.usage.time_workload.value))
        else:
            self.usage.avg_power.set_completed(
                self.usage.consumption_profile.apply_multiple_workloads(self.usage.time_workload.value))

        return ImpactFactor(
            value=rd.round_to_sigfig(self.usage.avg_power.value, 5)*self.units.value,
            min=rd.round_to_sigfig(self.usage.avg_power.value, 5)*self.units.min,
            max=rd.round_to_sigfig(self.usage.avg_power.value, 5)*self.units.max
        )

Impact assesment

def compute_single_impact(model: Union[Component, Device, Service],
                          phase: str,
                          criteria: str,
                          duration: Union[int, str] = config["default_duration"],
                          allocation: float = 1) -> Optional[Impact]:
    try:
        impact_function = get_impact_function(model, phase)

        impact, min_impact, max_impact, warnings = impact_function(criteria, duration, model)

        result = Impact(
            value=impact * model.units.value * allocation,
            min=min_impact * model.units.min * allocation,
            max=max_impact * model.units.max * allocation,
            warnings=list(set(warnings))
        )

        model.add_impacts(result, criteria, phase)

        return result
    except (AttributeError, NotImplementedError):
        model.add_impacts(None, criteria, phase)
        return None
@da-ekchajzer da-ekchajzer added the bug Something isn't working label Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant