有没有办法限制 Bazel 使用的 CPU 个核心数?
Is there a way to limit the number of CPU cores Bazel uses?
有没有办法在构建它可以使用多少 CPU 个内核时告诉 Bazel?
TL;DR
我在 VMware Workstation 上构建 TensorFlow,作为虚拟机,我可以调整虚拟机的处理器和内核数量。
在搭建TensorFlow的过程中我发现只用一个核心就可以了。
当我为工作站提供四个内核并构建 TensorFlow 时,它最终会使系统停止运行,以至于我必须重新启动。
如果我等几个小时(让它单独过夜),有时 returns 会出现以下错误:
gcc: internal compiler error: Killed (program cc1plus)
虽然我可以使用虚拟机配置选项更改内核数量,但我更愿意这样做而不必关闭并重新启动虚拟机。
--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). By default Bazel will estimate amount of RAM and number of CPU cores directly from system
configuration and will assume 1.0 I/O resource.
If this option is used, Bazel will ignore both
--ram_utilization_factor.
你的 .bazelrc 的一些例子
build --local_ram_resources=HOST_RAM*.5 --local_cpu_resources=HOST_CPUS-1 (leave one core free)
或
build --local_cpu_resources=1 (use a single core)
见https://docs.bazel.build/versions/master/command-line-reference.html#flag--local_cpu_resources
当前接受的答案已弃用。
有没有办法在构建它可以使用多少 CPU 个内核时告诉 Bazel?
TL;DR
我在 VMware Workstation 上构建 TensorFlow,作为虚拟机,我可以调整虚拟机的处理器和内核数量。
在搭建TensorFlow的过程中我发现只用一个核心就可以了。 当我为工作站提供四个内核并构建 TensorFlow 时,它最终会使系统停止运行,以至于我必须重新启动。
如果我等几个小时(让它单独过夜),有时 returns 会出现以下错误:
gcc: internal compiler error: Killed (program cc1plus)
虽然我可以使用虚拟机配置选项更改内核数量,但我更愿意这样做而不必关闭并重新启动虚拟机。
--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). By default Bazel will estimate amount of RAM and number of CPU cores directly from system configuration and will assume 1.0 I/O resource.
If this option is used, Bazel will ignore both --ram_utilization_factor.
你的 .bazelrc 的一些例子
build --local_ram_resources=HOST_RAM*.5 --local_cpu_resources=HOST_CPUS-1 (leave one core free)
或
build --local_cpu_resources=1 (use a single core)
见https://docs.bazel.build/versions/master/command-line-reference.html#flag--local_cpu_resources
当前接受的答案已弃用。