summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHarmen Stoppels <me@harmenstoppels.nl>2024-10-22 16:13:11 +0200
committerGitHub <noreply@github.com>2024-10-22 14:13:11 +0000
commitef9bb7ebe59fc6053c7c8a2b9323a6037c10393e (patch)
treefd0a23951bde279369ee79578c244d81696568dc /lib
parentfc443ea30e68d20e6efdf7186030ae07d6f81efc (diff)
downloadspack-ef9bb7ebe59fc6053c7c8a2b9323a6037c10393e.tar.gz
spack-ef9bb7ebe59fc6053c7c8a2b9323a6037c10393e.tar.bz2
spack-ef9bb7ebe59fc6053c7c8a2b9323a6037c10393e.tar.xz
spack-ef9bb7ebe59fc6053c7c8a2b9323a6037c10393e.zip
spack arch: add --family --generic flags (#47078)
This allows users to do: ``` spack install ... target=$(spack arch --target --family) spack install ... arch=$(spack arch --family) spack install ... target=$(spack arch --target --generic) spack install ... arch=$(spack arch --generic) ``` Deprecate `--generic-target` in favor of `--generic --target`
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/cmd/arch.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/spack/spack/cmd/arch.py b/lib/spack/spack/cmd/arch.py
index 1634784148..c684a5fa4b 100644
--- a/lib/spack/spack/cmd/arch.py
+++ b/lib/spack/spack/cmd/arch.py
@@ -19,12 +19,23 @@ level = "short"
def setup_parser(subparser):
+ # DEPRECATED: equivalent to --generic --target
subparser.add_argument(
- "-g", "--generic-target", action="store_true", help="show the best generic target"
+ "-g",
+ "--generic-target",
+ action="store_true",
+ help="show the best generic target (deprecated)",
)
subparser.add_argument(
"--known-targets", action="store_true", help="show a list of all known targets and exit"
)
+ target_type = subparser.add_mutually_exclusive_group()
+ target_type.add_argument(
+ "--family", action="store_true", help="print generic ISA (x86_64, aarch64, ppc64le, ...)"
+ )
+ target_type.add_argument(
+ "--generic", action="store_true", help="print feature level (x86_64_v3, armv8.4a, ...)"
+ )
parts = subparser.add_mutually_exclusive_group()
parts2 = subparser.add_mutually_exclusive_group()
parts.add_argument(
@@ -80,6 +91,7 @@ def display_targets(targets):
def arch(parser, args):
if args.generic_target:
+ # TODO: add deprecation warning in 0.24
print(archspec.cpu.host().generic)
return
@@ -96,6 +108,10 @@ def arch(parser, args):
host_platform = spack.platforms.host()
host_os = host_platform.operating_system(os_args)
host_target = host_platform.target(target_args)
+ if args.family:
+ host_target = host_target.family
+ elif args.generic:
+ host_target = host_target.generic
architecture = spack.spec.ArchSpec((str(host_platform), str(host_os), str(host_target)))
if args.platform: