rmgdft: add v5.3.1, v5.4.0 and cuda variant (#37813)

Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
This commit is contained in:
Emil Briggs 2023-07-19 02:30:37 -04:00 committed by GitHub
parent 032fd38af0
commit 0facda31eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,7 +7,7 @@
from spack.package import * from spack.package import *
class Rmgdft(CMakePackage): class Rmgdft(CMakePackage, CudaPackage):
"""RMGDFT is a high performance real-space density functional code """RMGDFT is a high performance real-space density functional code
designed for large scale electronic structure calculations.""" designed for large scale electronic structure calculations."""
@ -16,14 +16,12 @@ class Rmgdft(CMakePackage):
maintainers("elbriggs") maintainers("elbriggs")
tags = ["ecp", "ecp-apps"] tags = ["ecp", "ecp-apps"]
version("master", branch="master") version("master", branch="master")
version("5.4.0", tag="v5.4.0")
version("5.3.1", tag="v5.3.1")
version("5.2.0", tag="v5.2.0") version("5.2.0", tag="v5.2.0")
version("5.0.5", tag="v5.0.5") version("5.0.5", tag="v5.0.5")
version("5.0.4", tag="v5.0.4") version("5.0.4", tag="v5.0.4")
version("5.0.1", tag="v5.0.1") version("5.0.1", tag="v5.0.1")
version("4.3.1", tag="v4.3.1")
version("4.3.0", tag="v4.3.0")
version("4.2.2", tag="v4.2.2")
version("4.2.1", tag="v4.2.1")
variant( variant(
"build_type", "build_type",
@ -36,6 +34,8 @@ class Rmgdft(CMakePackage):
variant("local_orbitals", default=True, description="Build O(N) variant.") variant("local_orbitals", default=True, description="Build O(N) variant.")
variant("rocm", default=False, description="Build rocm enabled variant.")
# Normally we want this but some compilers (e.g. IBM) are # Normally we want this but some compilers (e.g. IBM) are
# very slow when this is on so provide the option to disable # very slow when this is on so provide the option to disable
variant( variant(
@ -63,6 +63,11 @@ class Rmgdft(CMakePackage):
depends_on("fftw-api@3") depends_on("fftw-api@3")
depends_on("mpi") depends_on("mpi")
depends_on("hdf5") depends_on("hdf5")
depends_on("cuda", when="+cuda")
with when("+rocm"):
depends_on("hipblas")
depends_on("rocfft")
depends_on("rocsolver")
# RMG is a hybrid MPI/threads code and performance is # RMG is a hybrid MPI/threads code and performance is
# highly dependent on the threading model of the blas # highly dependent on the threading model of the blas
@ -75,9 +80,18 @@ class Rmgdft(CMakePackage):
@property @property
def build_targets(self): def build_targets(self):
spec = self.spec spec = self.spec
targets = ["rmg-cpu"] if "+cuda" in spec:
if "+local_orbitals" in spec: targets = ["rmg-gpu"]
targets.append("rmg-on-cpu") cuda_arch_list = spec.variants["cuda_arch"].value
cuda_arch = cuda_arch_list[0]
if cuda_arch != "none":
args.append("-DCUDA_FLAGS=-arch=sm_{0}".format(cuda_arch))
if "+local_orbitals" in spec:
targets.append("rmg-on-gpu")
else:
targets = ["rmg-cpu"]
if "+local_orbitals" in spec:
targets.append("rmg-on-cpu")
return targets return targets
def cmake_args(self): def cmake_args(self):
@ -91,6 +105,8 @@ def cmake_args(self):
args.append("-DUSE_INTERNAL_PSEUDOPOTENTIALS=1") args.append("-DUSE_INTERNAL_PSEUDOPOTENTIALS=1")
else: else:
args.append("-DUSE_INTERNAL_PSEUDOPOTENTIALS=0") args.append("-DUSE_INTERNAL_PSEUDOPOTENTIALS=0")
if "+cuda" in spec:
args.append("-DRMG_CUDA_ENABLED=1")
return args return args
def install(self, spec, prefix): def install(self, spec, prefix):
@ -99,9 +115,14 @@ def install(self, spec, prefix):
mkdirp(prefix.share.tests.RMG) mkdirp(prefix.share.tests.RMG)
with working_dir(self.build_directory): with working_dir(self.build_directory):
install("rmg-cpu", prefix.bin) if "+cuda" in spec:
if "+local_orbitals" in spec: install("rmg-gpu", prefix.bin)
install("rmg-on-cpu", prefix.bin) if "+local_orbitals" in spec:
install("rmg-on-gpu", prefix.bin)
else:
install("rmg-cpu", prefix.bin)
if "+local_orbitals" in spec:
install("rmg-on-cpu", prefix.bin)
# install tests # install tests
with working_dir(self.build_directory): with working_dir(self.build_directory):