summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2024-01-30 14:08:10 +0100
committerGitHub <noreply@github.com>2024-01-30 14:08:10 +0100
commit1882920c97c3a59a0f06d0496542a20bc50b3601 (patch)
treec8f206493d819efe4f6fc3cf700f68a16009fe4c
parentb70cb60b6581ee4b02f786de516aa6a24457c063 (diff)
downloadspack-1882920c97c3a59a0f06d0496542a20bc50b3601.tar.gz
spack-1882920c97c3a59a0f06d0496542a20bc50b3601.tar.bz2
spack-1882920c97c3a59a0f06d0496542a20bc50b3601.tar.xz
spack-1882920c97c3a59a0f06d0496542a20bc50b3601.zip
elsi: cleanup recipe (#42355)
-rw-r--r--var/spack/repos/builtin/packages/elsi/package.py68
1 files changed, 24 insertions, 44 deletions
diff --git a/var/spack/repos/builtin/packages/elsi/package.py b/var/spack/repos/builtin/packages/elsi/package.py
index 23fa1fc40f..5c6da3eef6 100644
--- a/var/spack/repos/builtin/packages/elsi/package.py
+++ b/var/spack/repos/builtin/packages/elsi/package.py
@@ -2,12 +2,10 @@
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+import os.path
from spack.package import *
-# See the Spack documentation for more information on packaging.
-# ----------------------------------------------------------------------------
-
class Elsi(CMakePackage):
"""ELSI provides a unified interface for electronic structure
@@ -20,7 +18,6 @@ class Elsi(CMakePackage):
version("2.2.1", sha256="5b4b2e8fa4b3b68131fe02cc1803a884039b89a1b1138af474af66453bec0b4d")
- # Variants (translation of cmake options)
variant("add_underscore", default=True, description="Suffix C functions with an underscore")
variant(
"elpa2_kernel",
@@ -54,47 +51,30 @@ class Elsi(CMakePackage):
depends_on("superlu-dist", when="+use_external_superlu")
def cmake_args(self):
- from os.path import dirname
-
- spec = self.spec
- args = []
-
- # Compiler Information
- # (ELSI wants these explicitly set)
- args += ["-DCMAKE_Fortran_COMPILER=" + self.spec["mpi"].mpifc]
- args += ["-DCMAKE_C_COMPILER=" + self.spec["mpi"].mpicc]
- args += ["-DCMAKE_CXX_COMPILER=" + self.spec["mpi"].mpicxx]
-
- # Handle the various variants
- if "-add_underscore" in self.spec:
- args += ["-DADD_UNDERSCORE=OFF"]
- if (
- "elpa2_kernel" in self.spec.variants
- and self.spec.variants["elpa2_kernel"].value != "none"
- ):
- kernel = self.spec.variants["elpa2_kernel"].value
- args += ["-DELPA2_KERNEL=" + kernel]
- if "+enable_pexsi" in self.spec:
- args += ["-DENABLE_PEXSI=ON"]
- if "+enable_sips" in self.spec:
- args += ["-DENABLE_SIPS=ON"]
- if "+use_external_elpa" in self.spec:
- args += ["-DUSE_EXTERNAL_ELPA=ON"]
- # Setup the searchpath for elpa
- elpa = self.spec["elpa"]
- elpa_module = find(elpa.prefix, "elpa.mod")
- args += ["-DINC_PATHS=" + dirname(elpa_module[0])]
- if "+use_external_ntpoly" in self.spec:
- args += ["-DUSE_EXTERNAL_NTPOLY=ON"]
- if "+use_external_omm" in self.spec:
- args += ["-DUSE_EXTERNAL_OMM=ON"]
- if "+use_external_superlu" in self.spec:
- args += ["-DUSE_EXTERNAL_SUPERLU=ON"]
- if "-use_mpi_iallgather" in self.spec:
- args += ["-DUSE_MPI_IALLGATHER=OFF"]
+ args = [
+ # Compiler Information (ELSI wants these explicitly set)
+ self.define("CMAKE_Fortran_COMPILER", self.spec["mpi"].mpifc),
+ self.define("CMAKE_C_COMPILER", self.spec["mpi"].mpicc),
+ self.define("CMAKE_CXX_COMPILER", self.spec["mpi"].mpicxx),
+ self.define_from_variant("ADD_UNDERSCORE", "add_underscore"),
+ self.define_from_variant("ENABLE_PEXSI", "enable_pexsi"),
+ self.define_from_variant("ENABLE_SIPS", "enable_sips"),
+ self.define_from_variant("USE_EXTERNAL_ELPA", "use_external_elpa"),
+ self.define_from_variant("USE_EXTERNAL_NTPOLY", "use_external_ntpoly"),
+ self.define_from_variant("USE_EXTERNAL_OMM", "use_external_omm"),
+ self.define_from_variant("USE_EXTERNAL_SUPERLU", "use_external_superlu"),
+ self.define_from_variant("USE_MPI_IALLGATHER", "use_mpi_iallgather"),
+ ]
+
+ if self.spec.variants["elpa2_kernel"].value != "none":
+ args.append(self.define_from_variant("ELPA2_KERNEL", "elpa2_kernel"))
+
+ if self.spec.satisfies("+use_external_elpa"):
+ elpa_module = find(self.spec["elpa"].prefix, "elpa.mod")
+ args.append(self.define("INC_PATHS", os.path.dirname(elpa_module[0])))
# Only when using fujitsu compiler
- if spec.satisfies("%fj"):
- args += ["-DCMAKE_Fortran_MODDIR_FLAG=-M"]
+ if self.spec.satisfies("%fj"):
+ args.append(self.define("CMAKE_Fortran_MODDIR_FLAG", "-M"))
return args