-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
bazel: the captured cmake dependency does not build efficiently #65894
Comments
The behavior is actually "correct" inasmuch as we should only be using multiple CPU's if we can have Bazel parallelize the workload, which it can't meaningfully if sub-tasks are arbitrarily using as many cores as they want under the scenes. In terms of making this faster I'm more interested in patching |
Ok but how do you explain that the cmake build inside the bazel sandbox does not parallelize, whereas it does when run outside of the sandbox?
That would be lovely. |
Not really sure what this question means. Doesn't your own observation answer this question?
|
bazel-contrib/rules_foreign_cc#329 for reference on the overarching issue here. |
ok so the root cause is that In any case, the issue at the top remains. Building cmake costs 5-10 minutes and is currently responsible for 60% of the run time of the "Bazel CI" target in TC. |
I'm seeing this too for local builds. The majority of the time spent in a bazel build is actually spent building cmake from scratch, which is surprising.
|
Is there a way to tell Bazel to use the host cmake instead of baking a new one? At least for local builds? |
Yeah, this should do it:
Might be a way to do it with command-line options instead of updating the workspace, not sure what that is yet though. |
for now, I'll take that as a workaround. thank you! (Still would be interesting to lower the time of the CI target, but for that I support your idea to download a pre-built binary) |
I took a look and |
I can use your workaround if need be |
71720: sql/pgwire: fix error code for decoding binary array r=otan a=rafiss This matches Postgres. Release note: None 71735: bazel: use preinstalled cmake/make for rules_foreign_cc tasks r=rail a=rickystewart This allows us to avoid bootstrapping `make` and `cmake` for `c-deps` builds. It does require you to have `cmake` and `make` installed locally, but I don't think that's a huge deal. Closes #65894. Closes #71734. Release note: None Co-authored-by: Rafi Shamim <rafi@cockroachlabs.com> Co-authored-by: Ricky Stewart <ricky@cockroachlabs.com>
This allows us to avoid bootstrapping `make` and `cmake` for `c-deps` builds. It does require you to have `cmake` and `make` installed locally, but I don't think that's a huge deal. Closes cockroachdb#65894. Closes cockroachdb#71734. Release note: None
Describe the problem
When running
bazel
for the first time after a c++ compiler update, or a version change etc, it needs to re-build its embedded (captured) copy ofcmake
again.However, the build process for
cmake
is veeeerrrryyyyyyy looooooonnnnnngggggg(upwards of 10 minutes)
The main problem is that the build flags do not include
-j
or something similar to parallelize the build, so we're seeing hundreds of c++ files compiled one after another.To Reproduce
Build from scratch without a cached pre-built
cmake
.Expected behavior
The
cmake
builds uses all 32 cores on my computer.Additional data / screenshots
htop output:
Epic CRDB-8036
The text was updated successfully, but these errors were encountered: