elsi: cleanup recipe (#42355)

This commit is contained in:
Massimiliano Culpo 2024-01-30 14:08:10 +01:00 committed by GitHub
parent b70cb60b65
commit 1882920c97
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2,12 +2,10 @@
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os.path
from spack.package import * from spack.package import *
# See the Spack documentation for more information on packaging.
# ----------------------------------------------------------------------------
class Elsi(CMakePackage): class Elsi(CMakePackage):
"""ELSI provides a unified interface for electronic structure """ELSI provides a unified interface for electronic structure
@ -20,7 +18,6 @@ class Elsi(CMakePackage):
version("2.2.1", sha256="5b4b2e8fa4b3b68131fe02cc1803a884039b89a1b1138af474af66453bec0b4d") version("2.2.1", sha256="5b4b2e8fa4b3b68131fe02cc1803a884039b89a1b1138af474af66453bec0b4d")
# Variants (translation of cmake options)
variant("add_underscore", default=True, description="Suffix C functions with an underscore") variant("add_underscore", default=True, description="Suffix C functions with an underscore")
variant( variant(
"elpa2_kernel", "elpa2_kernel",
@ -54,47 +51,30 @@ class Elsi(CMakePackage):
depends_on("superlu-dist", when="+use_external_superlu") depends_on("superlu-dist", when="+use_external_superlu")
def cmake_args(self): def cmake_args(self):
from os.path import dirname 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"),
]
spec = self.spec if self.spec.variants["elpa2_kernel"].value != "none":
args = [] args.append(self.define_from_variant("ELPA2_KERNEL", "elpa2_kernel"))
# Compiler Information if self.spec.satisfies("+use_external_elpa"):
# (ELSI wants these explicitly set) elpa_module = find(self.spec["elpa"].prefix, "elpa.mod")
args += ["-DCMAKE_Fortran_COMPILER=" + self.spec["mpi"].mpifc] args.append(self.define("INC_PATHS", os.path.dirname(elpa_module[0])))
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"]
# Only when using fujitsu compiler # Only when using fujitsu compiler
if spec.satisfies("%fj"): if self.spec.satisfies("%fj"):
args += ["-DCMAKE_Fortran_MODDIR_FLAG=-M"] args.append(self.define("CMAKE_Fortran_MODDIR_FLAG", "-M"))
return args return args