summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/dealii/package.py
diff options
context:
space:
mode:
Diffstat (limited to 'var/spack/repos/builtin/packages/dealii/package.py')
-rw-r--r--var/spack/repos/builtin/packages/dealii/package.py162
1 files changed, 23 insertions, 139 deletions
diff --git a/var/spack/repos/builtin/packages/dealii/package.py b/var/spack/repos/builtin/packages/dealii/package.py
index 939d8fc013..563f751e0b 100644
--- a/var/spack/repos/builtin/packages/dealii/package.py
+++ b/var/spack/repos/builtin/packages/dealii/package.py
@@ -23,15 +23,19 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
-import sys
-class Dealii(Package):
+class Dealii(CMakePackage):
"""C++ software library providing well-documented tools to build finite
element codes for a broad variety of PDEs."""
homepage = "https://www.dealii.org"
url = "https://github.com/dealii/dealii/releases/download/v8.4.1/dealii-8.4.1.tar.gz"
+ # Don't add RPATHs to this package for the full build DAG.
+ # only add for immediate deps.
+ transitive_rpaths = False
+
+ version('8.4.2', '84c6bd3f250d3e0681b645d24cb987a7')
version('8.4.1', 'efbaf16f9ad59cfccad62302f36c3c1d')
version('8.4.0', 'ac5dbf676096ff61e092ce98c80c2b00')
version('8.3.0', 'fc6cdcb16309ef4bea338a4f014de6fa')
@@ -67,11 +71,11 @@ class Dealii(Package):
# Boost 1.58 is blacklisted, see
# https://github.com/dealii/dealii/issues/1591
# Require at least 1.59
- # +python won't affect @:8.4.1
+ # +python won't affect @:8.4.2
depends_on("boost@1.59.0:+thread+system+serialization+iostreams",
- when='@:8.4.1~mpi')
+ when='@:8.4.2~mpi')
depends_on("boost@1.59.0:+thread+system+serialization+iostreams+mpi",
- when='@:8.4.1+mpi')
+ when='@:8.4.2+mpi')
# since @8.5.0: (and @develop) python bindings are introduced:
depends_on("boost@1.59.0:+thread+system+serialization+iostreams",
when='@8.5.0:~mpi~python')
@@ -102,8 +106,9 @@ class Dealii(Package):
depends_on("netcdf-cxx", when='+netcdf+mpi')
depends_on("oce", when='+oce')
depends_on("p4est", when='+p4est+mpi')
- depends_on("petsc+mpi", when='@8.5.0:+petsc+mpi')
- depends_on("slepc", when='@8.5.0:+slepc+petsc+mpi')
+ depends_on("petsc+mpi", when='@8.4.2:+petsc+mpi')
+ depends_on('python', when='@8.5.0:+python')
+ depends_on("slepc", when='@8.4.2:+slepc+petsc+mpi')
depends_on("petsc@:3.6.4+mpi", when='@:8.4.1+petsc+mpi')
depends_on("slepc@:3.6.3", when='@:8.4.1+slepc+petsc+mpi')
depends_on("trilinos", when='+trilinos+mpi')
@@ -112,18 +117,16 @@ class Dealii(Package):
depends_on("numdiff", when='@develop')
depends_on("astyle@2.04", when='@develop')
- def install(self, spec, prefix):
- options = []
- options.extend(std_cmake_args)
-
+ def build_type(self):
# CMAKE_BUILD_TYPE should be DebugRelease | Debug | Release
- for word in options[:]:
- if word.startswith('-DCMAKE_BUILD_TYPE'):
- options.remove(word)
+ return 'DebugRelease'
- dsuf = 'dylib' if sys.platform == 'darwin' else 'so'
+ def cmake_args(self):
+ spec = self.spec
+ options = []
+
+ lapack_blas = spec['lapack'].lapack_libs + spec['blas'].blas_libs
options.extend([
- '-DCMAKE_BUILD_TYPE=DebugRelease',
'-DDEAL_II_COMPONENT_EXAMPLES=ON',
'-DDEAL_II_WITH_THREADS:BOOL=ON',
'-DBOOST_DIR=%s' % spec['boost'].prefix,
@@ -134,9 +137,7 @@ class Dealii(Package):
'-DLAPACK_FOUND=true',
'-DLAPACK_INCLUDE_DIRS=%s;%s' % (
spec['lapack'].prefix.include, spec['blas'].prefix.include),
- '-DLAPACK_LIBRARIES=%s;%s' % (
- spec['lapack'].lapack_shared_lib,
- spec['blas'].blas_shared_lib),
+ '-DLAPACK_LIBRARIES=%s' % lapack_blas.joined(';'),
'-DMUPARSER_DIR=%s' % spec['muparser'].prefix,
'-DUMFPACK_DIR=%s' % spec['suite-sparse'].prefix,
'-DTBB_DIR=%s' % spec['tbb'].prefix,
@@ -210,9 +211,9 @@ class Dealii(Package):
'-DNETCDF_FOUND=true',
'-DNETCDF_LIBRARIES=%s;%s' % (
join_path(spec['netcdf-cxx'].prefix.lib,
- 'libnetcdf_c++.%s' % dsuf),
+ 'libnetcdf_c++.%s' % dso_suffix),
join_path(spec['netcdf'].prefix.lib,
- 'libnetcdf.%s' % dsuf)),
+ 'libnetcdf.%s' % dso_suffix)),
'-DNETCDF_INCLUDE_DIRS=%s;%s' % (
spec['netcdf-cxx'].prefix.include,
spec['netcdf'].prefix.include),
@@ -233,124 +234,7 @@ class Dealii(Package):
'-DDEAL_II_WITH_OPENCASCADE=OFF'
])
- cmake('.', *options)
- make()
- if self.run_tests:
- make("test")
- make("install")
-
- # run some MPI examples with different solvers from PETSc and Trilinos
- if self.run_tests:
- 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'):
- 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)
-
- # 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 PETSc ============')
- 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:
- 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:'):
- 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)
-
- # 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
- filter_file(
- r'(LA::MPI::PreconditionAMG preconditioner;)',
- (''), 'step-40.cc')
- filter_file(
- r'(LA::MPI::PreconditionAMG::AdditionalData data;)',
- (''), 'step-40.cc')
- filter_file(
- r'(preconditioner.initialize\(system_matrix, data\);)',
- (''), '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
- filter_file(
- r'(preconditioner\);)', (''), 'step-40.cc')
- if '^trilinos+superlu-dist' in spec:
- make('release')
- make('run', paralle=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)
+ return options
def setup_environment(self, spack_env, env):
env.set('DEAL_II_DIR', self.prefix)