From 91b4d974f161bb9f3e38be82b43e8566fa9f1c56 Mon Sep 17 00:00:00 2001 From: wspear Date: Thu, 22 Jul 2021 10:09:18 -0700 Subject: Add test operation to tau package (#25036) Copy over the general purpose mm matmult testcase. On test run build, execute (with mpi as needed) and process profile output. --- var/spack/repos/builtin/packages/tau/package.py | 33 +++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/var/spack/repos/builtin/packages/tau/package.py b/var/spack/repos/builtin/packages/tau/package.py index 486b6734c9..ae20635829 100644 --- a/var/spack/repos/builtin/packages/tau/package.py +++ b/var/spack/repos/builtin/packages/tau/package.py @@ -331,3 +331,36 @@ class Tau(Package): # in the latter case. if files: env.set('TAU_MAKEFILE', files[0]) + + matmult_test = join_path('examples', 'mm') + + @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) + + def _run_matmult_test(self): + mm_dir = join_path(self.test_suite.current_test_cache_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) + + def test(self): + # Run mm test program pulled from the build + self._run_matmult_test() -- cgit v1.2.3-60-g2f50