From 84afaf385f0415db32a05c088dc0b1f76fc9aac7 Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Mon, 11 Jul 2016 10:22:29 +0200 Subject: dealii: run tests only when self.run_tests=true --- var/spack/repos/builtin/packages/dealii/package.py | 175 +++++++++++---------- 1 file changed, 88 insertions(+), 87 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/dealii/package.py b/var/spack/repos/builtin/packages/dealii/package.py index 92fdd05435..712e2db550 100644 --- a/var/spack/repos/builtin/packages/dealii/package.py +++ b/var/spack/repos/builtin/packages/dealii/package.py @@ -194,115 +194,116 @@ class Dealii(Package): ]) cmake('.', *options) - make() - make("test") + if self.run_tests: make("test") make("install") # run some MPI examples with different solvers from PETSc and Trilinos - env['DEAL_II_DIR'] = prefix - print('=====================================') - print('============ EXAMPLES ===============') - print('=====================================') - # take bare-bones step-3 - print('=====================================') - print('============ Step-3 =================') - print('=====================================') - with working_dir('examples/step-3'): - cmake('.') - make('release') - make('run', parallel=False) - - # An example which uses Metis + PETSc - # FIXME: switch step-18 to MPI - with working_dir('examples/step-18'): + if self.run_tests: + env['DEAL_II_DIR'] = prefix print('=====================================') - print('============= Step-18 ===============') + print('============ EXAMPLES ===============') print('=====================================') - # list the number of cycles to speed up - filter_file(r'(end_time = 10;)', ('end_time = 3;'), 'step-18.cc') - if '^petsc' in spec and '^metis' in spec: - cmake('.') - make('release') - make('run', parallel=False) - - # take step-40 which can use both PETSc and Trilinos - # FIXME: switch step-40 to MPI run - with working_dir('examples/step-40'): + # take bare-bones step-3 print('=====================================') - print('========== Step-40 PETSc ============') + print('============ Step-3 =================') print('=====================================') - # list the number of cycles to speed up - filter_file(r'(const unsigned int n_cycles = 8;)', - ('const unsigned int n_cycles = 2;'), 'step-40.cc') - cmake('.') - if '^petsc' in spec: + with working_dir('examples/step-3'): + cmake('.') make('release') make('run', parallel=False) - print('=====================================') - print('========= Step-40 Trilinos ==========') - print('=====================================') - # change Linear Algebra to Trilinos - # The below filter_file should be different for versions - # before and after 8.4.0 - if spec.satisfies('@8.4.0:') or spec.satisfies('@dev'): - filter_file(r'(\/\/ #define FORCE_USE_OF_TRILINOS.*)', - ('#define FORCE_USE_OF_TRILINOS'), 'step-40.cc') - else: - filter_file(r'(#define USE_PETSC_LA.*)', - ('// #define USE_PETSC_LA'), 'step-40.cc') - if '^trilinos+hypre' in spec: - make('release') - make('run', parallel=False) + # An example which uses Metis + PETSc + # FIXME: switch step-18 to MPI + with working_dir('examples/step-18'): + print('=====================================') + print('============= Step-18 ===============') + print('=====================================') + # list the number of cycles to speed up + filter_file(r'(end_time = 10;)', ('end_time = 3;'), 'step-18.cc') + if '^petsc' in spec and '^metis' in spec: + cmake('.') + make('release') + make('run', parallel=False) - # the rest of the tests on step 40 only works for - # dealii version 8.4.0 and after - if spec.satisfies('@8.4.0:') or spec.satisfies('@dev'): + # take step-40 which can use both PETSc and Trilinos + # FIXME: switch step-40 to MPI run + with working_dir('examples/step-40'): print('=====================================') - print('=== Step-40 Trilinos SuperluDist ====') + print('========== Step-40 PETSc ============') print('=====================================') - # change to direct solvers - filter_file(r'(LA::SolverCG solver\(solver_control\);)', ('TrilinosWrappers::SolverDirect::AdditionalData data(false,"Amesos_Superludist"); TrilinosWrappers::SolverDirect solver(solver_control,data);'), 'step-40.cc') # NOQA: ignore=E501 - filter_file(r'(LA::MPI::PreconditionAMG preconditioner;)', - (''), 'step-40.cc') - filter_file(r'(LA::MPI::PreconditionAMG::AdditionalData data;)', # NOQA: ignore=E501 - (''), 'step-40.cc') - filter_file(r'(preconditioner.initialize\(system_matrix, data\);)', # NOQA: ignore=E501 - (''), 'step-40.cc') - filter_file(r'(solver\.solve \(system_matrix, completely_distributed_solution, system_rhs,)', ('solver.solve (system_matrix, completely_distributed_solution, system_rhs);'), 'step-40.cc') # NOQA: ignore=E501 - filter_file(r'(preconditioner\);)', (''), 'step-40.cc') - if '^trilinos+superlu-dist' in spec: + # list the number of cycles to speed up + filter_file(r'(const unsigned int n_cycles = 8;)', + ('const unsigned int n_cycles = 2;'), 'step-40.cc') + cmake('.') + if '^petsc' in spec: make('release') - make('run', paralle=False) + make('run', parallel=False) print('=====================================') - print('====== Step-40 Trilinos MUMPS =======') + print('========= Step-40 Trilinos ==========') print('=====================================') - # switch to Mumps - filter_file(r'(Amesos_Superludist)', - ('Amesos_Mumps'), 'step-40.cc') - if '^trilinos+mumps' in spec: + # change Linear Algebra to Trilinos + # The below filter_file should be different for versions + # before and after 8.4.0 + if spec.satisfies('@8.4.0:'): + filter_file(r'(\/\/ #define FORCE_USE_OF_TRILINOS.*)', + ('#define FORCE_USE_OF_TRILINOS'), + 'step-40.cc') + else: + filter_file(r'(#define USE_PETSC_LA.*)', + ('// #define USE_PETSC_LA'), 'step-40.cc') + if '^trilinos+hypre' in spec: make('release') make('run', parallel=False) - print('=====================================') - print('============ Step-36 ================') - print('=====================================') - with working_dir('examples/step-36'): - if 'slepc' in spec: - cmake('.') - make('release') - make('run', parallel=False) + # the rest of the tests on step 40 only works for + # dealii version 8.4.0 and after + if spec.satisfies('@8.4.0:'): + print('=====================================') + print('=== Step-40 Trilinos SuperluDist ====') + print('=====================================') + # change to direct solvers + filter_file(r'(LA::SolverCG solver\(solver_control\);)', ('TrilinosWrappers::SolverDirect::AdditionalData data(false,"Amesos_Superludist"); TrilinosWrappers::SolverDirect solver(solver_control,data);'), 'step-40.cc') # NOQA: ignore=E501 + filter_file(r'(LA::MPI::PreconditionAMG preconditioner;)', + (''), 'step-40.cc') + filter_file(r'(LA::MPI::PreconditionAMG::AdditionalData data;)', # NOQA: ignore=E501 + (''), 'step-40.cc') + filter_file(r'(preconditioner.initialize\(system_matrix, data\);)', # NOQA: ignore=E501 + (''), 'step-40.cc') + filter_file(r'(solver\.solve \(system_matrix, completely_distributed_solution, system_rhs,)', ('solver.solve (system_matrix, completely_distributed_solution, system_rhs);'), 'step-40.cc') # NOQA: ignore=E501 + filter_file(r'(preconditioner\);)', (''), 'step-40.cc') + if '^trilinos+superlu-dist' in spec: + make('release') + make('run', paralle=False) - print('=====================================') - print('============ Step-54 ================') - print('=====================================') - with working_dir('examples/step-54'): - if 'oce' in spec: - cmake('.') - make('release') - make('run', parallel=False) + print('=====================================') + print('====== Step-40 Trilinos MUMPS =======') + print('=====================================') + # switch to Mumps + filter_file(r'(Amesos_Superludist)', + ('Amesos_Mumps'), 'step-40.cc') + if '^trilinos+mumps' in spec: + make('release') + make('run', parallel=False) + + print('=====================================') + print('============ Step-36 ================') + print('=====================================') + with working_dir('examples/step-36'): + if 'slepc' in spec: + cmake('.') + make('release') + make('run', parallel=False) + + print('=====================================') + print('============ Step-54 ================') + print('=====================================') + with working_dir('examples/step-54'): + if 'oce' in spec: + cmake('.') + make('release') + make('run', parallel=False) def setup_environment(self, spack_env, env): env.set('DEAL_II_DIR', self.prefix) -- cgit v1.2.3-60-g2f50