-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Cargo installing multiple bin crates doesn't build them in parallel #9741
Comments
@rustbot claim |
I put up #9793 as a step in the right direction, however I was unable to figure out how to actually parallelize the install command. I tried naively using rayon to parallelize, but the |
@rustbot release-assignment |
Determine packages to install prior to installing Old logic (pseudocode) ``` for krate in to_install { pkg = determine_pkg(krate); install_pkg(pkg); } ``` New logic ``` let pkgs = to_install.into_iter(|krate| determine_pkg(krate)); pkgs.into_iter(|pkg| install_pkg(pkg)); ``` This has the short term benefit of dumping most error messages out earlier in the process (eg a typo in the second package name). Longer term, it might help with #9741 - as only the second loop would be parallelized. First loop shouldn't be parallelized because it would lead to redundant registry/git updates.
Please make this happen. I have 90+ cores sitting idle during tool install builds and it takes forever. 🙏 |
Just got an idea as a workaround. Since Cargo honors GNU make jobserver, We can do tricks with the combos of parallel and make: # Makefile
all:
+parallel cargo install ::: cli1 cli2 cli3 cli4 cli5 cli6 cli7 cli8... Then run By doing so, the number of rustc invocations can be controlled by jobserver. OTOH, GNU parallel works as a scheduler to coordinate which binary to install next. You might also tweak |
Describe the problem you are trying to solve
When installing multiple bin crates, such as suggested by the rustc-dev-guide build instructions they are built sequentially. This doesn't fully utilize available parallelism on many-core systems and thus leads to longer build times than necessary.
Describe the solution you'd like
It would be nice if the binaries could be built in parallel under a shared jobserver to reduce wall-time for the install command.
The text was updated successfully, but these errors were encountered: