Skip to content

CPU on Raspberry Pi 5 not recognized #790

Description

@FrejaThoresen

Dear CodeCarbon team,

I am running codecarbon on a Raspberry Pi 5, and the CPU (and Hailo AI acceleration device) are not recognized.

[codecarbon INFO @ 16:09:26] Codecarbon is taking the configuration from global file: /home/pi/.codecarbon.config
[codecarbon INFO @ 16:09:26] [setup] RAM Tracking...
[codecarbon INFO @ 16:09:26] [setup] CPU Tracking...
[codecarbon WARNING @ 16:09:26] No CPU tracking mode found. Falling back on CPU constant mode. 
 Linux OS detected: Please ensure RAPL files exist at \sys\class\powercap\intel-rapl to measure CPU

[codecarbon WARNING @ 16:09:26] We saw that you have a Cortex-A76 but we don't know it. Please contact us.
[codecarbon INFO @ 16:09:26] CPU Model on constant consumption mode: Cortex-A76
[codecarbon INFO @ 16:09:26] [setup] GPU Tracking...
[codecarbon INFO @ 16:09:26] No GPU found.
[codecarbon INFO @ 16:09:26] >>> Tracker's metadata:
[codecarbon INFO @ 16:09:26]   Platform system: Linux-6.6.62+rpt-rpi-2712-aarch64-with-glibc2.36
[codecarbon INFO @ 16:09:26]   Python version: 3.11.2
[codecarbon INFO @ 16:09:26]   CodeCarbon version: 2.8.3
[codecarbon INFO @ 16:09:26]   Available RAM : 7.860 GB
[codecarbon INFO @ 16:09:26]   CPU count: 4
[codecarbon INFO @ 16:09:26]   CPU model: Cortex-A76
[codecarbon INFO @ 16:09:26]   GPU count: None
[codecarbon INFO @ 16:09:26]   GPU model: None
[codecarbon INFO @ 16:09:29] Saving emissions data to file emissions.csv
[codecarbon INFO @ 16:09:29] 
Graceful stopping: collecting and writing information.
Please wait a few seconds...
[codecarbon INFO @ 16:09:29] Energy consumed for RAM : 0.000000 kWh. RAM Power : 2.9473571777343754 W
[codecarbon INFO @ 16:09:29] Energy consumed for all CPUs : 0.000000 kWh. Total CPU Power : 42.5 W
[codecarbon INFO @ 16:09:29] 0.000000 kWh of electricity used since the beginning.
[codecarbon INFO @ 16:09:29] Done!

Furthermore, this folder doesn't exist on the system /sys/class/powercap.

