Power / Energy
Example
General power information:
julia> power = LIKWID.Power.get_power_info()
LIKWID.PowerInfo
├ baseFrequency: 3300.0 MHz
├ minFrequency: 1200.0 MHz
├ turbo: TurboBoost()
├ hasRAPL: true
├ powerUnit: 125000.0
├ timeUnit: 976.0
├ uncoreMinFreq: 1200.0 MHz
├ uncoreMaxFreq: 2400.0 MHz
├ perfBias: 6
└ domains: ... (5 elements)
julia> power.domains
(PowerDomain(PKG, ...), PowerDomain(PP0, ...), PowerDomain(PP1, ...), PowerDomain(DRAM, ...), PowerDomain(PLATFORM, ...))
julia> first(power.domains)
LIKWID.PowerDomain
├ id: 0
├ type: PKG
├ supportFlags: 27
├ energyUnit: 6.103515625e-5
├ tdp: 1.65e8
├ minPower: 6.8e7
├ maxPower: 1.65e8
├ maxTimeWindow: 31232.0
├ supportInfo: true
├ supportStatus: true
├ supportPerf: true
├ supportPolicy: false
└ supportLimit: true
Energy measurement:
julia> LIKWID.Power.measure(; cpuid=0, domainid=0) do
sleep(1)
end
29.9920654296875 μJ
julia> LIKWID.Power.measure(; cpuid=0, domainid=0) do
sum(sin(rand()) for _ in 1:1_000_000)
end
0.5574951171875 μJ
(Note that the example requires that the first (perhaps only) Julia thread is pinned to the CPU thread with id 0
.)
Index
LIKWID.Power.finalize
LIKWID.Power.get_power
LIKWID.Power.get_power_info
LIKWID.Power.init
LIKWID.Power.measure
LIKWID.Power.start_power
LIKWID.Power.stop_power
LIKWID.LibLikwid.PowerType
LIKWID.PowerDomain
LIKWID.PowerInfo
LIKWID.TurboBoost
Functions
LIKWID.Power.init
— FunctionInitialize power measurements for the given CPU. Returns the RAPL status, i.e. false
(no RAPL) or true
(RAPL working).
LIKWID.Power.finalize
— FunctionFinalize power measurements.
LIKWID.Power.get_power_info
— Functionget_power_info() -> LIKWID.PowerInfo
Get power / energy information.
LIKWID.Power.start_power
— FunctionReturn the start value for a cpu (cpuid
) for the domain with domainid
.
LIKWID.Power.stop_power
— FunctionReturn the stop value for a cpu (cpuid
) for the domain with domainid
.
LIKWID.Power.get_power
— Functionget_power(p_start::Integer, p_stop::Integer, domainid::Integer)
Calculate the μJ from the values retrieved by start_power()
and stop_power()
.
LIKWID.Power.measure
— Functionmeasure(f; cpuid::Integer=0, domainid::Integer)
Measure / calculate the energy for the given cpuid
and domainid
over the execution of the function f
using Power.start_power
, Power.stop_power
, etc. under the hood. Automatically initializes and finalizes the power module.
Examples
julia> LIKWID.Power.measure(; cpuid=0, domainid=0) do
sleep(1)
end
15.13702392578125 μJ
Types
LIKWID.PowerInfo
— TypePower information
LIKWID.PowerDomain
— TypePower domain information
LIKWID.LibLikwid.PowerType
— TypeDifferent types of power domains
LIKWID.TurboBoost
— TypeTurbo boost information