hypre: old to new test API (#45066)
* hypre: old to new test API * hypre: restore test_parts; add Makefile cleanup --------- Co-authored-by: Tamara Dahlgren <dahlgren1@llnl.gov>
This commit is contained in:
parent
f9d8b6b5aa
commit
990e0dc526
@ -139,17 +139,11 @@ def patch(self): # fix sequential compilation in 'src/seq_mv'
|
||||
gpu_pkgs = ["magma", "umpire"]
|
||||
for sm_ in CudaPackage.cuda_arch_values:
|
||||
for pkg in gpu_pkgs:
|
||||
depends_on(
|
||||
"{0}+cuda cuda_arch={1}".format(pkg, sm_),
|
||||
when="+{0}+cuda cuda_arch={1}".format(pkg, sm_),
|
||||
)
|
||||
depends_on(f"{pkg}+cuda cuda_arch={sm_}", when=f"+{pkg}+cuda cuda_arch={sm_}")
|
||||
|
||||
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),
|
||||
)
|
||||
depends_on(f"{pkg}+rocm amdgpu_target={gfx}", when=f"+{pkg}+rocm amdgpu_target={gfx}")
|
||||
|
||||
# hypre@:2.28.0 uses deprecated cuSPARSE functions/types (e.g. csrsv2Info_t).
|
||||
depends_on("cuda@:11", when="@:2.28.0+cuda")
|
||||
@ -193,11 +187,13 @@ def patch(self): # fix sequential compilation in 'src/seq_mv'
|
||||
|
||||
def url_for_version(self, version):
|
||||
if version >= Version("2.12.0"):
|
||||
url = "https://github.com/hypre-space/hypre/archive/v{0}.tar.gz"
|
||||
url = f"https://github.com/hypre-space/hypre/archive/v{version}.tar.gz"
|
||||
else:
|
||||
url = "http://computing.llnl.gov/project/linear_solvers/download/hypre-{0}.tar.gz"
|
||||
url = (
|
||||
f"http://computing.llnl.gov/project/linear_solvers/download/hypre-{version}.tar.gz"
|
||||
)
|
||||
|
||||
return url.format(version)
|
||||
return url
|
||||
|
||||
def configure_args(self):
|
||||
spec = self.spec
|
||||
@ -220,8 +216,8 @@ def configure_args(self):
|
||||
os.environ["F77"] = spec["mpi"].mpif77
|
||||
os.environ["FC"] = spec["mpi"].mpifc
|
||||
configure_args.append("--with-MPI")
|
||||
configure_args.append("--with-MPI-lib-dirs={0}".format(spec["mpi"].prefix.lib))
|
||||
configure_args.append("--with-MPI-include={0}".format(spec["mpi"].prefix.include))
|
||||
configure_args.append(f"--with-MPI-lib-dirs={spec['mpi'].prefix.lib}")
|
||||
configure_args.append(f"--with-MPI-include={spec['mpi'].prefix.include}")
|
||||
else:
|
||||
configure_args.append("--without-MPI")
|
||||
|
||||
@ -278,11 +274,11 @@ def configure_args(self):
|
||||
if cuda_arch_vals:
|
||||
cuda_arch_sorted = list(sorted(cuda_arch_vals, reverse=True))
|
||||
cuda_arch = cuda_arch_sorted[0]
|
||||
configure_args.append("--with-gpu-arch={0}".format(cuda_arch))
|
||||
configure_args.append(f"--with-gpu-arch={cuda_arch}")
|
||||
# New in 2.21.0: replaces --enable-cub
|
||||
if spec.satisfies("@2.21.0:"):
|
||||
configure_args.append("--enable-device-memory-pool")
|
||||
configure_args.append("--with-cuda-home={0}".format(spec["cuda"].prefix))
|
||||
configure_args.append(f"--with-cuda-home={spec['cuda'].prefix}")
|
||||
else:
|
||||
configure_args.append("--enable-cub")
|
||||
if spec.satisfies("+cublas"):
|
||||
@ -304,14 +300,14 @@ def configure_args(self):
|
||||
"--with-hip",
|
||||
"--enable-rocrand",
|
||||
"--enable-rocsparse",
|
||||
"--with-extra-CUFLAGS={0}".format(rocm_inc),
|
||||
f"--with-extra-CUFLAGS={rocm_inc}",
|
||||
]
|
||||
)
|
||||
rocm_arch_vals = spec.variants["amdgpu_target"].value
|
||||
if rocm_arch_vals:
|
||||
rocm_arch_sorted = list(sorted(rocm_arch_vals, reverse=True))
|
||||
rocm_arch = rocm_arch_sorted[0]
|
||||
configure_args.append("--with-gpu-arch={0}".format(rocm_arch))
|
||||
configure_args.append(f"--with-gpu-arch={rocm_arch}")
|
||||
if spec.satisfies("+rocblas"):
|
||||
configure_args.append("--enable-rocblas")
|
||||
else:
|
||||
@ -387,36 +383,34 @@ def install(self, spec, prefix):
|
||||
def cache_test_sources(self):
|
||||
cache_extra_test_sources(self, self.extra_install_tests)
|
||||
|
||||
# Customize the makefile to use the installed package
|
||||
makefile = join_path(install_test_root(self), self.extra_install_tests, "Makefile")
|
||||
filter_file(r"^HYPRE_DIR\s* =.*", f"HYPRE_DIR = {self.prefix}", makefile)
|
||||
filter_file(r"^CC\s*=.*", f"CC = {os.environ['CC']}", makefile)
|
||||
filter_file(r"^F77\s*=.*", f"F77 = {os.environ['F77']}", makefile)
|
||||
filter_file(r"^CXX\s*=.*", f"CXX = {os.environ['CXX']}", makefile)
|
||||
|
||||
@property
|
||||
def _cached_tests_work_dir(self):
|
||||
"""The working directory for cached test sources."""
|
||||
return join_path(self.test_suite.current_test_cache_dir, self.extra_install_tests)
|
||||
|
||||
def test(self):
|
||||
"""Perform smoke test on installed HYPRE package."""
|
||||
def test_bigint(self):
|
||||
"""build and run bigint tests"""
|
||||
if "+mpi" not in self.spec:
|
||||
print("Skipping: HYPRE must be installed with +mpi to run tests")
|
||||
return
|
||||
raise SkipTest("Package must be installed with +mpi")
|
||||
|
||||
# Build copied and cached test examples
|
||||
self.run_test(
|
||||
"make",
|
||||
["HYPRE_DIR={0}".format(self.prefix), "bigint"],
|
||||
purpose="test: building selected examples",
|
||||
work_dir=self._cached_tests_work_dir,
|
||||
)
|
||||
# build and run cached examples
|
||||
with working_dir(self._cached_tests_work_dir):
|
||||
make = which("make")
|
||||
make("bigint")
|
||||
|
||||
# Run the examples built above
|
||||
for exe in ["./ex5big", "./ex15big"]:
|
||||
self.run_test(
|
||||
exe,
|
||||
[],
|
||||
[],
|
||||
installed=False,
|
||||
purpose="test: ensuring {0} runs".format(exe),
|
||||
skip_missing=True,
|
||||
work_dir=self._cached_tests_work_dir,
|
||||
)
|
||||
for name in ["ex5big", "ex15big"]:
|
||||
with test_part(self, f"test_bigint_{name}", f"ensure {name} runs"):
|
||||
exe = which(name)
|
||||
if exe is None:
|
||||
raise SkipTest(f"{name} does not exist in version {self.version}")
|
||||
exe()
|
||||
|
||||
@property
|
||||
def headers(self):
|
||||
|
Loading…
Reference in New Issue
Block a user