STRUMPACK: Add e4s testsuite-inspired smoke test (#21705)
This commit is contained in:
parent
0dbb90b565
commit
671f0ff32b
1 changed files with 62 additions and 2 deletions
|
@ -4,6 +4,8 @@
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|
||||||
from spack import *
|
from spack import *
|
||||||
|
from spack.util.environment import set_env
|
||||||
|
from spack.util.executable import which
|
||||||
|
|
||||||
|
|
||||||
class Strumpack(CMakePackage, CudaPackage, ROCmPackage):
|
class Strumpack(CMakePackage, CudaPackage, ROCmPackage):
|
||||||
|
@ -23,6 +25,8 @@ class Strumpack(CMakePackage, CudaPackage, ROCmPackage):
|
||||||
|
|
||||||
maintainers = ['pghysels']
|
maintainers = ['pghysels']
|
||||||
|
|
||||||
|
test_requires_compiler = True
|
||||||
|
|
||||||
version('master', branch='master')
|
version('master', branch='master')
|
||||||
version('5.1.1', sha256='6cf4eaae5beb9bd377f2abce9e4da9fd3e95bf086ae2f04554fad6dd561c28b9')
|
version('5.1.1', sha256='6cf4eaae5beb9bd377f2abce9e4da9fd3e95bf086ae2f04554fad6dd561c28b9')
|
||||||
version('5.0.0', sha256='bdfd1620ff7158d96055059be04ee49466ebaca8213a2fdab33e2d4571019a49')
|
version('5.0.0', sha256='bdfd1620ff7158d96055059be04ee49466ebaca8213a2fdab33e2d4571019a49')
|
||||||
|
@ -83,6 +87,10 @@ class Strumpack(CMakePackage, CudaPackage, ROCmPackage):
|
||||||
conflicts('+rocm', when='+cuda')
|
conflicts('+rocm', when='+cuda')
|
||||||
conflicts('+slate', when='@:5.1.1')
|
conflicts('+slate', when='@:5.1.1')
|
||||||
conflicts('+slate', when='~mpi')
|
conflicts('+slate', when='~mpi')
|
||||||
|
conflicts('^openblas@0.3.6: threads=none', when='+openmp',
|
||||||
|
msg='STRUMPACK requires openblas with OpenMP threading support')
|
||||||
|
conflicts('^openblas@0.3.6: threads=pthreads', when='+openmp',
|
||||||
|
msg='STRUMPACK requires openblas with OpenMP threading support')
|
||||||
|
|
||||||
patch('intel-19-compile.patch', when='@3.1.1')
|
patch('intel-19-compile.patch', when='@3.1.1')
|
||||||
|
|
||||||
|
@ -106,11 +114,14 @@ def on_off(varstr):
|
||||||
'-DSTRUMPACK_BUILD_TESTS=%s' % on_off('+build_tests'),
|
'-DSTRUMPACK_BUILD_TESTS=%s' % on_off('+build_tests'),
|
||||||
'-DTPL_BLAS_LIBRARIES=%s' % spec['blas'].libs.joined(";"),
|
'-DTPL_BLAS_LIBRARIES=%s' % spec['blas'].libs.joined(";"),
|
||||||
'-DTPL_LAPACK_LIBRARIES=%s' % spec['lapack'].libs.joined(";"),
|
'-DTPL_LAPACK_LIBRARIES=%s' % spec['lapack'].libs.joined(";"),
|
||||||
'-DTPL_SCALAPACK_LIBRARIES=%s' % spec['scalapack'].
|
|
||||||
libs.joined(";"),
|
|
||||||
'-DBUILD_SHARED_LIBS=%s' % on_off('+shared')
|
'-DBUILD_SHARED_LIBS=%s' % on_off('+shared')
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if '+mpi' in spec:
|
||||||
|
args.append(
|
||||||
|
'-DTPL_SCALAPACK_LIBRARIES=%s' % spec['scalapack'].
|
||||||
|
libs.joined(";"))
|
||||||
|
|
||||||
if spec.satisfies('@:3.9.999'):
|
if spec.satisfies('@:3.9.999'):
|
||||||
if '+mpi' in spec:
|
if '+mpi' in spec:
|
||||||
args.extend([
|
args.extend([
|
||||||
|
@ -140,3 +151,52 @@ def on_off(varstr):
|
||||||
format(",".join(rocm_archs)))
|
format(",".join(rocm_archs)))
|
||||||
|
|
||||||
return args
|
return args
|
||||||
|
|
||||||
|
test_data_dir = 'examples/data'
|
||||||
|
test_src_dir = 'test'
|
||||||
|
|
||||||
|
@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.test_data_dir, self.test_src_dir])
|
||||||
|
|
||||||
|
def _test_example(self, test_prog, test_dir, test_cmd, test_args):
|
||||||
|
tmpbld_dir = '{0}/_BUILD'.format(test_dir)
|
||||||
|
with working_dir(tmpbld_dir, create=True):
|
||||||
|
with open('{0}/CMakeLists.txt'.format(tmpbld_dir), 'w') as mkfile:
|
||||||
|
mkfile.write('cmake_minimum_required(VERSION 3.13)\n')
|
||||||
|
mkfile.write('project(StrumpackSmokeTest LANGUAGES CXX)\n')
|
||||||
|
mkfile.write('find_package(STRUMPACK REQUIRED)\n')
|
||||||
|
mkfile.write('add_executable({0} ../{0}.cpp)\n'.
|
||||||
|
format(test_prog))
|
||||||
|
mkfile.write('target_link_libraries({0} '.format(test_prog) +
|
||||||
|
'PRIVATE STRUMPACK::strumpack)\n')
|
||||||
|
|
||||||
|
opts = self.std_cmake_args
|
||||||
|
opts += self.cmake_args()
|
||||||
|
opts += ['.']
|
||||||
|
self.run_test('cmake', opts, [], installed=False, work_dir='.')
|
||||||
|
self.run_test('make')
|
||||||
|
with set_env(OMP_NUM_THREADS='4'):
|
||||||
|
self.run_test(test_cmd, test_args, installed=False,
|
||||||
|
purpose='test: strumpack smoke test',
|
||||||
|
skip_missing=False, work_dir='.')
|
||||||
|
self.run_test('rm', ['-fR', tmpbld_dir])
|
||||||
|
|
||||||
|
def test(self):
|
||||||
|
test_dir = join_path(self.install_test_root, self.test_src_dir)
|
||||||
|
test_exe = 'test_sparse_seq'
|
||||||
|
test_exe_mpi = 'test_sparse_mpi'
|
||||||
|
exe_arg = ['../../examples/data/pde900.mtx']
|
||||||
|
if '+mpi' in self.spec:
|
||||||
|
test_args = ['-n', '4', test_exe_mpi]
|
||||||
|
test_args.extend(exe_arg)
|
||||||
|
mpiexe_list = ['mpirun', 'mpiexec', 'srun']
|
||||||
|
for mpiexe in mpiexe_list:
|
||||||
|
if which(mpiexe) is not None:
|
||||||
|
self._test_example(test_exe_mpi, test_dir,
|
||||||
|
mpiexe, test_args)
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
self._test_example(test_exe, test_dir, test_exe, exe_arg)
|
||||||
|
|
Loading…
Reference in a new issue