aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHongxu Jia <hongxu.jia@windriver.com>2020-04-21 14:54:30 +0800
committerHongxu Jia <hongxu.jia@windriver.com>2020-04-21 15:30:48 +0800
commit99a3d8319db51d92b9b3671816f3e023c764264f (patch)
tree472790fcd45eef74195d881f11398f7581297eae
parentfcbe23b2a33ec9d8c900fb6be30bd9344742c2ab (diff)
downloadmeta-tensorflow-99a3d8319db51d92b9b3671816f3e023c764264f.tar.gz
meta-tensorflow-99a3d8319db51d92b9b3671816f3e023c764264f.tar.bz2
meta-tensorflow-99a3d8319db51d92b9b3671816f3e023c764264f.zip
classes/bazel.bbclass: limit the number of CPU cores Bazel uses
There is gcc Killed failure: ... |tmp-glibc/work/corei7-32-wrsmllib32-linux/lib32-tensorflow/ 1.13.0-r0/git/tensorflow/core/kernels/BUILD:3158:1: C++ compilation of rule '//tensorflow/core/kernels:cwise_op' failed (Killed): gcc failed: error executing command ... From Bazel User Manual --local_resources availableRAM,availableCPU,availableIO This option, which takes three comma-separated floating point arguments, specifies the amount of local resources that Bazel can take into consideration when scheduling build and test activities. Option expects amount of available RAM (in MB), number of CPU cores (with 1.0 representing single full core) and workstation I/O capability (with 1.0 representing average workstation). [1] According to [2][3], explicitly set the amount of local host RAM 4096 MB available to Bazel, the number of local CPU 4 cores available to Bazel, the number of jobs is 4 which should be executed concurrently. Refer: [1] https://stackoverflow.com/questions/34756370/is-there-a-way-to-limit-the-number-of-cpu-cores-bazel-uses [2] https://github.com/tensorflow/tensorflow/issues/7723 [3] https://github.com/tensorflow/tensorflow/issues/24318 Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
-rw-r--r--classes/bazel.bbclass4
1 files changed, 2 insertions, 2 deletions
diff --git a/classes/bazel.bbclass b/classes/bazel.bbclass
index 02438b0..65d2932 100644
--- a/classes/bazel.bbclass
+++ b/classes/bazel.bbclass
@@ -70,12 +70,12 @@ def bazel_get_flags(d):
return flags
TS_DL_DIR ??= "${DL_DIR}"
-BAZEL_JOBS ??= "${@oe.utils.cpu_count()}"
+BAZEL_JOBS ??= "4"
bazel_do_configure () {
cat > "${S}/bazelrc" <<-EOF
build --verbose_failures
build --spawn_strategy=standalone --genrule_strategy=standalone
-build --jobs=${BAZEL_JOBS}
+build --jobs=${BAZEL_JOBS} --local_resources=4096,${BAZEL_JOBS},1.0
test --verbose_failures --verbose_test_summary
test --spawn_strategy=standalone --genrule_strategy=standalone