use of cpus in building

Ryan Schmidt ryandesign at macports.org
Fri May 27 10:47:26 PDT 2016


On May 25, 2016, at 5:07 PM, Justin C. Walker wrote:

> On May 25, 2016, at 14:42 , Adam Dershowitz wrote:
> 
>> You can also manually change it for a single install, for example by using build.jobs.  Such as:
>> sudo port install port_whatever_name build.jobs=4 
>> and then, for that specific install it will attempt to use 4 cores.  This can be handy to reduce the number of cores used, from the default, so that you can do other things on the machine while building. 

Instead, consider changing buildnicevalue in macports.conf from 0 to a greater number, up to 20. When MacPorts is configured to be "nice" it means that if other programs running on your computer need CPU time, they'll get it first.


> FWIW, you can also increase the "thread count" because each core in modern Macs provide two "hyperthreads" per core.  It's almost like getting two cores per core, but there are various architectural limitations in getting "full throttle" performance (memory bandwidth, ...).

MacPorts already does this for you automatically. The number of jobs it specifies in make's -j argument is based on the output of

sysctl hw.activecpu

which lists the number of active hyperthreaded CPU cores. On my quad-core MacBook Pro, this prints 8. MacPorts reduces this number if your computer doesn't have enough RAM. You can override MacPorts' automatic decisions by changing buildmakejobs in macports.conf from 0 to the number of jobs you want it to start, for ports that support parallel building.



More information about the macports-users mailing list