Activity

  1. benoit-cty commented on Feb 27, 2025

    @benoit-cty
    Contributor

    Hello,
    Thanks, we may support it with https://github.com/librerpi/rpi-tools/blob/master/pi5_voltage.py

    @prmths128 has recently done some test using CodeCarbon on a Rpi.

  2. benoit-cty commented on Feb 28, 2025

    @benoit-cty
    Contributor

    Can you both have a look to #791 and tell me if the TDP seems OK ?

  3. FrejaThoresen commented on Mar 3, 2025

    @FrejaThoresen
    ContributorAuthor

    Hello,

    I've run tests with the master branch and PR #791.

    From the PR #791 (codecarbon-3.0.0rc4)

    [codecarbon INFO @ 13:05:17] Codecarbon is taking the configuration from global file: /home/pi/.codecarbon.config
    [codecarbon WARNING @ 13:05:17] Error while trying to count physical CPUs: invalid literal for int() with base 10: '-'. Defaulting to 1.
    [codecarbon INFO @ 13:05:17] [setup] RAM Tracking...
    [codecarbon INFO @ 13:05:17] [setup] CPU Tracking...
    [codecarbon WARNING @ 13:05:17] No CPU tracking mode found. Falling back on estimation based on TDP for CPU. 
     Linux OS detected: Please ensure RAPL files exist at /sys/class/powercap/intel-rapl/subsystem to measure CPU
    
    [codecarbon INFO @ 13:05:17] CPU Model on constant consumption mode: Cortex-A76
    [codecarbon WARNING @ 13:05:17] No CPU tracking mode found. Falling back on CPU constant mode.
    [codecarbon INFO @ 13:05:17] [setup] GPU Tracking...
    [codecarbon INFO @ 13:05:17] No GPU found.
    [codecarbon INFO @ 13:05:17] >>> Tracker's metadata:
    [codecarbon INFO @ 13:05:17]   Platform system: Linux-6.6.62+rpt-rpi-2712-aarch64-with-glibc2.36
    [codecarbon INFO @ 13:05:17]   Python version: 3.11.2
    [codecarbon INFO @ 13:05:17]   CodeCarbon version: 3.0.0_rc4
    [codecarbon INFO @ 13:05:17]   Available RAM : 7.860 GB
    [codecarbon INFO @ 13:05:17]   CPU count: 4 thread(s) in 1 physical CPU(s)
    [codecarbon INFO @ 13:05:17]   CPU model: Cortex-A76
    [codecarbon INFO @ 13:05:17]   GPU count: None
    [codecarbon INFO @ 13:05:17]   GPU model: None
    [codecarbon INFO @ 13:05:18] Saving emissions data to file /home/pi/Documents/green-ai-bench/data/raw/cpu_inference_emissions.csv
    [codecarbon INFO @ 13:05:18] 
    Graceful stopping: collecting and writing information.
    Please wait a few seconds...
    [codecarbon INFO @ 13:05:18] Energy consumed for RAM : 0.000000 kWh. RAM Power : 2.9473571777343754 W
    [codecarbon INFO @ 13:05:18] Delta energy consumed for CPU with constant : 0.000000 kWh, power : 6.0 W
    [codecarbon INFO @ 13:05:18] Energy consumed for All CPU : 0.000000 kWh
    [codecarbon INFO @ 13:05:18] 0.000000 kWh of electricity used since the beginning.
    [codecarbon INFO @ 13:05:18] Done!
    

    And from the master branch (codecarbon-2.8.3):

    [codecarbon INFO @ 13:17:32] Codecarbon is taking the configuration from global file: /home/pi/.codecarbon.config
    [codecarbon INFO @ 13:17:32] [setup] RAM Tracking...
    [codecarbon INFO @ 13:17:32] [setup] CPU Tracking...
    [codecarbon WARNING @ 13:17:32] No CPU tracking mode found. Falling back on CPU constant mode. 
     Linux OS detected: Please ensure RAPL files exist at \sys\class\powercap\intel-rapl to measure CPU
    
    [codecarbon WARNING @ 13:17:32] We saw that you have a Cortex-A76 but we don't know it. Please contact us.
    [codecarbon INFO @ 13:17:32] CPU Model on constant consumption mode: Cortex-A76
    [codecarbon INFO @ 13:17:32] [setup] GPU Tracking...
    [codecarbon INFO @ 13:17:32] No GPU found.
    [codecarbon INFO @ 13:17:32] >>> Tracker's metadata:
    [codecarbon INFO @ 13:17:32]   Platform system: Linux-6.6.62+rpt-rpi-2712-aarch64-with-glibc2.36
    [codecarbon INFO @ 13:17:32]   Python version: 3.11.2
    [codecarbon INFO @ 13:17:32]   CodeCarbon version: 2.8.3
    [codecarbon INFO @ 13:17:32]   Available RAM : 7.860 GB
    [codecarbon INFO @ 13:17:32]   CPU count: 4
    [codecarbon INFO @ 13:17:32]   CPU model: Cortex-A76
    [codecarbon INFO @ 13:17:32]   GPU count: None
    [codecarbon INFO @ 13:17:32]   GPU model: None
    [codecarbon INFO @ 13:17:33] Saving emissions data to file /home/pi/Documents/green-ai-bench/data/raw/cpu_inference_emissions.csv
    [codecarbon INFO @ 13:17:33] 
    Graceful stopping: collecting and writing information.
    Please wait a few seconds...
    [codecarbon INFO @ 13:17:33] Energy consumed for RAM : 0.000000 kWh. RAM Power : 2.9473571777343754 W
    [codecarbon INFO @ 13:17:33] Energy consumed for all CPUs : 0.000001 kWh. Total CPU Power : 42.5 W
    [codecarbon INFO @ 13:17:33] 0.000001 kWh of electricity used since the beginning.
    [codecarbon INFO @ 13:17:33] Done!
    

    If you managed to get a reading with a Rpi, can you please advice @prmths128 @benoit-cty?

    Many thanks!

  4. prmths128 commented on Mar 9, 2025

    @prmths128
    Contributor

    Hello,
    I've pushed a new branch feat/rpi_power https://github.com/mlco2/codecarbon/tree/feat/rpi_power
    to add power metrics for raspberry using their tools ; can you try it ?
    It should give proper readings for CPU and RAM.

  5. FrejaThoresen commented on Mar 13, 2025

    @FrejaThoresen
    ContributorAuthor

    Hello,

    I tried out the feat/rpi_power branch. It seems the CPU is now getting recognised, but I'm getting zeros for the energy usage. Did you manage to get a reading on a Raspberry Pi, which version?

    [codecarbon INFO @ 15:42:28] Codecarbon is taking the configuration from global file: /home/pi/.codecarbon.config
    [codecarbon INFO @ 15:42:28] [setup] RAM Tracking...
    [codecarbon INFO @ 15:42:28] [setup] CPU Tracking...
    [codecarbon INFO @ 15:42:28] Tracking CPU via raspberry utils
    [codecarbon INFO @ 15:42:28] [setup] GPU Tracking...
    [codecarbon INFO @ 15:42:28] No GPU found.
    [codecarbon INFO @ 15:42:28] >>> Tracker's metadata:
    [codecarbon INFO @ 15:42:28]   Platform system: Linux-6.6.62+rpt-rpi-2712-aarch64-with-glibc2.36
    [codecarbon INFO @ 15:42:28]   Python version: 3.10.0
    [codecarbon INFO @ 15:42:28]   CodeCarbon version: 2.8.3
    [codecarbon INFO @ 15:42:28]   Available RAM : 7.860 GB
    [codecarbon INFO @ 15:42:28]   CPU count: 4
    [codecarbon INFO @ 15:42:28]   CPU model: Cortex-A76
    [codecarbon INFO @ 15:42:28]   GPU count: None
    [codecarbon INFO @ 15:42:28]   GPU model: None
    [codecarbon INFO @ 15:42:29] Emissions data (if any) will be saved to file /home/pi/Documents/green-ai-bench/data/raw/cpu_inference_emissions.csv
    [codecarbon INFO @ 15:42:29] 
    Graceful stopping: collecting and writing information.
    Please wait a few seconds...
    [codecarbon INFO @ 15:42:29] Energy consumed for RAM : 0.000000 kWh. RAM Power : 2.9473571777343754 W
    [codecarbon INFO @ 15:42:29] Energy consumed for all CPUs : 0.000000 kWh. Total CPU Power : 5.953340186965816 W
    [codecarbon INFO @ 15:42:29] Energy consumed for RAMs : 0.000000 kWh. Total RAM Power : 0.047042817949260005 W
    [codecarbon INFO @ 15:42:29] 0.000000 kWh of electricity used since the beginning.
    [codecarbon INFO @ 15:42:29] Done!
    

    Cheers,

  6. prmths128 commented on Mar 16, 2025

    @prmths128
    Contributor

    Hello,

    I'm not sure the correct version is called.
    With this command:

    export PYTHONPATH=".:$PYTHONPATH"
    python codecarbon/cli/main.py monitor --no-api 2 2

    I'm getting:

    CodeCarbon is going in an infinite loop to monitor this machine.
    [codecarbon INFO @ 17:40:53] [setup] RAM Tracking...
    [codecarbon INFO @ 17:40:53] [setup] CPU Tracking...
    [codecarbon INFO @ 17:40:53] Tracking CPU via raspberry utils
    [codecarbon INFO @ 17:40:53] [setup] GPU Tracking...
    [codecarbon INFO @ 17:40:53] No GPU found.
    [codecarbon INFO @ 17:40:53] >>> Tracker's metadata:
    [codecarbon INFO @ 17:40:53]   Platform system: Linux-6.6.51+rpt-rpi-v8-aarch64-with-glibc2.40
    [codecarbon INFO @ 17:40:53]   Python version: 3.13.1
    [codecarbon INFO @ 17:40:53]   CodeCarbon version: 2.8.3
    [codecarbon INFO @ 17:40:53]   Available RAM : 7.759 GB
    [codecarbon INFO @ 17:40:53]   CPU count: 4
    [codecarbon INFO @ 17:40:53]   CPU model: Cortex-A76
    [codecarbon INFO @ 17:40:53]   GPU count: None
    [codecarbon INFO @ 17:40:53]   GPU model: None
    [codecarbon INFO @ 17:40:56] Emissions data (if any) will be saved to file /mnt/sda1/codecarbon/emissions.csv
    [codecarbon INFO @ 17:40:58] measuring from hardware=Raspberry (Cortex-A76 > RAM)
    [codecarbon INFO @ 17:40:58] Energy consumed for RAMs : 0.000000 kWh. Total RAM Power : 0.00648188698122 W
    [codecarbon INFO @ 17:40:58] measuring from hardware=Raspberry (Cortex-A76 > CPU)
    [codecarbon INFO @ 17:40:58] Energy consumed for all CPUs : 0.000001 kWh. Total CPU Power : 1.60725786863836 W
    [codecarbon INFO @ 17:40:58] 0.000001 kWh of electricity used since the beginning.
    [codecarbon INFO @ 17:41:00] measuring from hardware=Raspberry (Cortex-A76 > RAM)
    [codecarbon INFO @ 17:41:00] Energy consumed for RAMs : 0.000000 kWh. Total RAM Power : 0.006475451698800001 W
    [codecarbon INFO @ 17:41:00] measuring from hardware=Raspberry (Cortex-A76 > CPU)
    [codecarbon INFO @ 17:41:00] Energy consumed for all CPUs : 0.000002 kWh. Total CPU Power : 1.7625656386553101 W
    [codecarbon INFO @ 17:41:00] 0.000002 kWh of electricity used since the beginning.
    

    I've added a new version with some logging to the commit (branch feat/rpi_power ) to check the measure used, it shows measuring from hardware... and should show the raspberry hardware for CPU/RAM like above.

  7. FrejaThoresen commented on Mar 18, 2025

    @FrejaThoresen
    ContributorAuthor

    Hello,

    Thanks for the help, I think it works now.

    CodeCarbon is going in an infinite loop to monitor this machine.
    [codecarbon INFO @ 09:20:16] Codecarbon is taking the configuration from global file: /home/pi/.codecarbon.config
    [codecarbon INFO @ 09:20:16] [setup] RAM Tracking...
    [codecarbon INFO @ 09:20:16] [setup] CPU Tracking...
    [codecarbon INFO @ 09:20:16] Tracking CPU via raspberry utils
    [codecarbon INFO @ 09:20:16] [setup] GPU Tracking...
    [codecarbon INFO @ 09:20:16] No GPU found.
    [codecarbon INFO @ 09:20:16] >>> Tracker's metadata:
    [codecarbon INFO @ 09:20:16]   Platform system: Linux-6.6.62+rpt-rpi-2712-aarch64-with-glibc2.36
    [codecarbon INFO @ 09:20:16]   Python version: 3.11.2
    [codecarbon INFO @ 09:20:16]   CodeCarbon version: 2.8.3
    [codecarbon INFO @ 09:20:16]   Available RAM : 7.860 GB
    [codecarbon INFO @ 09:20:16]   CPU count: 4
    [codecarbon INFO @ 09:20:16]   CPU model: Cortex-A76
    [codecarbon INFO @ 09:20:16]   GPU count: None
    [codecarbon INFO @ 09:20:16]   GPU model: None
    [codecarbon INFO @ 09:20:17] Emissions data (if any) will be saved to file /home/pi/Documents/codecarbon/emissions.csv
    [codecarbon INFO @ 09:20:19] measuring from hardware=Raspberry (Cortex-A76 > RAM)
    [codecarbon INFO @ 09:20:19] Energy consumed for RAMs : 0.000000 kWh. Total RAM Power : 0.05351741464734 W
    [codecarbon INFO @ 09:20:19] measuring from hardware=Raspberry (Cortex-A76 > CPU)
    [codecarbon INFO @ 09:20:19] Energy consumed for all CPUs : 0.000001 kWh. Total CPU Power : 2.38590095336374 W
    [codecarbon INFO @ 09:20:19] 0.000001 kWh of electricity used since the beginning.
    [codecarbon INFO @ 09:20:21] measuring from hardware=Raspberry (Cortex-A76 > RAM)
    [codecarbon INFO @ 09:20:21] Energy consumed for RAMs : 0.000000 kWh. Total RAM Power : 0.13027155368436 W
    [codecarbon INFO @ 09:20:21] measuring from hardware=Raspberry (Cortex-A76 > CPU)
    [codecarbon INFO @ 09:20:21] Energy consumed for all CPUs : 0.000002 kWh. Total CPU Power : 2.05160794672903 W
    [codecarbon INFO @ 09:20:21] 0.000003 kWh of electricity used since the beginning.
    [codecarbon INFO @ 09:20:21] 0.000095 g.CO2eq/s mean an estimation of 2.9968769284364143 kg.CO2eq/year
    [codecarbon INFO @ 09:20:23] measuring from hardware=Raspberry (Cortex-A76 > RAM)
    [codecarbon INFO @ 09:20:23] Energy consumed for RAMs : 0.000000 kWh. Total RAM Power : 0.059869230269670004 W
    [codecarbon INFO @ 09:20:23] measuring from hardware=Raspberry (Cortex-A76 > CPU)

    Cheers!

  8. prmths128 commented on Mar 19, 2025

    @prmths128
    Contributor

    Ok, cool!
    You can keep using the branch for the moment, i'll close the ticket when it's finished and merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions