powerapi-ng / pyJoules

A Python library to capture the energy consumption of code snippets
MIT License
70 stars 10 forks source link

negative energie value in csv report #16

Open PierreRust opened 3 years ago

PierreRust commented 3 years ago

I've been using pyJoules to measure the energy consumption of a rather long machine learning inference and I have, in one case, a negative value. In the output cvs file, I have the following :

timestamp;tag;duration;package_0
1614164969.4923563;;288.83703422546387;-253371267933.0

I'm not using the decorator but instead I create an EnergyMeter manually:

    devices = DeviceFactory.create_devices([RaplPackageDomain(0)])
    pj_meter = EnergyMeter(devices)
    pj_meter.start()

    # Actual work here ...

    pj_meter.stop()
    trace = pj_meter.get_trace()
    handler = CSVHandler(filename=f"{args.pyjoules}/pyjoules.csv")  
    handler.process(trace)
    handler.save_data()

One thing I have noted, is that is seems to happen on a two-socket machine, but not on my laptop (although that could very well be a coincidence).

Any idea on what could happen here ? is there anything I can do to help debugging it ?