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 a0095d
From 4d16d81a1af3e43b8392e7c335f616c9c0c6e41b Mon Sep 17 00:00:00 2001
Panu Matilainen a0095d
Message-Id: <4d16d81a1af3e43b8392e7c335f616c9c0c6e41b.1566558648.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 a0095d
index 055bdf012..737a1233c 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 a0095d
+    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