mlco2 / codecarbon

Track emissions from Compute and recommend ways to reduce their impact on the environment.
https://mlco2.github.io/codecarbon
MIT License
1.11k stars 173 forks source link

Unable to access the Intel RAPL interface with an Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz processor. #493

Closed AntoinePlanche closed 8 months ago

AntoinePlanche commented 8 months ago

Description

I'm trying to monitor the energy consumption of a python code that I'm running on my company's bare metal servers. The server's Intel RAPL interface exists, codecarbon detects it but returns to constant mode. The warning tells me to contact you.

What I Did

input : python3 train_CDR_CNN.py trace : [codecarbon INFO @ 17:14:47] [setup] CPU Tracking... [codecarbon INFO @ 17:14:47] Tracking Intel CPU via RAPL interface [codecarbon WARNING @ 17:14:48] No CPU tracking mode found. Falling back on CPU constant mode. [codecarbon WARNING @ 17:14:49] We saw that you have a Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz but we don't know it. Please contact us. [codecarbon INFO @ 17:14:49] CPU Model on constant consumption mode: Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz [codecarbon INFO @ 17:14:49] >>> Tracker's metadata: [codecarbon INFO @ 17:14:49] Platform system: Linux-5.4.0-146-generic-x86_64-with-glibc2.29 [codecarbon INFO @ 17:14:49] Python version: 3.8.10 [codecarbon INFO @ 17:14:49] CodeCarbon version: 2.3.3 [codecarbon INFO @ 17:14:49] Available RAM : 125.806 GB [codecarbon INFO @ 17:14:49] CPU count: 48 [codecarbon INFO @ 17:14:49] CPU model: Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz [codecarbon INFO @ 17:14:49] GPU count: None [codecarbon INFO @ 17:14:49] GPU model: None

LuisBlanche commented 8 months ago

Hi @AntoinePlanche, thanks for using CodeCarbon ! You can find out the logic of how codecarbon will measure your CPU consumption in the methodology doc

For some reason, CodeCarbon does not seem to be authorized to access your RAPL files, it can be linked to https://github.com/mlco2/codecarbon/issues/244 where you can probably find some workaround

For the constant part we keep a list of CPU's TDP (Thermal Design Power) here . This message means that your CPU is not in this list. Do you have access to your CPU's TDP ?

AntoinePlanche commented 8 months ago

Hello Luis,

Thank you for your previous response. I am experiencing an issue with CodeCarbon, where it seems to have difficulty accessing the RAPL Interface. Intriguingly, even when it appears unable to access this interface, I do not receive the expected warning. The log outputs [codecarbon INFO @ 17:14:47] Tracking Intel CPU via RAPL interface, suggesting that CodeCarbon is able to access the Intel RAPL interface. This line does not appear when CodeCarbon cannot access the Intel RAPL interface. Yet, immediately after this, CodeCarbon switches to constant mode, as indicated by the warning [codecarbon WARNING @ 17:14:48] No CPU tracking mode found. Falling back on CPU constant mode.

I have already modified the permissions of the Intel RAPL interface using chmod and have added a line in the /etc/sysfs.conf file. Indeed, for the constant part, it seems that my CPU is not in the list of CPU's TDP.

Best regards, Antoine Planche

LuisBlanche commented 8 months ago

@benoit-cty any ideas on this ?

benoit-cty commented 8 months ago

Hello, Can you activate the debug log, with log_level = "DEBUG" or set your config file with :

[codecarbon]
log_level = DEBUG
inimaz commented 8 months ago

Hello! After checking the log sequence, I think I might have found the issue. There was a minor bug at the moment of selecting the CPU in the emission_tracker. #497 for more info on the small fix.

@AntoinePlanche I have added your CPU via #498, so if the fix still does not work, at least cc will recognize your TDP and use it in constant mode.

benoit-cty commented 8 months ago

Thanks for reporting this, there was an error in 2.3.3, the new release 2.3.4 fix it, it's available on Pipy : https://pypi.org/project/codecarbon/2.3.4/

Sorry for that.

AntoinePlanche commented 8 months ago

Thanks everyone, it works now !