diff options
author | jalcaraz <jordi_alc@hotmail.com> | 2024-02-02 11:12:24 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-02 11:12:24 -0800 |
commit | e59303d4ffaaa81fa4e98379bc7fb24fc466b526 (patch) | |
tree | 334b21e2eb11fa3dbfbc9b4d3eb491130fe87e90 /var | |
parent | 494d943a242de34eb43e4c90468bac782a6be2d6 (diff) | |
download | spack-e59303d4ffaaa81fa4e98379bc7fb24fc466b526.tar.gz spack-e59303d4ffaaa81fa4e98379bc7fb24fc466b526.tar.bz2 spack-e59303d4ffaaa81fa4e98379bc7fb24fc466b526.tar.xz spack-e59303d4ffaaa81fa4e98379bc7fb24fc466b526.zip |
tau: update test functions (#42432)
* Updated with generic test functions
* Added level_zero test
As the compiler is not installed by TAU, it should be loaded first and run with --dirty. Will check if there is a way to make it work without --dirty.
* Update var/spack/repos/builtin/packages/tau/package.py
Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
---------
Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
Diffstat (limited to 'var')
-rw-r--r-- | var/spack/repos/builtin/packages/tau/package.py | 111 |
1 files changed, 74 insertions, 37 deletions
diff --git a/var/spack/repos/builtin/packages/tau/package.py b/var/spack/repos/builtin/packages/tau/package.py index 7a42d1ae10..95a0f9a814 100644 --- a/var/spack/repos/builtin/packages/tau/package.py +++ b/var/spack/repos/builtin/packages/tau/package.py @@ -399,55 +399,29 @@ class Tau(Package): env.set("DYNINSTAPI_RT_LIB", dyninst_apirt) env.append_path("LD_LIBRARY_PATH", path_to_dyn_lib) env.append_path("LD_LIBRARY_PATH", self.prefix.lib) + if "+cuda" in self.spec: + env.append_path("PATH", self.spec["cuda"].prefix.bin) matmult_test = join_path("examples", "mm") dyninst_test = join_path("examples", "dyninst") makefile_test = join_path("examples", "Makefile") makefile_inc_test = join_path("include", "Makefile") + cuda_test = join_path("examples", "gpu", "cuda", "dataElem_um") + level_zero_test = join_path("examples", "gpu", "oneapi", "complex_mult") @run_after("install") def setup_build_tests(self): """Copy the build test files after the package is installed to an install test subdirectory for use during `spack test run`.""" self.cache_extra_test_sources(self.matmult_test) - self.cache_extra_test_sources(self.dyninst_test) self.cache_extra_test_sources(self.makefile_test) self.cache_extra_test_sources(self.makefile_inc_test) - - def _run_matmult_test(self, test_dir): - mm_dir = join_path(test_dir, self.matmult_test) - self.run_test( - "make", - ["all"], - [], - 0, - False, - "Instrument and build matrix multiplication test code", - False, - mm_dir, - ) - test_exe = "matmult" - if "+mpi" in self.spec: - test_args = ["-n", "4", test_exe] - mpiexe_list = ["mpirun", "mpiexec", "srun"] - for mpiexe in mpiexe_list: - if which(mpiexe) is not None: - self.run_test( - mpiexe, test_args, [], 0, False, "Run matmult test with mpi", False, mm_dir - ) - break - else: - self.run_test(test_exe, [], [], 0, False, "Run sequential matmult test", False, mm_dir) - self.run_test( - "pprof", - [], - [], - 0, - False, - "Run pprof profile analysis tool on profile output", - False, - mm_dir, - ) + if "+dyninst" in self.spec: + self.cache_extra_test_sources(self.dyninst_test) + if "+cuda" in self.spec: + self.cache_extra_test_sources(self.cuda_test) + if "+level_zero" in self.spec: + self.cache_extra_test_sources(self.level_zero_test) def _run_dyninst_test(self, test_dir): dyn_dir = join_path(test_dir, self.dyninst_test) @@ -479,9 +453,72 @@ class Tau(Package): dyn_dir, ) + def _run_tau_test( + self, main_test_dir, test_dir, test_name, test_exe, tau_exec_flags=[], use_tau_exec=False + ): + inst_test_dir = join_path(main_test_dir, test_dir) + test_description = "Build {} test code".format(test_name) + self.run_test("make", ["all"], [], 0, False, test_description, False, inst_test_dir) + if "+mpi" in self.spec: + if use_tau_exec: + test_args = ["-n", "4", "tau_exec", "-T", "mpi"] + tau_exec_flags + else: + test_args = ["-n", "4"] + tau_exec_flags + test_args.append(test_exe) + mpiexe_list = ["mpirun", "mpiexec", "srun"] + for mpiexe in mpiexe_list: + if which(mpiexe) is not None: + test_description = "Run {} test with mpi".format(test_name) + self.run_test( + mpiexe, test_args, [], 0, False, test_description, False, inst_test_dir + ) + break + else: + if use_tau_exec: + test_app = "tau_exec" + test_args = ["-T", "serial"] + tau_exec_flags + test_args.append(test_exe) + else: + test_app = test_exe + test_args = [] + test_description = "Run sequential {} test".format(test_name) + self.run_test( + test_app, test_args, [], 0, False, test_description, False, inst_test_dir + ) + self.run_test( + "pprof", + [], + [], + 0, + False, + "Run pprof profile analysis tool on profile output", + False, + inst_test_dir, + ) + def test(self): test_dir = self.test_suite.current_test_cache_dir # Run mm test program pulled from the build - self._run_matmult_test(test_dir) + self._run_tau_test(test_dir, self.matmult_test, "matrix multiplication", "matmult") if "+dyninst" in self.spec: self._run_dyninst_test(test_dir) + if "+cuda" in self.spec: + tau_exec_flags = ["-cupti"] + self._run_tau_test( + test_dir, + self.cuda_test, + "CUDA example", + "dataElem_um", + tau_exec_flags, + use_tau_exec=True, + ) + if "+level_zero" in self.spec: + tau_exec_flags = ["-l0"] + self._run_tau_test( + test_dir, + self.level_zero_test, + "Level Zero example", + "complex_mult.exe", + tau_exec_flags, + use_tau_exec=True, + ) |