Skip to content

Fix getOptimalThreadCount segfault #714

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

Open
wants to merge 30 commits into
base: master
Choose a base branch
from

Conversation

DiamonDinoia
Copy link
Collaborator

It seems that the method used in master is not compatible with very old kernels.
I replaced here with using /sys/devices/system/cpu/present which should be compatible with Linux kernels 2.6+.

I also added a print to time how long it takes. Optimizing this avoiding heap allocations and std::set did not make a meaningful time difference so I left the easiest implementation.

@DiamonDinoia DiamonDinoia requested review from blackwer and janden July 23, 2025 19:26
}
return physicalCoreCount;
#endif
// in ARM and RISKV we only need this
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ivansarno, Am I correct in assuming that RISK-V CPUs do not have Hyper-threading?

Copy link

@ivansarno ivansarno Jul 24, 2025

Choose a reason for hiding this comment

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

Yes, no widely used RISC-V core has hyperthreading, except perhaps some experimental core.

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