diff options
author | G-Ragghianti <33492707+G-Ragghianti@users.noreply.github.com> | 2023-02-21 16:10:01 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-21 13:10:01 -0800 |
commit | 27ee08f5bba55ac188cc89d234d0f3ece203426e (patch) | |
tree | dbba865851f1a5e9f52fb321cef9e2268151ffd0 | |
parent | cb4c60c70928c034f8c3cd77d66331b0cb906276 (diff) | |
download | spack-27ee08f5bba55ac188cc89d234d0f3ece203426e.tar.gz spack-27ee08f5bba55ac188cc89d234d0f3ece203426e.tar.bz2 spack-27ee08f5bba55ac188cc89d234d0f3ece203426e.tar.xz spack-27ee08f5bba55ac188cc89d234d0f3ece203426e.zip |
Package slate: Improved MPI launcher search for smoke tests (#35448)
* Improved MPI launcher search for smoke tests
* Improving mpi launcher search
* Removing redundant logic
-rw-r--r-- | var/spack/repos/builtin/packages/slate/package.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/var/spack/repos/builtin/packages/slate/package.py b/var/spack/repos/builtin/packages/slate/package.py index 1428b871b5..40204e4632 100644 --- a/var/spack/repos/builtin/packages/slate/package.py +++ b/var/spack/repos/builtin/packages/slate/package.py @@ -114,6 +114,15 @@ class Slate(CMakePackage, CudaPackage, ROCmPackage): install test subdirectory for use during `spack test run`.""" self.cache_extra_test_sources(["examples"]) + def mpi_launcher(self): + searchpath = [self.spec["mpi"].prefix.bin] + try: + searchpath.insert(0, self.spec["slurm"].prefix.bin) + except KeyError: + print("Slurm not found, ignoring.") + commands = ["srun", "mpirun", "mpiexec"] + return which(*commands, path=searchpath) or which(*commands) + def test(self): if self.spec.satisfies("@2020.10.00") or "+mpi" not in self.spec: print("Skipping: stand-alone tests") @@ -129,7 +138,8 @@ class Slate(CMakePackage, CudaPackage, ROCmPackage): self.run_test(cmake_bin, ["-DCMAKE_PREFIX_PATH=" + prefixes, ".."]) make() test_args = ["-n", "4", "./ex05_blas"] - mpi_path = self.spec["mpi"].prefix.bin - mpiexe_f = which("srun", "mpirun", "mpiexec", path=mpi_path) - self.run_test(mpiexe_f.command, test_args, purpose="SLATE smoke test") + launcher = self.mpi_launcher() + if not launcher: + raise RuntimeError("Cannot run tests due to absence of MPI launcher") + self.run_test(launcher.command, test_args, purpose="SLATE smoke test") make("clean") |