Closed TECO-Octo closed 3 months ago
Hello, Yes, you could run the container in privileged mode to allow it to read /sys to use the RAPL files of the hosts.
But do this only on container you trust !
Hello and thank you for your suggestion!
This is what I did inside the container I trust (edge_orchestrator
):
Sadly, it is still unable to find the CPU infos
Can you try with:
volumes:
- type: bind
source: /proc
target: /proc
- type: bind
source: /sys/class/powercap
target: /sys/class/powercap
I see this on https://github.com/hubblo-org/scaphandre/blob/e09dfcc7abd28291e783643e366393325fad3f6d/docker-compose/docker-compose.yaml#L26 from https://hubblo-org.github.io/scaphandre-documentation/tutorials/getting_started.html
Hello!
/sys/class/powercap
does not exist for me as I run the docker from a MacOS device (Apple Silicon M1 chip).
Hence I followed the methodology from this link for Apple Silicon Chips
I modified the docker-compose as such
privileged: true
volumes:
- type: bind
source: /proc
target: /proc
- type: bind
source: /usr/bin/powermetrics
target: /usr/bin/powermetrics
But still encounter the same issue (switching to falling back mode)
Ok, so I don't think it's possible because for Powermetrics we don't just read a file but executing a Mac application so it probably can't work in Docker.
@LuisBlanche any idea ?
Hi, yes I think it might be complicated indeed. I'll have a better look at it when I can, but it's been a common issue with people trying to use codecarbon
in Docker. One suggestion I could give is to run codecarbon monitor
outside docker right before running it, but I don't know if it fits your use case
Maybe using this doc about docker runtime metrics we could try to do something but i will only give us CPU usage % and not task level consumption
Thanks for your answers! Yes, sadly it seems complicate as for now. I will keep in touch with you guys if you come up with something else!
I'm closing this PR, don't hesitate to re-open if you have more information.
Description
I wanted to track the emissions of a scope of code inside a docker container. Though it is not able to find and track the CPU, thus it is falling back on constant mode.
What I Did
I used codecarbon task manager in a small portion of code (in my case, during the inference of a model).
Here are the logs from my docker container
I wonder if there is a way to allow CPU infos access on a docker container to avoid the falling back mode in codecarbon.