slate: changed stand-alone test from old to new API (#44953)
* slate: changed from old to new format * make code tighter * replace assert method * SkipTest plus other cleanup --------- Co-authored-by: Tamara Dahlgren <dahlgren1@llnl.gov>
This commit is contained in:
		| @@ -165,25 +165,26 @@ def mpi_launcher(self): | |||||||
|         commands = ["srun", "mpirun", "mpiexec"] |         commands = ["srun", "mpirun", "mpiexec"] | ||||||
|         return which(*commands, path=searchpath) or which(*commands) |         return which(*commands, path=searchpath) or which(*commands) | ||||||
| 
 | 
 | ||||||
|     def test(self): |     def test_example(self): | ||||||
|  |         """build and run slate example""" | ||||||
|  | 
 | ||||||
|         if self.spec.satisfies("@2020.10.00") or "+mpi" not in self.spec: |         if self.spec.satisfies("@2020.10.00") or "+mpi" not in self.spec: | ||||||
|             print("Skipping: stand-alone tests") |             raise SkipTest("Package must be installed with +mpi and version @2021.05.01 or later") | ||||||
|             return |  | ||||||
| 
 | 
 | ||||||
|         test_dir = join_path(self.test_suite.current_test_cache_dir, "examples", "build") |         test_dir = join_path(self.test_suite.current_test_cache_dir, "examples", "build") | ||||||
|         with working_dir(test_dir, create=True): |         with working_dir(test_dir, create=True): | ||||||
|             cmake_bin = join_path(self.spec["cmake"].prefix.bin, "cmake") |             cmake = self.spec["cmake"].command | ||||||
|  | 
 | ||||||
|             # This package must directly depend on all packages listed here. |             # This package must directly depend on all packages listed here. | ||||||
|             # Otherwise, it will not work when some packages are external to spack. |             # Otherwise, it will not work when some packages are external to spack. | ||||||
|             deps = "slate blaspp lapackpp mpi" |             deps = "slate blaspp lapackpp mpi" | ||||||
|             if self.spec.satisfies("+rocm"): |             if self.spec.satisfies("+rocm"): | ||||||
|                 deps += " rocblas hip llvm-amdgpu comgr hsa-rocr-dev rocsolver " |                 deps += " rocblas hip llvm-amdgpu comgr hsa-rocr-dev rocsolver " | ||||||
|             prefixes = ";".join([self.spec[x].prefix for x in deps.split()]) |             prefixes = ";".join([self.spec[x].prefix for x in deps.split()]) | ||||||
|             self.run_test(cmake_bin, ["-DCMAKE_PREFIX_PATH=" + prefixes, ".."]) | 
 | ||||||
|  |             cmake("-DCMAKE_PREFIX_PATH=" + prefixes, "..") | ||||||
|  |             make = which("make") | ||||||
|             make() |             make() | ||||||
|             test_args = ["-n", "4", "./ex05_blas"] |  | ||||||
|             launcher = self.mpi_launcher() |             launcher = self.mpi_launcher() | ||||||
|             if not launcher: |             assert launcher is not None, "Cannot run tests due to absence of MPI launcher" | ||||||
|                 raise RuntimeError("Cannot run tests due to absence of MPI launcher") |             launcher("-n", "4", "./ex05_blas") | ||||||
|             self.run_test(launcher.command, test_args, purpose="SLATE smoke test") |  | ||||||
|             make("clean") |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 AcriusWinter
					AcriusWinter