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

Safe setting of CPU Info #146

Merged
merged 5 commits into from
Jul 19, 2024
Merged

Safe setting of CPU Info #146

merged 5 commits into from
Jul 19, 2024

Conversation

maxmynter
Copy link
Collaborator

@maxmynter maxmynter commented Jul 18, 2024

as the context information might not be available on all devices, e.g. in our GitHub CI VM the CPU frequency.

Wrap setting of dict entry in a try, except blog that throws warnings when a value cannot be obtained.

This is to address the CI failure described in #145 and very much a suggestion that we can discuss.

In any case, I think a failure of getting context info should not break the test execution in case they take some time.
As a data scientist using nnbench, I would want our suite to run through so i can react to failures. However, I definitely want information about missing values such that i can implement fixes to these in case they are crucial.

as the context information might not be available on all
devices, e.g. in our GitHub CI VM the CPU frequency.

Wrap setting of dict entry in a try, except blog that throws warn-
ings when a value cannot be obtained.
Copy link
Collaborator

@nicholasjng nicholasjng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be in favor of a more tailored solution for the problem rather than having a None fallback for everything - cpu_freq() only seems to fail on macOS, and then we could always set frequency/min/max all to 0.

For example, if reading platform values really fails, you've got much bigger problems than running nnbench. So I'd prefer a try-except just around cpu_freq() if possible.

We decided on a more tailored approach and will only wrap the
effected parts of the CPU info, not all of them.
as the function is not available on all devices, e.g. apple ARM in
our GitHub CI. In that case, set frequency avg, min, max to zero.
as we set the CPU frequency to zero when it is not available on the
host machine. That is the case in the GitHub CI. We don't want this
test to fail when there is the frequency 0 as then the CPUInfo has
been correctly populated.
as this is what is thrown by PSUTIL if the information is not
available in the current machine.
@maxmynter maxmynter merged commit b69b3a6 into main Jul 19, 2024
5 checks passed
@maxmynter maxmynter deleted the cpuinfo branch July 19, 2024 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants