mlco2 / codecarbon

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

simplify get_matching_cpu implementation #385

Closed maxbachmann closed 6 months ago

maxbachmann commented 1 year ago

This PR simplifies the implementation of get_matching_cpu. In addition it replaces fuzzywuzzy with rapidfuzz, since fuzzywuzzy is not maintained anymore and is GPL licensed.

In theory this new implementation is faster, but since CPU lists should be pretty short this does not really matter here.

benoit-cty commented 1 year ago

There is an error in CI:

  ./src/rapidfuzz/cpp_common.pxd:396: TypeError : ('Got unexpected keyword arguments: ', 'process')

Do you have an idea ?

maxbachmann commented 1 year ago

Ah yes it should have used processor instead of process.

benoit-cty commented 1 year ago

Hello, Sorry for the delay but some tests fail with rapidfuzzy : pytest -v tests/test_cpu.py::TestTDP::test_get_matching_cpu And if I lower the threshold it make another test to fail.

maxbachmann commented 1 year ago

With rapidfuzz v3.0.0 strings are no longer preprocessed by default. Enabling it again should fix this.

maxbachmann commented 6 months ago

@benoit-cty are you still interested in this? I could rebase it in this case. Otherwise I will close this PR.

benoit-cty commented 6 months ago

Hello, yes we are still interested. If all test pass I'm ok to merge it. Thanks for the reminder :+1:

maxbachmann commented 6 months ago

@benoit-cty I rebased the change + fixed the new linter rules

benoit-cty commented 6 months ago

Thanks a lot !