summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Shudler <sergshu@gmail.com>2021-03-11 20:22:34 -0800
committerGitHub <noreply@github.com>2021-03-12 04:22:34 +0000
commit21b2d7109a52746e8aba74888ca681f5037c4359 (patch)
tree4ac6bf76b08fb6df51994393705035d4caf1834b
parente13ce390fee5b93db287aa768c785a988de2b5e8 (diff)
downloadspack-21b2d7109a52746e8aba74888ca681f5037c4359.tar.gz
spack-21b2d7109a52746e8aba74888ca681f5037c4359.tar.bz2
spack-21b2d7109a52746e8aba74888ca681f5037c4359.tar.xz
spack-21b2d7109a52746e8aba74888ca681f5037c4359.zip
superlu-dist: Add e4s testsuite-inspired smoke test (#22237)
* Added a smoke test for superlu-dist recipe * Fixed small issues following a PR review
-rw-r--r--var/spack/repos/builtin/packages/superlu-dist/package.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/superlu-dist/package.py b/var/spack/repos/builtin/packages/superlu-dist/package.py
index f5c92e0aa8..adb53a740e 100644
--- a/var/spack/repos/builtin/packages/superlu-dist/package.py
+++ b/var/spack/repos/builtin/packages/superlu-dist/package.py
@@ -102,3 +102,53 @@ class SuperluDist(CMakePackage, CudaPackage):
if name == 'cflags' and '%pgi' not in self.spec:
flags.append('-std=c99')
return (None, None, flags)
+
+ examples_src_dir = 'EXAMPLE'
+ mk_hdr = 'make.inc'
+ mk_hdr_in = mk_hdr + '.in'
+
+ @run_after('install')
+ def cache_test_sources(self):
+ """Copy the example source files after the package is installed to an
+ install test subdirectory for use during `spack test run`."""
+ self.cache_extra_test_sources([self.examples_src_dir, self.mk_hdr])
+
+ def test(self):
+ mk_file = join_path(self.install_test_root, self.mk_hdr)
+ # Replace 'SRC' with 'lib' in the library's path
+ filter_file(r'^(DSUPERLULIB.+)SRC(.+)', '\\1lib\\2', mk_file)
+ # Set library flags for all libraries superlu-dist depends on
+ filter_file(r'^LIBS.+\+=.+', '', mk_file)
+ filter_file(r'^LIBS[^\+]+=.+', 'LIBS = $(DSUPERLULIB)' +
+ ' {0}'.format(self.spec['blas'].libs.ld_flags) +
+ ' {0}'.format(self.spec['lapack'].libs.ld_flags) +
+ ' {0}'.format(self.spec['parmetis'].libs.ld_flags) +
+ ' {0}'.format(self.spec['metis'].libs.ld_flags) +
+ ' $(CUDALIBS)',
+ mk_file)
+ cuda_lib_opts = ''
+ if '+cuda' in self.spec:
+ cuda_lib_opts = ',-rpath,{0}'.format(
+ self.spec['cuda'].libs.directories[0])
+ # Set the rpath for all the libs
+ filter_file(r'^LOADOPTS.+', 'LOADOPTS = -Wl' +
+ ',-rpath,{0}'.format(self.prefix.lib) +
+ ',-rpath,{0}'.format(self.spec['blas'].prefix.lib) +
+ ',-rpath,{0}'.format(self.spec['lapack'].prefix.lib) +
+ ',-rpath,{0}'.format(self.spec['parmetis'].prefix.lib) +
+ ',-rpath,{0}'.format(self.spec['metis'].prefix.lib) +
+ cuda_lib_opts,
+ mk_file)
+
+ test_dir = join_path(self.install_test_root, self.examples_src_dir)
+ test_exe = 'pddrive'
+ with working_dir(test_dir, create=False):
+ make(test_exe)
+ # Smoke test input parameters: -r 2 -c 2 g20.rua
+ test_args = ['-n', '4', test_exe, '-r', '2', '-c', '2', 'g20.rua']
+ # Find the correct mpirun command
+ mpiexe_f = which('srun', 'mpirun', 'mpiexec')
+ if mpiexe_f:
+ self.run_test(mpiexe_f.command, test_args, work_dir='.',
+ purpose='superlu-dist smoke test')
+ make('clean')