diff options
author | Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com> | 2024-07-24 17:57:12 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-24 17:57:12 -0700 |
commit | ff144df54906a659a53e4de3b1d47a4194b6962d (patch) | |
tree | 4673d51285dfa82a2d62d9586c72b1ef03eedad3 /var | |
parent | f3acf201c4908f5fd44242676b98ed84ca4b91fd (diff) | |
download | spack-ff144df54906a659a53e4de3b1d47a4194b6962d.tar.gz spack-ff144df54906a659a53e4de3b1d47a4194b6962d.tar.bz2 spack-ff144df54906a659a53e4de3b1d47a4194b6962d.tar.xz spack-ff144df54906a659a53e4de3b1d47a4194b6962d.zip |
strumpack: make standalone test for +mpi more robust (#44943)
* strumpack: make standalone test for +mpi more robust
* Comment about which MPI launcher being attempted
Diffstat (limited to 'var')
-rw-r--r-- | var/spack/repos/builtin/packages/strumpack/package.py | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/var/spack/repos/builtin/packages/strumpack/package.py b/var/spack/repos/builtin/packages/strumpack/package.py index eb20c3812f..5f72996151 100644 --- a/var/spack/repos/builtin/packages/strumpack/package.py +++ b/var/spack/repos/builtin/packages/strumpack/package.py @@ -3,8 +3,13 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +import os + +import llnl.util.tty as tty + from spack.package import * from spack.util.environment import set_env +from spack.util.executable import ProcessError class Strumpack(CMakePackage, CudaPackage, ROCmPackage): @@ -205,7 +210,7 @@ class Strumpack(CMakePackage, CudaPackage, ROCmPackage): install test subdirectory for use during `spack test run`.""" self.cache_extra_test_sources([self.test_data_dir, self.test_src_dir]) - def _test_example(self, test_prog, test_cmd, test_args): + def _test_example(self, test_prog, test_cmd, pre_args=[]): test_dir = join_path(self.test_suite.current_test_cache_dir, self.test_src_dir) cmake_filename = join_path(test_dir, "CMakeLists.txt") with open(cmake_filename, "w") as mkfile: @@ -218,9 +223,7 @@ class Strumpack(CMakePackage, CudaPackage, ROCmPackage): ) with working_dir(test_dir): - opts = self.builder.std_cmake_args - opts += self.cmake_args() - opts += ["."] + opts = self.builder.std_cmake_args + self.cmake_args() + ["."] cmake = self.spec["cmake"].command cmake(*opts) @@ -229,29 +232,32 @@ class Strumpack(CMakePackage, CudaPackage, ROCmPackage): with set_env(OMP_NUM_THREADS="1"): exe = which(test_cmd) + test_args = pre_args + [join_path("..", self.test_data_dir, "pde900.mtx")] exe(*test_args) def test_sparse_seq(self): """Run sequential test_sparse""" - if "+mpi" in self.spec: - raise SkipTest("Package must be installed with '~mpi'") test_exe = "test_sparse_seq" - exe_arg = [join_path("..", self.test_data_dir, "pde900.mtx")] - self._test_example(test_exe, test_exe, exe_arg) + self._test_example(test_exe, test_exe) def test_sparse_mpi(self): """Run parallel test_sparse""" if "+mpi" not in self.spec: raise SkipTest("Package must be installed with '+mpi'") test_exe_mpi = "test_sparse_mpi" - test_args = ["-n", "1", test_exe_mpi, join_path("..", self.test_data_dir, "pde900.mtx")] - mpiexe_list = ["srun", "mpirun", "mpiexec"] + mpi_args = ["-n", "1", test_exe_mpi] + + mpi_bin = self.spec["mpi"].prefix.bin + mpiexe_list = ["srun", mpi_bin.mpirun, mpi_bin.mpiexec] for exe in mpiexe_list: + tty.info(f"Attempting to build and launch with {os.path.basename(exe)}") try: - self._test_example(test_exe_mpi, exe, test_args) + args = ["--immediate=30"] + mpi_args if exe == "srun" else mpi_args + self._test_example(test_exe_mpi, exe, args) return - except Exception: - pass + except (Exception, ProcessError) as err: + tty.info(f"Skipping {exe}: {str(err)}") + assert False, "No MPI executable was found" def check(self): |