teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame 0001-Fix-build-code-thread-cap-logic-for-unlimited-CPUs.patch

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