Allow using -j to control the parallelism of concretization (#37608)

fixes #29464

This PR allows to use
```
$ spack concretize -j X
```
to set a cap on the parallelism of concretization from the command line
This commit is contained in:
Massimiliano Culpo 2023-05-11 22:29:17 +02:00 committed by GitHub
parent 0e87243284
commit 5c7dda7e14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View File

@ -29,6 +29,7 @@ def setup_parser(subparser):
) )
spack.cmd.common.arguments.add_concretizer_args(subparser) spack.cmd.common.arguments.add_concretizer_args(subparser)
spack.cmd.common.arguments.add_common_arguments(subparser, ["jobs"])
def concretize(parser, args): def concretize(parser, args):

View File

@ -1475,7 +1475,10 @@ def _concretize_separately(self, tests=False):
# Solve the environment in parallel on Linux # Solve the environment in parallel on Linux
start = time.time() start = time.time()
max_processes = min(len(arguments), 16) # Number of specs # Cap on 16 cores max_processes = min(
len(arguments), # Number of specs
spack.config.get("config:build_jobs"), # Cap on build jobs
)
# TODO: revisit this print as soon as darwin is parallel too # TODO: revisit this print as soon as darwin is parallel too
msg = "Starting concretization" msg = "Starting concretization"

View File

@ -734,7 +734,7 @@ _spack_compilers() {
} }
_spack_concretize() { _spack_concretize() {
SPACK_COMPREPLY="-h --help -f --force --test -q --quiet -U --fresh --reuse --reuse-deps" SPACK_COMPREPLY="-h --help -f --force --test -q --quiet -U --fresh --reuse --reuse-deps -j --jobs"
} }
_spack_config() { _spack_config() {