From 30201e33819d3c9eb34ab2888707f62e44ed2244 Mon Sep 17 00:00:00 2001 From: kjrstory Date: Mon, 26 Jun 2023 22:43:27 +0900 Subject: [PATCH] Openfoam: replace two boolean variants with multi-valued variant for precision option (#37736) --- .../repos/builtin/packages/openfoam/package.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/var/spack/repos/builtin/packages/openfoam/package.py b/var/spack/repos/builtin/packages/openfoam/package.py index becd46044a..852e0123b7 100644 --- a/var/spack/repos/builtin/packages/openfoam/package.py +++ b/var/spack/repos/builtin/packages/openfoam/package.py @@ -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: