[Scons-users] Add `--parallel` option to automatically use all CPU threads

Fred Wright fw at fwright.net
Wed Apr 6 21:58:01 EDT 2022


On Wed, 6 Apr 2022, Bill Deegan wrote:

> There's no need to add an additional option for this.
> If you can programmatically detect the # of cores (in python), you can do
> this in your own code via SetOption('num_jobs', NUMBER  HERE) and even
> check if num_jobs is set to 1 which is the current default value and if so
> then set it to the actual number of cores.
>
> What might work as a SCons default behavior change though, is to have -j's
> default value be 0 and if 0, use some logic to set based on # of available
> cores.

MacPorts does something like this, though it also looks at the amount of 
RAM.  I think it assumes that you should have at least N+1 GiB of RAM for 
N parallel processes.

The parallel default seems reasonable, and it can be overridden when 
needed by explicitly giving -j1.  But that wouldn't work if your 
suggestion in the first paragraph were used.  So perhaps SetOption() 
shouldn't be able to override an explicit setting on the command line.

Fred Wright


More information about the Scons-users mailing list