-
Notifications
You must be signed in to change notification settings - Fork 248
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
WIP: provisional parallelization support #1202
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,13 @@ def enable_tracing(): | |
def disable_tracing(): | ||
return "set +x" | ||
|
||
def enable_parallel_build(): | ||
return """ | ||
_cpu_count=$(nproc) | ||
export MAKEFLAGS="-j$_cpu_count${MAKEFLAGS:+ }${MAKEFLAGS:-}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd also suggest setting |
||
export CMAKE_BUILD_PARALLEL_LEVEL="$_cpu_count" | ||
""" | ||
|
||
def mkdirs(path): | ||
return "mkdir -p " + path | ||
|
||
|
@@ -264,6 +271,7 @@ commands = struct( | |
define_sandbox_paths = define_sandbox_paths, | ||
disable_tracing = disable_tracing, | ||
echo = echo, | ||
enable_parallel_build = enable_parallel_build, | ||
enable_tracing = enable_tracing, | ||
env = env, | ||
export_var = export_var, | ||
|
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.
This is a slightly naiive way of getting a cpu account as nproc is not cgroup aware AFAIK.
When running under RBE its likely that you will be constrained in a cgroup and so this added parallelism there will likely actually result in slower builds in those environments. I've yet to see a good way of interrogating cgroups to work out how many processes you actually want to spawn in a reliable way.