Skip to content

Latest commit

 

History

History
120 lines (84 loc) · 3.78 KB

File metadata and controls

120 lines (84 loc) · 3.78 KB

Teads' CPU Estimation Model

Note

Teads-Curve is a community model, not part of the IF standard library. This means the IF core team are not closely monitoring these models to keep them up to date. You should do your own research before implementing them!

Teads Engineering team has built a model that is capable of estimating CPU usages across varying type of CPUs using a curve commonly known as Teads Curve.

Model name

IF recognizes the Teads CPU model as teads-curve.

Parameters

Model config

  • thermal-design-power: the TDp of the processor
  • interpolation: the interpolation method to apply to the TDP data

Observations

  • cpu-util: percentage CPU utilization for the observation

Returns

  • energy-cpu: The energy used by the CPU, in kWh

Note If vcpus-allocated and vcpus-total are available, these data will be used to scale the CPU energy usage. If they are not present, we assume the entire processor is being used. For example, if only 1 out of 64 available vCPUS are allocated, we scale the processor TDP by 1/64.

Implementation

Linear Interpolation

This model implements linear interpolation by default for estimating energy consumption using the TDP of a chip.

The power curve provided for IDLE, 10%, 50%, 100% in the Teads Curve are used by default.

The algorithm in linear interpolation will take the lowest possible base value + linear interpolated value. ie. 75% usage will be calculated as follows. 100% and 50% are the known values hence we are interpolating linearly between them. (50% + (100%-50%) x (75%-50%)) x thermal-design-power.

Example

import {TeadsCurveModel} from 'ief';

const teads = new TeadsCurveModel();
teads.configure({
  thermal-design-power: 100, // thermal-design-power of the CPU
});
const results = teads.execute([
  {
    duration: 3600, // duration institute
    cpu: 100, // CPU usage as a value between 0 to 100 in percentage
    datetime: '2021-01-01T00:00:00Z', // ISO8601 / RFC3339 timestamp
  },
]);

Spline Curve Approximation

This method implements the spline curve approximation using typescript-cubic-spline. It is not possible to customize the spline behaviour as of now.

Resulting values are an estimate based on the testing done by Teads' Engineering Team. Further information can be found in the following links.

  1. TEADS Engineering: Building An AWS EC2 Carbon Emissions Dataset
  2. TEADS Engineering: Estimating AWS EC2 Instances Power Consumption

Example

import {TeadsCurveModel, Interpolation} from '@grnsft/if-unofficial-models';

const teads = new TeadsCurveModel();
teads.configure({
  tdp: 100, // TDP of the CPU
  interpolation: Interpolation.SPLINE,
});
const results = teads.execute([
  {
    duration: 3600, // duration institute
    cpu: 100, // CPU usage as a value between 0 to 100 in percentage
    datetime: '2021-01-01T00:00:00Z', // ISO8601 / RFC3339 timestamp
  },
]);

Example impl

name: teads-cpu
description: simple demo invoking teads-cpu
tags:
initialize:
  models:
    - name: teads-cpu
      model: TeadsCurveModel
      path: '@grnsft/if-unofficial-models'
graph:
  children:
    child:
      pipeline:
        - teads-cpu
      inputs:
        - timestamp: 2023-07-06T00:00
          duration: 3600
          thermal-design-power: 300

You can run this by passing it to impact-engine. Run impact using the following command run from the project root:

npm i -g @grnsft/if
npm i -g @grnsft/if-unofficial-models
impact-engine --impl ./examples/impls/teads-cpu.yml --ompl ./examples/ompls/teads-cpu.yml