-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Detect number of CPU cores if nproc is installed #5477
Detect number of CPU cores if nproc is installed #5477
Conversation
Oh wow. I'm sorry I didn't comment yesterday. I feel that Also, we don't add more commits to a PR to fix-up errors in other commits in the same PR. We amend and force-push instead. And we prefix commit titles with subsystem name e.g. "configure: Detect number of logical CPUs, suggest it in make -j". The rest of the commit message shouldn't include discussion that wouldn't be relevant after the PR is merged. Thank you! |
openwall#5477 Signed-off-by: Albert Veli <[email protected]>
ddaac72
to
061b520
Compare
Thanks. I squashed the two commits, changed the commit message and force pushed. But it still uses nproc, I will try out the /proc method instead. Although that will only work on Linux. Maybe it's possible to find a way that works on macOS too. uname -s will return Linux or Darwin. If it's something else maybe just go with the default 4. |
Thanks. I'm still unhappy about the use of |
Two small observations about the PR in case any comments about this appear in the future. It respects the value of $ OMP_NUM_THREADS=70 nproc
70
# E.g., inside CircleCI you'll see (if you don't set OMP_NUM_THREADS):
Configure finished. Now "make -s clean && make -sj36" to compile. The check occurs and appears after all other checks. Target CPU ......................................... x86_64 AVX2, 64-bit LE
Fuzzing test ....................................... yes
[...]
Experimental code (default disabled) ............... no
ZTEX USB-FPGA module 1.15y support ................. no
checking for nproc... nproc
Install missing libraries to get any needed features that were omitted.
Configure finished. Now "make -s clean && make -sj3" to compile. |
I was wrong - it is indeed present on some of my systems. I don't know how I missed it before. |
I've implemented this (turned out to be just 3 lines) and am testing it now. |
I wonder if we should also use this detected vCPU count in our CI setups. Maybe have |
Actually, we already have similar logic in there, in nproc="$(nproc)" || nproc=1
j="-j$nproc"
if [ $nproc -gt 2 ]; then
export OMP_NUM_THREADS=2
fi
cd src
time ./configure $*
time make $j
time make $j check |
I'm afraid GitHub is offering 4 vCPUs to be used and the script is limiting "too much" at runtime. For no reason. |
What do you mean? When |
Okay, I just didn't see any reason to spare hardware. |
If nproc is not installed, use the old default 4.
I updated configure.ac and ran autotools to regenerate configure but only kept the nproc changes in
configure. Some other things were also changed but I removed the unrelated changes.
Maybe configure should be regenerated in total from configure.ac to be sure everything works as
intended. Which version of autoconf? I used 2.71 and the current was generated with 2.69.