spack arch: add --generic argument (#27061)

The `--generic` argument allows printing the best generic target for the
current machine. This can be quite handy when wanting to find the
generic architecture to use when building a shared software stack for
multiple machines.
This commit is contained in:
Michael Kuhn 2021-11-02 10:19:23 +01:00 committed by GitHub
parent 9d3d7c68fb
commit 1e26e25bc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -20,6 +20,10 @@
def setup_parser(subparser):
subparser.add_argument(
'-g', '--generic-target', action='store_true',
help='show the best generic target'
)
subparser.add_argument(
'--known-targets', action='store_true',
help='show a list of all known targets and exit'
@ -74,6 +78,10 @@ def display_target_group(header, target_group):
def arch(parser, args):
if args.generic_target:
print(archspec.cpu.host().generic)
return
if args.known_targets:
display_targets(archspec.cpu.TARGETS)
return

View File

@ -382,7 +382,7 @@ _spack_analyze_run() {
}
_spack_arch() {
SPACK_COMPREPLY="-h --help --known-targets -p --platform -o --operating-system -t --target -f --frontend -b --backend"
SPACK_COMPREPLY="-h --help -g --generic-target --known-targets -p --platform -o --operating-system -t --target -f --frontend -b --backend"
}
_spack_audit() {