summaryrefslogtreecommitdiff
path: root/lib/spack
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 /lib/spack
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.
Diffstat (limited to 'lib/spack')
-rw-r--r--lib/spack/spack/cmd/arch.py8
1 files changed, 8 insertions, 0 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