title: Is there a way to limit the number of CPU cores Bazel uses?
body: <p>Is there a way to tell Bazel when building how many CPU cores it can use?</p>
  
  <h2>TL;DR</h2>
  
  <p>I build TensorFlow on a VMware Workstation and being a virtual machine I can adjust the number of processors and cores for the virtual machine.</p>
  
  <p>In the process of building TensorFlow I found that using only one core works.
  When I give the Workstation four cores and build TensorFlow it eventually halts the system to the point I have to reboot. </p>
  
  <p>If I wait a few hours (leave it alone overnight) it sometimes returns with the following error:</p>
  
  <blockquote>
    <p>gcc: internal compiler error: Killed (program cc1plus)</p>
  </blockquote>
  
  <p>While I can change the number of cores using the virtual machines configuration options I would prefer to do it without having to shut down and restart the virtual machine.</p>