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

Fix segfault in GetCpuCores #1242

Merged
merged 2 commits into from
Nov 8, 2023

Conversation

jheeks
Copy link
Contributor

@jheeks jheeks commented Nov 6, 2023

Description

The branch reading line 12 of /proc/cpuinfo is valid only for __x86_64__.
So, bugfix is to restrict this branch for __x86_64__ only.
Or, simpler and more generic, use get_ncores().

Related issues

Cherry-pick to

  • 5.11 (old stable)
  • 5.12 (current stable)

The branch reading line 12 of /proc/cpuinfo is valid only for __x86_64__
@FlorianReimold
Copy link
Member

FlorianReimold commented Nov 7, 2023

What is with x86 (-> 32 bit)? And what will happen for non intel/amd platforms like arm? Wouldn't it be a better idea to use nproc instead of parsing some text that is meant to be interpretable by humans only?

Edit: According to some stackoverflow answer, this should be a rather portable solution:
https://github.com/gstrauss/plasma/blob/master/plasma_sysconf.c

Here is the sysconf manpage: https://man7.org/linux/man-pages/man3/sysconf.3.html
Here ist a specialized get_nprocs_conf manpage: https://man7.org/linux/man-pages/man3/get_nprocs_conf.3.html

which is simpler and more generic.
@jheeks
Copy link
Contributor Author

jheeks commented Nov 7, 2023

I agree that get_nprocs() is much simpler and more generic. So, I used it.

@FlorianReimold FlorianReimold merged commit 8766373 into eclipse-ecal:master Nov 8, 2023
8 checks passed
@jheeks jheeks deleted the bugfix/mmaArmSegfault branch November 8, 2023 10:53
FlorianReimold pushed a commit that referenced this pull request Jan 19, 2024
* Use get_nprocs() to read the number of cores which is simpler and more generic.
FlorianReimold pushed a commit that referenced this pull request Jan 19, 2024
* Use get_nprocs() to read the number of cores which is simpler and more generic.
FlorianReimold pushed a commit that referenced this pull request Jan 23, 2024
* Use get_nprocs() to read the number of cores which is simpler and more generic.
FlorianReimold pushed a commit that referenced this pull request Jan 23, 2024
* Use get_nprocs() to read the number of cores which is simpler and more generic.
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.

MMA crashes on arm64 platforms
2 participants