rpm/0001-Fix-build-code-thread-cap-logic-for-unlimited-CPUs.patch
2019-08-23 14:12:34 +03:00

33 lines
1.0 KiB
Diff

From 4d16d81a1af3e43b8392e7c335f616c9c0c6e41b Mon Sep 17 00:00:00 2001
Message-Id: <4d16d81a1af3e43b8392e7c335f616c9c0c6e41b.1566558648.git.pmatilai@redhat.com>
From: Panu Matilainen <pmatilai@redhat.com>
Date: Fri, 23 Aug 2019 11:09:40 +0300
Subject: [PATCH 1/2] Fix build code thread cap logic for unlimited CPUs
If there's no clear cap set from rpm configuration, just let OMP do
its own thing (ie use all available CPUs) instead of artificially
limiting to 1.
---
build/parseSpec.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/build/parseSpec.c b/build/parseSpec.c
index 055bdf012..737a1233c 100644
--- a/build/parseSpec.c
+++ b/build/parseSpec.c
@@ -1036,9 +1036,8 @@ static rpmSpec parseSpec(const char *specFile, rpmSpecFlags flags,
#ifdef ENABLE_OPENMP
/* Set number of OMP threads centrally */
int ncpus = rpmExpandNumeric("%{?_smp_build_ncpus}");
- if (ncpus <= 0)
- ncpus = 1;
- omp_set_num_threads(ncpus);
+ if (ncpus > 0)
+ omp_set_num_threads(ncpus);
#endif
if (spec->clean == NULL) {
--
2.21.0