Hi,
On 12/4/24 23:37, Stefano Rivera wrote:
I don't think this can be entirely outside-in, the package needs to say
how much ram it needs per-core, to be able to calculate the appropriate
degree of parallelism. So, we have to declare a value that then gets
calculated against the proposed parallelism.
This.
Also, the Ninja build system provides resource pools -- typical packages
use only the "CPU" pool, and reserve one CPU per task started, but it is
possible to also define a "memory" pool and declare tasks with memory
reservations, which reduces parallel execution only while
memory-intensive tasks are running.
For LLVM specifically, GettingStarted.md documents
- -DLLVM_PARALLEL_{COMPILE,LINK,TABLEGEN}_JOBS=N — Limit the number
of compile/link/tablegen jobs running in parallel at the same
time. This is especially important for linking since linking can
use lots of memory. If you run into memory issues building LLVM,
try setting this to limit the maximum number of compile/link/
tablegen jobs running at the same time.
How we arrive at N is left as an exercise for the reader though.
Simon