hypre: add support for magma (#40121)

This commit is contained in:
Victor A. P. Magri 2023-09-26 00:27:14 -04:00 committed by GitHub
parent 9fda22d942
commit aec88ef3e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -76,6 +76,7 @@ class Hypre(AutotoolsPackage, CudaPackage, ROCmPackage):
variant("gptune", default=False, description="Add the GPTune hookup code")
variant("umpire", default=False, description="Enable Umpire support")
variant("sycl", default=False, description="Enable SYCL support")
variant("magma", default=False, description="Enable MAGMA interface")
variant("caliper", default=False, description="Enable Caliper support")
# Patch to add gptune hookup codes
@ -100,6 +101,7 @@ def patch(self): # fix sequential compilation in 'src/seq_mv'
depends_on("mpi", when="+mpi")
depends_on("blas")
depends_on("lapack")
depends_on("magma", when="+magma")
depends_on("superlu-dist", when="+superlu-dist+mpi")
depends_on("rocsparse", when="+rocm")
depends_on("rocthrust", when="+rocm")
@ -108,18 +110,23 @@ def patch(self): # fix sequential compilation in 'src/seq_mv'
depends_on("umpire", when="+umpire")
depends_on("caliper", when="+caliper")
gpu_pkgs = ["magma", "umpire"]
for sm_ in CudaPackage.cuda_arch_values:
for pkg in gpu_pkgs:
depends_on(
"umpire+cuda cuda_arch={0}".format(sm_), when="+umpire+cuda cuda_arch={0}".format(sm_)
)
for gfx in ROCmPackage.amdgpu_targets:
depends_on(
"umpire+rocm amdgpu_target={0}".format(gfx),
when="+umpire+rocm amdgpu_target={0}".format(gfx),
"{0}+cuda cuda_arch={1}".format(pkg, sm_),
when="+{0}+cuda cuda_arch={1}".format(pkg, sm_),
)
# Uses deprecated cuSPARSE functions/types (e.g. csrsv2Info_t).
depends_on("cuda@:11", when="+cuda")
for gfx in ROCmPackage.amdgpu_targets:
for pkg in gpu_pkgs:
depends_on(
"{0}+rocm amdgpu_target={1}".format(pkg, gfx),
when="+{0}+rocm amdgpu_target={1}".format(pkg, gfx),
)
# hypre@:2.28.0 uses deprecated cuSPARSE functions/types (e.g. csrsv2Info_t).
depends_on("cuda@:11", when="@:2.28.0+cuda")
# Conflicts
conflicts("+cuda", when="+int64")
@ -150,6 +157,9 @@ def patch(self): # fix sequential compilation in 'src/seq_mv'
# Option added in v2.24.0
conflicts("+sycl", when="@:2.23")
# Option added in v2.29.0
conflicts("+magma", when="@:2.28")
configure_directory = "src"
def url_for_version(self, version):
@ -280,6 +290,11 @@ def configure_args(self):
if "+unified-memory" in spec:
configure_args.append("--enable-unified-memory")
if "+magma" in spec:
configure_args.append("--with-magma-include=%s" % spec["magma"].prefix.include)
configure_args.append("--with-magma-lib=%s" % spec["magma"].libs)
configure_args.append("--with-magma")
configure_args.extend(self.enable_or_disable("fortran"))
return configure_args
@ -329,7 +344,7 @@ def install(self, spec, prefix):
@run_after("install")
def cache_test_sources(self):
self.cache_extra_test_sources(self.extra_install_tests)
cache_extra_test_sources(self, self.extra_install_tests)
@property
def _cached_tests_work_dir(self):