Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more tracker instances #681

Open
enricocapuano opened this issue Oct 4, 2024 · 8 comments
Open

more tracker instances #681

enricocapuano opened this issue Oct 4, 2024 · 8 comments
Labels
question Further information is requested

Comments

@enricocapuano
Copy link

Goodmorning!
I'm trying to use the last version of CodeCarbon and I'm facing this problem: when I create more than one instance of tracker in my file, I receive this error.
[codecarbon ERROR @ 13:41:42] Error: Another instance of codecarbon is already running. Turn off the other instance to be able to run this one. Exiting.
[codecarbon WARNING @ 13:41:42] Another instance of codecarbon is already running. Exiting.

Is it possible to create more than one instance of tracker or not? How can I do it?

@inimaz
Copy link
Contributor

inimaz commented Oct 4, 2024

Hello @enricocapuano ! Thanks for using codecarbon.
We added this as a lock so that only one instance is running at the same time in the machine, otherwise you will be measuring twice the same CPU/GPU/RAM energy, power...

That said, to understand your use case better, why do you need more than one instance of the tracker running at the same time?

@enricocapuano
Copy link
Author

Hello @inimaz, thanks for answering!
I need to do a comparison about consumptions between two different processes that do the same thing in different ways.
Do you have any suggestions?

@inimaz
Copy link
Contributor

inimaz commented Oct 5, 2024

Can you provide an example of your code? Normally as long as they are not run in parallel, there should be no problem with your use case.

@benoit-cty
Copy link
Contributor

Running them is parallel is not supported by CodeCarbon as, for now, we monitor the whole machine and not only the process. There is a 'process' mode but it only support RAM usage, not CPU nor GPU yet.

@inimaz inimaz added the question Further information is requested label Oct 8, 2024
@enricocapuano
Copy link
Author

Ok, thanks for answering. I have another question: once I received that error, how can I fix it? Should I necessarily create another project? Thanks in advance

@inimaz
Copy link
Contributor

inimaz commented Oct 10, 2024

If you still have the error running only one instance then it is a bug, could you provide an example of how you are running it in your code?
A workaround until the fix is ready is to remove manually the lock file. It is a file .codecarbon.lock that will be in your temp dir (in linux: /tmp, in windows: C:\Users\username\AppData\Local\Temp).

Example in Linux

rm /tmp/.codecarbon.lock

@enricocapuano
Copy link
Author

Thanks again. I already tried to remove the lock file and it did not work. Anyway, it seems that I solved my issue setting the parameter allow_multiple_runs as True when creating tracker instance.
Thank you for the support!

@inimaz
Copy link
Contributor

inimaz commented Oct 10, 2024

Nice! Then it means you were running things in parallel. Could you provide an example of your code? Otherwise it is hard to guess

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants