You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in your cpu_power.csv I can only find the Apple M1 chip. Since I started to use your tool on my M3 Pro it does not really find the TDP for this model. I did some research to get the number for all models together. As fare as I know Apple does not provide these numbers so all sources are external:
Hello,
Codecarbon tracks Apple Silicon Chip energy consumption using powermetrics. It should be available natively on any mac. However, this tool is only usable with sudo rights.
I agree with your comment but I do think in general the support for M3/4 is not provided. I have the following issues:
[codecarbon WARNING @ 23:26:23] We saw that you have a Apple M3 Pro but we don't know it. Please contact us.
And in addition when adding:
username ALL = (ALL) NOPASSWD: /usr/bin/powermetrics or username ALL = (root) NOPASSWD: /usr/bin/powermetrics via sudo visudo codecarbon stills give me: [codecarbon WARNING @ 23:26:23] No CPU tracking mode found. Falling back on CPU constant mode. Mac OS and ARM processor detected: Please enable PowerMetrics sudo to measure CPU
I found this very confusing it says [codecarbon WARNING @ 19:23:24] We saw that you have a Apple M3 but we don't know it. Please contact us. and then asks for a password but not clear what password it is asking for.
Yes it is confusing. @SaboniAmine do you have an idea on how we could deal with this ?
At least we need a message to warn the users about why we ask for a password. Maybe we could have a test before to know if we will need a password ?
just in response to my own query, I had an invalid entry in my visudo file so it was my root password it was asking for. I have hit another issue on mac though. I sometimes see the emissions.csv file is missing emissions and emissions_rate entries. Any idea why these would be empty for some runs but not others ? Anything I can check ? This is what I have in my config file and I have tried setting offline to both True and False
primary_tracker = EmissionsTracker(project_name="IMDB_Transformer")
primary_tracker.start()
...
my code
...
primary_tracker.stop()
[codecarbon INFO @ 00:23:23] Codecarbon is taking the configuration from the local file <my path>/ml/.codecarbon.config
[codecarbon WARNING @ 00:23:23] Multiple instances of codecarbon are allowed to run at the same time.
[codecarbon WARNING @ 00:23:23] Error while trying to count physical CPUs: [Errno 2] No such file or directory: 'lscpu'. Defaulting to 1.
[codecarbon WARNING @ 00:23:23] We saw that you have a Apple M3 but we don't know it. Please contact us.
Only thing jumping out right now is could it be to do with the duration ? For longer running programs it seems to be missing
Hi! I'm a student contributor in the CodePath AI301 Open Source Capstone and I'd like to work on this issue. I've reviewed the TDP table shared above and the detection logic in emissions_tracker.py. My plan is to add M2/M3/M4 series entries to cpu_power.csv and extend the chip model string matching to cover M4. Happy to start reproducing locally this week, is the TDP data in the comments above the recommended source to use, or is there a preferred reference?
Activity
[-]Better support for Apple Silicion chips[/-][+]Better support for Apple Silicon chips[/+]benoit-cty commentedon Jan 7, 2025
Hello,
Codecarbon tracks Apple Silicon Chip energy consumption using
powermetrics. It should be available natively on any mac. However, this tool is only usable withsudorights.You can read more about it in the doc : https://mlco2.github.io/codecarbon/methodology.html#cpu
We are working on a better solution : #731
makoeppel commentedon Jan 7, 2025
Hi,
I agree with your comment but I do think in general the support for M3/4 is not provided. I have the following issues:
[codecarbon WARNING @ 23:26:23] We saw that you have a Apple M3 Pro but we don't know it. Please contact us.And in addition when adding:
username ALL = (ALL) NOPASSWD: /usr/bin/powermetricsorusername ALL = (root) NOPASSWD: /usr/bin/powermetricsviasudo visudocodecarbon stills give me:[codecarbon WARNING @ 23:26:23] No CPU tracking mode found. Falling back on CPU constant mode. Mac OS and ARM processor detected: Please enable PowerMetrics sudo to measure CPUbenoit-cty commentedon Jan 9, 2025
Thank you for the details.
Looking at the code we do not test for M4, but M3 is supposed to work :
@LuisBlanche Have you an idea ?
lotif commentedon Jun 11, 2025
Hi,
I am running codecarbon in a desktop app that does not have the command line available. Is there a way to skip the check for powermetrics?
Thanks.
benoit-cty commentedon Jun 12, 2025
Thanks for this interesting usecase.
In
codecarbon/codecarbon/core/powermetrics.pythere is this code :It cause a problem when a password is requested for
sudo.If we just skip the check, you won't be able to use Powermetrics, will it be OK ?
To give sudo rights without having to enter a password each time, you can modify the sudoers file with the following command:
sudo visudoThen add the following line at the end of the file:
username ALL = (root) NOPASSWD: /usr/bin/powermetricssalob commentedon Sep 10, 2025
I found this very confusing it says
[codecarbon WARNING @ 19:23:24] We saw that you have a Apple M3 but we don't know it. Please contact us.and then asks for a password but not clear what password it is asking for.benoit-cty commentedon Sep 11, 2025
Yes it is confusing. @SaboniAmine do you have an idea on how we could deal with this ?
At least we need a message to warn the users about why we ask for a password. Maybe we could have a test before to know if we will need a password ?
ElliottKasoar commentedon Sep 19, 2025
Can I ask what the status of #752 is? Presumably a sudoless power metric would reduce many of the instances where a password is requested.
salob commentedon Nov 15, 2025
just in response to my own query, I had an invalid entry in my visudo file so it was my root password it was asking for. I have hit another issue on mac though. I sometimes see the emissions.csv file is missing emissions and emissions_rate entries. Any idea why these would be empty for some runs but not others ? Anything I can check ? This is what I have in my config file and I have tried setting offline to both True and False
then in my code:
Only thing jumping out right now is could it be to do with the duration ? For longer running programs it seems to be missing
williamacostalora commentedon Jun 7, 2026
Hi! I'm a student contributor in the CodePath AI301 Open Source Capstone and I'd like to work on this issue. I've reviewed the TDP table shared above and the detection logic in emissions_tracker.py. My plan is to add M2/M3/M4 series entries to cpu_power.csv and extend the chip model string matching to cover M4. Happy to start reproducing locally this week, is the TDP data in the comments above the recommended source to use, or is there a preferred reference?
feat: add Apple M2/M3/M4 chip TDP values to cpu_power.csv
feat: add Apple M2/M3/M4 chip TDP values to cpu_power.csv
feat: add Apple M2/M3/M4 chip TDP values to cpu_power.csv
fix: correct Apple Silicon TDP values to match sourced data
feat: add Apple M2/M3/M4 chip TDP support (#1256)