From 7ddebb112b1931a495e78fba092b77e4f91022df Mon Sep 17 00:00:00 2001 From: "Alexander F. Lent" Date: Thu, 18 Dec 2025 09:08:09 -0500 Subject: [PATCH] Improve build times on non-x86 systems Signed-off-by: Alexander F. Lent --- python-torch.spec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python-torch.spec b/python-torch.spec index e493b97..abacce9 100644 --- a/python-torch.spec +++ b/python-torch.spec @@ -506,10 +506,15 @@ sed -i -e 's@${PROJECT_SOURCE_DIR}/third_party/concurrentqueue@/usr/include/conc # Control the number of jobs # # The build can fail if too many threads exceed the physical memory -# So count core and and memory and increase the build memory util the build succeeds +# Run at least one thread, more if CPU & memory resources are available. # +%ifarch x86_64 # Real cores, No hyperthreading COMPILE_JOBS=`cat /proc/cpuinfo | grep -m 1 'cpu cores' | awk '{ print $4 }'` +%else +# cpuinfo format varies on other arches, fall back to nproc +COMPILE_JOBS=`nproc` +%endif if [ ${COMPILE_JOBS}x = x ]; then COMPILE_JOBS=1 fi