powerapi-ng / pyRAPL

a library to measure the python energy consumption of python code
MIT License
101 stars 9 forks source link

DRAM consumption output #13

Closed hassenebyy closed 11 months ago

hassenebyy commented 3 years ago

Hi everyone,

I've noticed that the DRAM output is expressed in seconds. "dram (Optional[List[float]]) – list of the RAM energy consumption -expressed in seconds- (one value for each socket) if None, no RAM energy consumption was recorded."

Can you explain why the energy consumption is not expressed in micro-Joules ? Otherwise, how can I obtain the equivalence in Joules ?

Thank you, Best regards.

av1m commented 2 years ago

I take advantage of this issue to add that the return in seconds seems strange to me. Indeed, I get results such as [9643.0], [12817.0] for a code that runs in 0.4 seconds

Here is the code

import pyRAPL
pyRAPL.setup()

baz = pyRAPL.Measurement("baz")
baz.begin()
list(range(10000))
baz.end()
print(baz.result.dram)
# [12024.0]
smenard commented 1 year ago

In the class DramAPI, the file read is energy_uj same name as the one in PkgAPI, guessing that it means energy in micro joule.

Andlexex commented 1 year ago

I would also say, that there is an error in the documentation. The average power that 8gb of RAM require is approx 3W (as a rule of thumb). I ran pyRAPL on just my system for 10 minutes and recorded the energy usage per second into a file.

The results show, that my RAM (of which 0.96GB were allocated at that time) would consume 2063.622961J which corresponds to a power demand of approx 3.439371W. This would somewhat approve the assumption of the output being displayed in micro Joules for the RAM as well.