Merge pull request #1169 from davydden/feature/install_argument_tests_petsc_fixes
--run-tests install argument and petsc fixes
This commit is contained in:
commit
b0f4052bd8
@ -58,6 +58,10 @@ def setup_parser(subparser):
|
||||
help="Install a package *without* cleaning the environment.")
|
||||
subparser.add_argument(
|
||||
'packages', nargs=argparse.REMAINDER, help="specs of packages to install")
|
||||
subparser.add_argument(
|
||||
'--run-tests', action='store_true', dest='run_tests',
|
||||
help="Run tests during installation of a package.")
|
||||
|
||||
|
||||
|
||||
def install(parser, args):
|
||||
@ -80,6 +84,7 @@ def install(parser, args):
|
||||
keep_stage=args.keep_stage,
|
||||
ignore_deps=args.ignore_deps,
|
||||
make_jobs=args.jobs,
|
||||
run_tests=args.run_tests,
|
||||
verbose=args.verbose,
|
||||
fake=args.fake,
|
||||
dirty=args.dirty,
|
||||
|
@ -311,6 +311,8 @@ class SomePackage(Package):
|
||||
parallel = True
|
||||
"""# jobs to use for parallel make. If set, overrides default of ncpus."""
|
||||
make_jobs = None
|
||||
"""By default do not run tests within package's install()"""
|
||||
run_tests = False
|
||||
"""Most packages are NOT extendable. Set to True if you want extensions."""
|
||||
extendable = False
|
||||
"""List of prefix-relative file paths (or a single path). If these do
|
||||
@ -881,6 +883,7 @@ def do_install(self,
|
||||
skip_patch=False,
|
||||
verbose=False,
|
||||
make_jobs=None,
|
||||
run_tests=False,
|
||||
fake=False,
|
||||
explicit=False,
|
||||
dirty=False,
|
||||
@ -902,6 +905,7 @@ def do_install(self,
|
||||
verbose -- Display verbose build output (by default, suppresses it)
|
||||
dirty -- Don't clean the build environment before installing.
|
||||
make_jobs -- Number of make jobs to use for install. Default is ncpus
|
||||
run_tests -- Runn tests within the package's install()
|
||||
"""
|
||||
if not self.spec.concrete:
|
||||
raise ValueError("Can only install concrete packages.")
|
||||
@ -932,7 +936,11 @@ def do_install(self,
|
||||
fake=fake,
|
||||
skip_patch=skip_patch,
|
||||
verbose=verbose,
|
||||
make_jobs=make_jobs)
|
||||
make_jobs=make_jobs,
|
||||
run_tests=run_tests)
|
||||
|
||||
# Set run_tests flag before starting build.
|
||||
self.run_tests = run_tests
|
||||
|
||||
# Set parallelism before starting build.
|
||||
self.make_jobs = make_jobs
|
||||
|
@ -149,20 +149,22 @@ def install(self, spec, prefix):
|
||||
make("install")
|
||||
|
||||
# solve Poisson equation in 2D to make sure nothing is broken:
|
||||
with working_dir('src/ksp/ksp/examples/tutorials'):
|
||||
cc = os.environ['CC'] if '~mpi' in self.spec else self.spec['mpi'].mpicc # NOQA: ignore=E501
|
||||
os.system('%s ex50.c -I%s -L%s -lpetsc -o ex50' % (
|
||||
cc, prefix.include, prefix.lib))
|
||||
ex50 = Executable('./ex50')
|
||||
ex50('-da_grid_x', '4', '-da_grid_y', '4')
|
||||
if 'superlu-dist' in spec:
|
||||
ex50('-da_grid_x', '4', '-da_grid_y', '4', '-pc_type', 'lu', '-pc_factor_mat_solver_package', 'superlu_dist') # NOQA: ignore=E501
|
||||
if ('mpi' in spec) and self.run_tests:
|
||||
with working_dir('src/ksp/ksp/examples/tutorials'):
|
||||
env['PETSC_DIR'] = self.prefix
|
||||
cc = Executable(spec['mpi'].mpicc)
|
||||
cc('ex50.c', '-I%s' % prefix.include, '-L%s' % prefix.lib,
|
||||
'-lpetsc', '-lm', '-o', 'ex50')
|
||||
run = Executable(join_path(spec['mpi'].prefix.bin, 'mpirun'))
|
||||
run('ex50', '-da_grid_x', '4', '-da_grid_y', '4')
|
||||
if 'superlu-dist' in spec:
|
||||
run('ex50', '-da_grid_x', '4', '-da_grid_y', '4', '-pc_type', 'lu', '-pc_factor_mat_solver_package', 'superlu_dist') # NOQA: ignore=E501
|
||||
|
||||
if 'mumps' in spec:
|
||||
ex50('-da_grid_x', '4', '-da_grid_y', '4', '-pc_type', 'lu', '-pc_factor_mat_solver_package', 'mumps') # NOQA: ignore=E501
|
||||
if 'mumps' in spec:
|
||||
run('ex50', '-da_grid_x', '4', '-da_grid_y', '4', '-pc_type', 'lu', '-pc_factor_mat_solver_package', 'mumps') # NOQA: ignore=E501
|
||||
|
||||
if 'hypre' in spec:
|
||||
ex50('-da_grid_x', '4', '-da_grid_y', '4', '-pc_type', 'hypre', '-pc_hypre_type', 'boomeramg') # NOQA: ignore=E501
|
||||
if 'hypre' in spec:
|
||||
run('ex50', '-da_grid_x', '4', '-da_grid_y', '4', '-pc_type', 'hypre', '-pc_hypre_type', 'boomeramg') # NOQA: ignore=E501
|
||||
|
||||
def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
|
||||
# set up PETSC_DIR for everyone using PETSc package
|
||||
|
Loading…
Reference in New Issue
Block a user