Openfoam: replace two boolean variants with multi-valued variant for precision option (#37736)

This commit is contained in:
kjrstory 2023-06-26 22:43:27 +09:00 committed by GitHub
parent 501bb88de2
commit 30201e3381
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -325,8 +325,6 @@ class Openfoam(Package):
version("1706", sha256="7779048bb53798d9a5bd2b2be0bf302c5fd3dff98e29249d6e0ef7eeb83db79a")
version("1612", sha256="2909c43506a68e1f23efd0ca6186a6948ae0fc8fe1e39c78cc23ef0d69f3569d")
variant("float32", default=False, description="Use single-precision")
variant("spdp", default=False, description="Use single/double mixed precision")
variant("int64", default=False, description="With 64-bit labels")
variant("knl", default=False, description="Use KNL compiler settings")
variant("kahip", default=False, description="With kahip decomposition")
@ -341,6 +339,13 @@ class Openfoam(Package):
variant(
"source", default=True, description="Install library/application sources and tutorials"
)
variant(
"precision",
default="dp",
description="Precision option",
values=("sp", "dp", conditional("spdp", when="@1906:")),
multi=False,
)
depends_on("mpi")
@ -895,7 +900,7 @@ def __init__(self, spec, **kwargs):
self.compiler = None # <- %compiler
self.arch_option = "" # Eg, -march=knl
self.label_size = None # <- +int64
self.precision_option = "DP" # <- +float32 | +spdp
self.precision_option = "DP" # <- precision= sp | dp | spdp
self.compile_option = kwargs.get("compile-option", "-spack")
self.arch = None
self.options = None
@ -908,10 +913,10 @@ def __init__(self, spec, **kwargs):
self.label_size = "32"
# WM_PRECISION_OPTION
if "+spdp" in spec:
self.precision_option = "SPDP"
elif "+float32" in spec:
if "precision=sp" in spec:
self.precision_option = "SP"
elif "precision=spdp" in spec:
self.precision_option = "SPDP"
# Processor/architecture-specific optimizations
if "+knl" in spec: