ELSI: improve package (#44717)
* Spglib: add version 2.4.0 * DLA-Future: fix +test option * elsi * elsi improvements * [@spackbot] updating style on behalf of RMeli * remove test variants * fix ntpoly and and use externals as default --------- Co-authored-by: RMeli <RMeli@users.noreply.github.com>
This commit is contained in:
parent
822622f07a
commit
dfab3e8829
@ -7,7 +7,7 @@
|
|||||||
from spack.package import *
|
from spack.package import *
|
||||||
|
|
||||||
|
|
||||||
class Elsi(CMakePackage):
|
class Elsi(CMakePackage, CudaPackage):
|
||||||
"""ELSI provides a unified interface for electronic structure
|
"""ELSI provides a unified interface for electronic structure
|
||||||
codes to a variety of eigenvalue solvers."""
|
codes to a variety of eigenvalue solvers."""
|
||||||
|
|
||||||
@ -31,29 +31,56 @@ class Elsi(CMakePackage):
|
|||||||
)
|
)
|
||||||
variant("enable_pexsi", default=False, description="Enable PEXSI support")
|
variant("enable_pexsi", default=False, description="Enable PEXSI support")
|
||||||
variant("enable_sips", default=False, description="Enable SLEPc-SIPs support")
|
variant("enable_sips", default=False, description="Enable SLEPc-SIPs support")
|
||||||
variant("use_external_elpa", default=False, description="Build ELPA using SPACK")
|
variant("use_external_elpa", default=True, description="Build ELPA using SPACK")
|
||||||
variant("use_external_ntpoly", default=False, description="Build NTPoly using SPACK")
|
variant("use_external_ntpoly", default=True, description="Build NTPoly using SPACK")
|
||||||
variant("use_external_omm", default=False, description="Use external libOMM and MatrixSwitch")
|
variant("use_external_superlu", default=True, description="Use external SuperLU DIST")
|
||||||
variant("use_external_superlu", default=False, description="Use external SuperLU DIST")
|
|
||||||
variant(
|
variant(
|
||||||
"use_mpi_iallgather", default=True, description="Use non-blocking collective MPI functions"
|
"use_mpi_iallgather", default=True, description="Use non-blocking collective MPI functions"
|
||||||
)
|
)
|
||||||
|
variant(
|
||||||
|
"internal_elpa_version",
|
||||||
|
default="2024",
|
||||||
|
values=("2024", "2023_11", "2023", "2021", "2020"),
|
||||||
|
description="Internal ELPA version",
|
||||||
|
multi=False,
|
||||||
|
)
|
||||||
|
|
||||||
# Basic dependencies
|
# Basic dependencies
|
||||||
depends_on("blas", type="link")
|
depends_on("blas", type="link")
|
||||||
depends_on("lapack", type="link")
|
depends_on("lapack", type="link")
|
||||||
depends_on("cmake", type="build")
|
|
||||||
depends_on("mpi")
|
|
||||||
depends_on("scalapack", type="link")
|
depends_on("scalapack", type="link")
|
||||||
|
depends_on("mpi")
|
||||||
|
|
||||||
# Library dependencies
|
# Library dependencies
|
||||||
depends_on("elpa", when="+use_external_elpa")
|
with when("+use_external_elpa"):
|
||||||
|
depends_on("elpa+cuda", when="+cuda")
|
||||||
|
depends_on("elpa~cuda", when="~cuda")
|
||||||
depends_on("ntpoly", when="+use_external_ntpoly")
|
depends_on("ntpoly", when="+use_external_ntpoly")
|
||||||
depends_on("slepc", when="+enable_sips")
|
with when("+enable_sips"):
|
||||||
depends_on("petsc", when="+enable_sips")
|
depends_on("slepc+cuda", when="+cuda")
|
||||||
depends_on("superlu-dist", when="+use_external_superlu")
|
depends_on("slepc~cuda", when="~cuda")
|
||||||
|
depends_on("petsc+cuda", when="+cuda")
|
||||||
|
depends_on("petsc~cuda", when="~cuda")
|
||||||
|
with when("+use_external_superlu"):
|
||||||
|
depends_on("superlu-dist+cuda", when="+cuda")
|
||||||
|
depends_on("superlu-dist~cuda", when="~cuda")
|
||||||
|
|
||||||
def cmake_args(self):
|
def cmake_args(self):
|
||||||
|
libs_names = ["scalapack", "lapack", "blas"]
|
||||||
|
|
||||||
|
# External libraries
|
||||||
|
if self.spec.satisfies("+use_external_elpa"):
|
||||||
|
libs_names.append("elpa")
|
||||||
|
if self.spec.satisfies("+use_external_ntpoly"):
|
||||||
|
libs_names.append("ntpoly")
|
||||||
|
if self.spec.satisfies("+use_external_superlu"):
|
||||||
|
libs_names.append("superlu-dist")
|
||||||
|
|
||||||
|
lib_paths, libs = [], []
|
||||||
|
for lib in libs_names:
|
||||||
|
lib_paths.extend(self.spec[lib].libs.directories)
|
||||||
|
libs.extend(self.spec[lib].libs.names)
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
# Compiler Information (ELSI wants these explicitly set)
|
# Compiler Information (ELSI wants these explicitly set)
|
||||||
self.define("CMAKE_Fortran_COMPILER", self.spec["mpi"].mpifc),
|
self.define("CMAKE_Fortran_COMPILER", self.spec["mpi"].mpifc),
|
||||||
@ -64,9 +91,14 @@ def cmake_args(self):
|
|||||||
self.define_from_variant("ENABLE_SIPS", "enable_sips"),
|
self.define_from_variant("ENABLE_SIPS", "enable_sips"),
|
||||||
self.define_from_variant("USE_EXTERNAL_ELPA", "use_external_elpa"),
|
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_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_EXTERNAL_SUPERLU", "use_external_superlu"),
|
||||||
self.define_from_variant("USE_MPI_IALLGATHER", "use_mpi_iallgather"),
|
self.define_from_variant("USE_MPI_IALLGATHER", "use_mpi_iallgather"),
|
||||||
|
self.define("ENABLE_TESTS", self.run_tests),
|
||||||
|
self.define("ENABLE_C_TESTS", self.run_tests),
|
||||||
|
self.define_from_variant("USE_GPU_CUDA", "cuda"),
|
||||||
|
self.define("LIB_PATHS", ";".join(lib_paths)),
|
||||||
|
self.define("LIBS", ";".join(libs)),
|
||||||
|
self.define(f"USE_ELPA_{self.spec.variants['internal_elpa_version'].value}", True),
|
||||||
]
|
]
|
||||||
|
|
||||||
if self.spec.variants["elpa2_kernel"].value != "none":
|
if self.spec.variants["elpa2_kernel"].value != "none":
|
||||||
|
@ -23,13 +23,22 @@ class Ntpoly(CMakePackage):
|
|||||||
version("3.1.0", sha256="71cd6827f20c68e384555dbcfc85422d0690e21d21d7b5d4f7375544a2755271")
|
version("3.1.0", sha256="71cd6827f20c68e384555dbcfc85422d0690e21d21d7b5d4f7375544a2755271")
|
||||||
version("2.3.1", sha256="af8c7690321607fbdee9671b9cb3acbed945148014e0541435858cf82bfd887e")
|
version("2.3.1", sha256="af8c7690321607fbdee9671b9cb3acbed945148014e0541435858cf82bfd887e")
|
||||||
|
|
||||||
|
variant("shared", default=True, description="Build shared libraries.")
|
||||||
|
|
||||||
depends_on("cmake", type="build")
|
depends_on("cmake", type="build")
|
||||||
depends_on("blas", type="link")
|
depends_on("blas", type="link")
|
||||||
depends_on("mpi@3")
|
depends_on("mpi@3")
|
||||||
|
|
||||||
def cmake_args(self):
|
def cmake_args(self):
|
||||||
args = ["-DNOSWIG=Yes"]
|
args = ["-DNOSWIG=Yes", self.define_from_variant("BUILD_SHARED_LIBS", "shared")]
|
||||||
|
|
||||||
if self.spec.satisfies("%fj"):
|
if self.spec.satisfies("%fj"):
|
||||||
args.append("-DCMAKE_Fortran_MODDIR_FLAG=-M")
|
args.append("-DCMAKE_Fortran_MODDIR_FLAG=-M")
|
||||||
|
|
||||||
return args
|
return args
|
||||||
|
|
||||||
|
@property
|
||||||
|
def libs(self):
|
||||||
|
return find_libraries(
|
||||||
|
["libNTPoly", "libNTPolyCPP", "libNTPolyWrapper"], root=self.home, recursive=True
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user