summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Kuhn <michael.kuhn@ovgu.de>2021-11-02 10:19:23 +0100
committerGitHub <noreply@github.com>2021-11-02 10:19:23 +0100
commit1e26e25bc8b2d37b9484d84b2987afe3d31fbd6e (patch)
tree9c03bc17335568c35b4da66f1d5a216a79e416c8
parent9d3d7c68fb76d112ab048b2cc581d48bc22aa9f4 (diff)
downloadspack-1e26e25bc8b2d37b9484d84b2987afe3d31fbd6e.tar.gz
spack-1e26e25bc8b2d37b9484d84b2987afe3d31fbd6e.tar.bz2
spack-1e26e25bc8b2d37b9484d84b2987afe3d31fbd6e.tar.xz
spack-1e26e25bc8b2d37b9484d84b2987afe3d31fbd6e.zip
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.
-rw-r--r--lib/spack/spack/cmd/arch.py8
-rwxr-xr-xshare/spack/spack-completion.bash2
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/spack/spack/cmd/arch.py b/lib/spack/spack/cmd/arch.py
index 29b35000f0..e6633f186c 100644
--- a/lib/spack/spack/cmd/arch.py
+++ b/lib/spack/spack/cmd/arch.py
@@ -21,6 +21,10 @@ level = "short"
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_targets(targets):
def arch(parser, args):
+ if args.generic_target:
+ print(archspec.cpu.host().generic)
+ return
+
if args.known_targets:
display_targets(archspec.cpu.TARGETS)
return
diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash
index a5610f5872..90bb79a66a 100755
--- a/share/spack/spack-completion.bash
+++ b/share/spack/spack-completion.bash
@@ -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() {