-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: Add the parallel
feature, set -j
arg based on NUM_JOBS
#25
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My main concern with just parallelizing a lot is that this can cause OoMs.
I think cmake might just ignore the MAKEFLAGS
. How about adding the entire -- -j --jobserver-fds=8,9 --jobserver-auth=8,9
at the end instead?
Hrm, seems like some upstream issues about this:
Not sure what the right fix is, but concur with Dennis that disabling the jobserver and allowing parallelism has led to OOMs in CI during builds in the past. |
Is there a way to have this for builds on dev machines? It's rare that this crate needs to be rebuilt but not THAT rare, especially if I'm jumping around branches etc |
It's still dicey. We've seen compiling Materialize OOM on dev machines in the past when we haven't been careful to let one single jobserver be responsible for managing all the parallelism. The jobserver protocol isn't all that complicated. I'm hopeful that it might be possible to track down whatever the root cause here is without too much trouble. |
Concerns about memory usage totally makes sense! I'm going to close this out for now since this PR isn't the right approach, but also I don't have the cycles at the moment to investigate the upstream jobserver issue. As a workaround folks building Materialize can use Bazel which handles this more gracefully. |
FYI there's a great chance this issue would be fixed by rust-lang/cmake-rs#229. One workaround in the meantime is to set the |
Ahh, nice, thanks for tracking that down, @kesyog! What's the behavior on macOS with your PR? Does CMake pass |
Yeah, pretty much exactly. So there’s still potential for extra memory usage with this change, but it is at least for macOS only. And the number of jobs could be limited if that caused issues for macOS builders (see below). A few pedantic clarifications:
|
Makes sense! So @ParkMyCar I think we should just update to the next version of cmake-rs (whenever @kesyog's PR makes it into a release) and hopefully that fixes folks' issues here. 🤞🏽 |
This PR speeds up builds of
protobuf-src
for me from ~5 minutes to ~1 minute.There's probably a higher level issue that I haven't dug into here yet, the actually
cmake
command that gets run, without this PR, is:This should parallelize the build with Cargo's jobserver (I think?), but something seems to go wrong and at least locally, after ~30 seconds I only see one instance of
clang
running.With this PR the
cmake
command is updated to:Further, looking at the logs from
cmake
this seems to disable jobserver mode:This isn't ideal, but something seems to be going wrong with Cargo's job server which is seriously slowing down builds.