Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We've recently taken to limit parallelism during builds due to Out Of Memory errors we got while running `cargo test` on 16-core machine, or 8-core machines running with `-j16`. We hit OOM due to two reasons: 1. Commit fae5aed introduced `llvm` dependencies to the blockifier, which notably increased compilation and linking time. 2. Before fae5aed, we already had a quite memory-heavy linking stage, specifically ~7-8 `ld` instances running in parallel, each with ~2-3GB of memory, which was just enough not to hit OOM on most 16core machines. This was primarily due to a combination of factors: 2.1 the blockifier being a large lib that needs a 2-3GB `ld` process to link in isolation. 2.2 many crates have the blockifier as a dependency (transitively). 2.3 `ld` naively parallelizes linking tasks. The combination of the above three issues caused a heavily parallelized environment to create many heavy linking jobs that shared no memory (blockifier linking was duplicated). This PR switches to the rust linker from `ld` to `lld`, thus solving the OOM issue without artificially bounding the amount of parallelization. `lld` handles parallelizing better and reduces memory stress from ~10 2-3GB `ld` linker instances post fae5aed, to ~2 1-2GB `lld` linker instances for the same tasks, which has a minimal memory impact. Moreover, `lld` is already the default linker on `rust` nightly, and will eventually become the default on stable (see code comment for link to tracking issue). Co-Authored-By: Gilad Chase <[email protected]>
- Loading branch information