summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2021-04-01 09:43:29 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-04-05 15:29:02 +0100
commit4718aa32fa3bf823cd8646bb4eeae7f2d99a5f57 (patch)
tree1e78570c5e7a9a3210482a2195447f6f42756277
parente1d353880ca2626c16746d327a84c87f193a8693 (diff)
downloadpoky-4718aa32fa3bf823cd8646bb4eeae7f2d99a5f57.tar.gz
poky-4718aa32fa3bf823cd8646bb4eeae7f2d99a5f57.tar.bz2
poky-4718aa32fa3bf823cd8646bb4eeae7f2d99a5f57.zip
bitbake.conf: Limit the number of OpenMP threads
Limits the number of OpenMP threads to match BB_NUMBER_THREADS. This prevents OpenMP (libgomp in particular) from falling back to using all the available CPUs, which behaves poorly when attempting to limit build usage, especially when attempting to build in a container. (From OE-Core rev: fd2b8986aef11609123da917aaf6bcbe41f63112) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/conf/bitbake.conf7
1 files changed, 6 insertions, 1 deletions
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index d87d7cafb6..385fc7dd55 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -810,6 +810,10 @@ XZ_THREADS ?= "${@oe.utils.cpu_count(at_least=2)}"
XZ_DEFAULTS ?= "--memlimit=${XZ_MEMLIMIT} --threads=${XZ_THREADS}"
XZ_DEFAULTS[vardepsexclude] += "XZ_MEMLIMIT XZ_THREADS"
+# Limit the number of threads that OpenMP libraries will use. Otherwise they
+# may fallback to using all CPUs
+export OMP_NUM_THREADS = "${BB_NUMBER_THREADS}"
+
##################################################################
# Magic Cookie for SANITY CHECK
##################################################################
@@ -891,7 +895,8 @@ BB_HASHEXCLUDE_COMMON ?= "TMPDIR FILE PATH PWD BB_TASKHASH BBPATH BBSERVER DL_DI
WARN_QA ERROR_QA WORKDIR STAMPCLEAN PKGDATA_DIR BUILD_ARCH SSTATE_PKGARCH \
BB_WORKERCONTEXT BB_LIMITEDDEPS BB_UNIHASH extend_recipe_sysroot DEPLOY_DIR \
SSTATE_HASHEQUIV_METHOD SSTATE_HASHEQUIV_REPORT_TASKDATA \
- SSTATE_HASHEQUIV_OWNER CCACHE_TOP_DIR BB_HASHSERVE GIT_CEILING_DIRECTORIES"
+ SSTATE_HASHEQUIV_OWNER CCACHE_TOP_DIR BB_HASHSERVE GIT_CEILING_DIRECTORIES \
+ OMP_NUM_THREADS"
BB_HASHBASE_WHITELIST ?= "${BB_HASHEXCLUDE_COMMON} PSEUDO_IGNORE_PATHS BUILDHISTORY_DIR SSTATE_DIR "
BB_HASHCONFIG_WHITELIST ?= "${BB_HASHEXCLUDE_COMMON} DATE TIME SSH_AGENT_PID \
SSH_AUTH_SOCK PSEUDO_BUILD BB_ENV_EXTRAWHITE DISABLE_SANITY_CHECKS \