From 71dd8ed265715204da6907b7bd35d40f16daf49e Mon Sep 17 00:00:00 2001 From: emai-imcs Date: Fri, 5 Mar 2021 15:27:35 +0100 Subject: FEniCS: update of packages to support 2019.1.0 (#21207) --- .../repos/builtin/packages/fenics/header_fix.patch | 36 ++++ var/spack/repos/builtin/packages/fenics/package.py | 225 ++++++++++----------- .../repos/builtin/packages/fenics/petsc_3_11.patch | 31 +++ 3 files changed, 173 insertions(+), 119 deletions(-) create mode 100644 var/spack/repos/builtin/packages/fenics/header_fix.patch create mode 100644 var/spack/repos/builtin/packages/fenics/petsc_3_11.patch (limited to 'var') diff --git a/var/spack/repos/builtin/packages/fenics/header_fix.patch b/var/spack/repos/builtin/packages/fenics/header_fix.patch new file mode 100644 index 0000000000..f5622d7e9d --- /dev/null +++ b/var/spack/repos/builtin/packages/fenics/header_fix.patch @@ -0,0 +1,36 @@ +From 3d3916e01f22c20eb4aa80d1ed784402a17422f6 Mon Sep 17 00:00:00 2001 +Date: Thu, 10 Sep 2020 23:16:31 +0200 +Subject: [PATCH] fixed compilation errors by adding the algorithm header + +--- + dolfin/geometry/IntersectionConstruction.cpp | 1 + + dolfin/mesh/MeshFunction.h | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/dolfin/geometry/IntersectionConstruction.cpp b/dolfin/geometry/IntersectionConstruction.cpp +index 765dbb674..fe72ee5f6 100644 +--- a/dolfin/geometry/IntersectionConstruction.cpp ++++ b/dolfin/geometry/IntersectionConstruction.cpp +@@ -18,6 +18,7 @@ + // First added: 2014-02-03 + // Last changed: 2017-12-12 + ++#include // fix compiling problem with min_element + #include + #include + #include "predicates.h" +diff --git a/dolfin/mesh/MeshFunction.h b/dolfin/mesh/MeshFunction.h +index 08cbc824f..6d4a22f6e 100644 +--- a/dolfin/mesh/MeshFunction.h ++++ b/dolfin/mesh/MeshFunction.h +@@ -26,6 +26,7 @@ + + #include + #include ++#include // EM: fix for compile error, line 652 + + #include + #include +-- +2.25.1 + diff --git a/var/spack/repos/builtin/packages/fenics/package.py b/var/spack/repos/builtin/packages/fenics/package.py index 95fa85ef07..01a2f16019 100644 --- a/var/spack/repos/builtin/packages/fenics/package.py +++ b/var/spack/repos/builtin/packages/fenics/package.py @@ -10,26 +10,43 @@ class Fenics(CMakePackage): """FEniCS is organized as a collection of interoperable components that together form the FEniCS Project. These components include the problem-solving environment DOLFIN, the form compiler FFC, the - finite element tabulator FIAT, the just-in-time compiler Instant, - the code generation interface UFC, the form language UFL and a - range of additional components.""" + finite element tabulator FIAT, the just-in-time compiler Instant / Dijitso, + the code generation interface UFC, the form language UFL and a range of + additional components.""" homepage = "http://fenicsproject.org/" - url = "https://bitbucket.org/fenics-project/dolfin/downloads/dolfin-1.6.0.tar.gz" - base_url = "https://bitbucket.org/fenics-project/{pkg}/downloads/{pkg}-{version}.tar.gz" - - python_components = ['ufl', 'ffc', 'fiat', 'instant'] - + git = "https://bitbucket.org/fenics-project/dolfin.git" + url = "https://bitbucket.org/fenics-project/dolfin/downloads/dolfin-2019.1.0.post0.tar.gz" + + version('2019.1.0.post0', sha256='61abdcdb13684ba2a3ba4afb7ea6c7907aa0896a46439d3af7e8848483d4392f') + version('2018.1.0.post1', sha256='425cc49b90e0f5c2ebdd765ba9934b1ada97e2ac2710d982d6d267a5e2c5982d') + # Pre 2018.1.0 versions are deprecated due to expected compatibility issues + version('2017.2.0.post0', + sha256='d3c40cd8c1c882f517999c25ea4220adcd01dbb1d829406fce99b1fc40184c82', + deprecated=True) + version('2016.2.0', + sha256='c6760996660a476f77889e11e4a0bc117cc774be0eec777b02a7f01d9ce7f43d', + deprecated=True) + version('1.6.0', + sha256='67f66c39983a8c5a1ba3c0787fa9b9082778bc7227b25c7cad80dc1299e0a201', + deprecated=True) + + dolfin_versions = ['2019.1.0', '2018.1.0', '2017.2.0', '2016.2.0', '1.6.0'] + + variant('python', default=True, description='Compile with Python interface') variant('hdf5', default=True, description='Compile with HDF5') variant('parmetis', default=True, description='Compile with ParMETIS') variant('scotch', default=True, description='Compile with Scotch') variant('petsc', default=True, description='Compile with PETSc') variant('slepc', default=True, description='Compile with SLEPc') - variant('trilinos', default=True, description='Compile with Trilinos') + variant('petsc4py', default=True, description='Use PETSC4py') + variant('slepc4py', default=True, description='Use SLEPc4py') + variant('trilinos', default=False, description='Compile with Trilinos') variant('suite-sparse', default=True, description='Compile with SuiteSparse solvers') variant('vtk', default=False, description='Compile with VTK') variant('qt', default=False, description='Compile with QT') + variant('zlib', default=False, description='Compile with ZLIB') variant('mpi', default=True, description='Enables the distributed memory support') variant('openmp', default=True, @@ -43,135 +60,105 @@ class Fenics(CMakePackage): values=('Debug', 'Release', 'RelWithDebInfo', 'MinSizeRel', 'Developer')) - # not part of spack list for now - # variant('petsc4py', default=True, description='Uses PETSc4py') - # variant('slepc4py', default=True, description='Uses SLEPc4py') - # variant('pastix', default=True, description='Compile with Pastix') - - patch('petsc-3.7.patch', when='@1.6.1^petsc@3.7:') - patch('petsc-version-detection.patch', when='@:1.6.1') - patch('hdf5~cxx-detection.patch') - - extends('python') - + # Conflics for PETSC4PY / SLEPC4PY + conflicts('+petsc4py', when='~python') + conflicts('+petsc4py', when='~petsc') + conflicts('+slepc4py', when='~python') + conflicts('+slepc4py', when='~slepc') + + # Patches + # patch('petsc-3.7.patch', when='petsc@3.7:') + patch('petsc-version-detection.patch', when='@1.6.0') + patch('hdf5~cxx-detection.patch', when='@:1.6.0') + + patch('header_fix.patch', when='@2019.1.0.post0') + patch('petsc_3_11.patch', when='@2018.1.0.post1') + + # enable extension support for fenics package + extends('python', when='+python') + + # fenics python package dependencies + for ver in dolfin_versions: + wver = '@' + ver + depends_on('py-fenics-fiat{0}'.format(wver), type=('build', 'run'), when=wver + '+python') + if(Version(ver) < Version('2018.1.0')): + depends_on('py-fenics-instant{0}'.format(wver), type=('build', 'run'), when=wver + '+python') + else: + depends_on('py-fenics-dijitso{0}'.format(wver), type=('build', 'run'), when=wver + '+python') + depends_on('py-fenics-ufl{0}'.format(wver), type=('build', 'run'), when=wver + '+python') + if ver in ['2019.1.0', '2017.2.0']: + wver = '@' + ver + '.post0' + depends_on('py-fenics-ffc{0}'.format(wver), type=('build', 'run'), when=wver + '+python') + + # package dependencies + depends_on('python@3.5:', type=('build', 'run'), when='+python') depends_on('eigen@3.2.0:') - depends_on('boost+filesystem+program_options+system+iostreams+timer+regex+chrono') + depends_on('pkgconfig', type='build') + depends_on('zlib', when='+zlib') + + for ver in dolfin_versions: + if Version(ver) == Version('2019.1.0'): + depends_on('boost+filesystem+program_options+system+iostreams+timer+regex+chrono') + else: + depends_on('boost+filesystem+program_options+system+iostreams+timer+regex+chrono@1.68.0') depends_on('mpi', when='+mpi') - # FIXME: next line fixes concretization with petsc depends_on('hdf5+hl+fortran', when='+hdf5+petsc') depends_on('hdf5+hl', when='+hdf5~petsc') - depends_on('parmetis@4.0.2:', when='+parmetis') depends_on('metis+real64', when='+parmetis') + depends_on('parmetis', when='+parmetis') depends_on('scotch~metis', when='+scotch~mpi') depends_on('scotch+mpi~metis', when='+scotch+mpi') - depends_on('petsc@3.4:', when='+petsc') - depends_on('slepc@3.4:', when='+slepc') + depends_on('petsc', when='+petsc') + depends_on('slepc', when='+slepc') + depends_on('py-petsc4py@3.6:', when='+petsc+python') depends_on('trilinos', when='+trilinos') depends_on('vtk', when='+vtk') depends_on('suite-sparse', when='+suite-sparse') depends_on('qt', when='+qt') - depends_on('py-ply', type=('build', 'run')) - depends_on('py-six', type=('build', 'run')) - depends_on('py-numpy', type=('build', 'run')) - depends_on('py-sympy', type=('build', 'run')) - depends_on('swig@3.0.3:', type=('build', 'run')) - depends_on('cmake@2.8.12:', type='build') + depends_on('py-pybind11@2.2.4', type=('build', 'run')) + depends_on('cmake@3.17.3:', type='build') - depends_on('py-setuptools', type='build') + depends_on('py-setuptools', type='build', when='+python') + depends_on('py-pkgconfig', type=('build', 'run'), when='+python') depends_on('py-sphinx@1.0.1:', when='+doc', type='build') - releases = [ - { - 'version': '2016.1.0', - 'sha256': '6228b4d641829a4cd32141bfcd217a1596a27d5969aa00ee64ebba2b1c0fb148', - 'resources': { - 'ffc': '52430ce4c7d57ce1b81eb5fb304992247c944bc6a6054c8b6f42bac81702578d', - 'fiat': '851723126a71bc1ae2dc4ad6e9330bd9b54d52db390dcbbc1f3c759fb49c6aeb', - 'instant': '7bf03c8a7b61fd1e432b8f3a0405410ae68892ebb1a62a9f8118e8846bbeb0c6', - 'ufl': '8dccfe10d1251ba48a4d43a4c6c89abe076390223b500f4baf06f696294b8dd0', - } - }, - { - 'version': '1.6.0', - 'sha256': '67eaac5fece6e71da0559b4ca8423156f9e99a952f0620adae449ebebb6695d1', - 'resources': { - 'ffc': '382e7713fe759694e5f07506b144eeead681e169e5a34c164ef3da30eddcc1c6', - 'fiat': '858ea3e936ad3b3558b474ffccae8a7b9dddbaafeac77e307115b23753cb1cac', - 'instant': '2347e0229531969095911fdb1de30bd77bdd7f81521ba84d81b1b4a564fc906c', - 'ufl': 'c75c4781e5104504f158cb42cd87aceffa9052e8e9db6e9764e6a5b6115d7f73', - } - }, - ] - - for release in releases: - version(release['version'], release['sha256'], url=base_url.format( - pkg='dolfin', version=release['version'])) - for rname, sha256 in release['resources'].items(): - resource(name=rname, - url=base_url.format(pkg=rname, **release), - sha256=sha256, - destination='depends', - when='@{version}'.format(**release), - placement=rname) - - def cmake_is_on(self, option): - return 'ON' if option in self.spec else 'OFF' - def cmake_args(self): return [ - '-DDOLFIN_ENABLE_DOCS:BOOL={0}'.format( - self.cmake_is_on('+doc')), - '-DBUILD_SHARED_LIBS:BOOL={0}'.format( - self.cmake_is_on('+shared')), - '-DDOLFIN_SKIP_BUILD_TESTS:BOOL=ON', - '-DDOLFIN_ENABLE_OPENMP:BOOL={0}'.format( - self.cmake_is_on('+openmp')), - '-DDOLFIN_ENABLE_CHOLMOD:BOOL={0}'.format( - self.cmake_is_on('suite-sparse')), - '-DDOLFIN_ENABLE_HDF5:BOOL={0}'.format( - self.cmake_is_on('hdf5')), - '-DDOLFIN_ENABLE_MPI:BOOL={0}'.format( - self.cmake_is_on('mpi')), - '-DDOLFIN_ENABLE_PARMETIS:BOOL={0}'.format( - self.cmake_is_on('parmetis')), - '-DDOLFIN_ENABLE_PASTIX:BOOL={0}'.format( - self.cmake_is_on('pastix')), - '-DDOLFIN_ENABLE_PETSC:BOOL={0}'.format( - self.cmake_is_on('petsc')), - '-DDOLFIN_ENABLE_PETSC4PY:BOOL={0}'.format( - self.cmake_is_on('py-petsc4py')), - '-DDOLFIN_ENABLE_PYTHON:BOOL={0}'.format( - self.cmake_is_on('python')), - '-DDOLFIN_ENABLE_QT:BOOL={0}'.format( - self.cmake_is_on('qt')), - '-DDOLFIN_ENABLE_SCOTCH:BOOL={0}'.format( - self.cmake_is_on('scotch')), - '-DDOLFIN_ENABLE_SLEPC:BOOL={0}'.format( - self.cmake_is_on('slepc')), - '-DDOLFIN_ENABLE_SLEPC4PY:BOOL={0}'.format( - self.cmake_is_on('py-slepc4py')), - '-DDOLFIN_ENABLE_SPHINX:BOOL={0}'.format( - self.cmake_is_on('py-sphinx')), - '-DDOLFIN_ENABLE_TRILINOS:BOOL={0}'.format( - self.cmake_is_on('trilinos')), - '-DDOLFIN_ENABLE_UMFPACK:BOOL={0}'.format( - self.cmake_is_on('suite-sparse')), - '-DDOLFIN_ENABLE_VTK:BOOL={0}'.format( - self.cmake_is_on('vtk')), - '-DDOLFIN_ENABLE_ZLIB:BOOL={0}'.format( - self.cmake_is_on('zlib')), + self.define_from_variant('BUILD_SHARED_LIBS', 'shared'), + self.define('DOLFIN_SKIP_BUILD_TESTS', True), + self.define_from_variant('DOLFIN_ENABLE_OPENMP', 'openmp'), + self.define_from_variant('DOLFIN_ENABLE_CHOLMOD', 'suite-sparse'), + self.define_from_variant('DOLFIN_ENABLE_HDF5', 'hdf5'), + self.define_from_variant('DOLFIN_ENABLE_MPI', 'mpi'), + self.define_from_variant('DOLFIN_ENABLE_PARMETIS', 'parmetis'), + self.define_from_variant('DOLFIN_ENABLE_PETSC', 'petsc'), + self.define_from_variant('DOLFIN_ENABLE_PETSC4PY', 'petsc4py'), + self.define_from_variant('DOLFIN_ENABLE_PYTHON', 'python'), + self.define_from_variant('DOLFIN_ENABLE_QT', 'qt'), + self.define_from_variant('DOLFIN_ENABLE_SCOTCH', 'scotch'), + self.define_from_variant('DOLFIN_ENABLE_SLEPC', 'slepc'), + self.define_from_variant('DOLFIN_ENABLE_SLEPC4PY', 'slepc4py'), + self.define_from_variant('DOLFIN_ENABLE_DOCS', 'doc'), + self.define_from_variant('DOLFIN_ENABLE_SPHINX', 'doc'), + self.define_from_variant('DOLFIN_ENABLE_TRILINOS', 'trilinos'), + self.define_from_variant('DOLFIN_ENABLE_UMFPACK', 'suite-sparse'), + self.define_from_variant('DOLFIN_ENABLE_VTK', 'vtk'), + self.define_from_variant('DOLFIN_ENABLE_ZLIB', 'zlib'), ] - @run_after('build') - def build_python_components(self): - for package in self.python_components: - with working_dir(join_path('depends', package)): - setup_py('build') + # set environment for bulding python interface + def setup_build_environment(self, env): + env.set('DOLFIN_DIR', self.prefix) + + def setup_run_environment(self, env): + env.set('DOLFIN_DIR', self.prefix) + # build python interface of dolfin @run_after('install') - def install_python_components(self): - for package in self.python_components: - with working_dir(join_path('depends', package)): - setup_py('install', '--prefix={0}'.format(self.prefix)) + def install_python_interface(self): + if '+python' in self.spec: + with working_dir('python'): + setup_py('install', '--single-version-externally-managed', + '--root=/', '--prefix={0}'.format(self.prefix)) diff --git a/var/spack/repos/builtin/packages/fenics/petsc_3_11.patch b/var/spack/repos/builtin/packages/fenics/petsc_3_11.patch new file mode 100644 index 0000000000..98c0d94618 --- /dev/null +++ b/var/spack/repos/builtin/packages/fenics/petsc_3_11.patch @@ -0,0 +1,31 @@ +diff --git a/dolfin/la/PETScOptions.h b/dolfin/la/PETScOptions.h +index 37e5054b3..5ae24e6f5 100644 +--- a/dolfin/la/PETScOptions.h ++++ b/dolfin/la/PETScOptions.h +@@ -22,7 +22,7 @@ + + #include + #include +-#include ++#include + #include + #include + #include "PETScObject.h" +diff --git a/dolfin/nls/PETScSNESSolver.cpp b/dolfin/nls/PETScSNESSolver.cpp +index b3e1d62c5..43923ca7b 100644 +--- a/dolfin/nls/PETScSNESSolver.cpp ++++ b/dolfin/nls/PETScSNESSolver.cpp +@@ -48,7 +48,10 @@ PETScSNESSolver::_methods + = { {"default", {"default SNES method", ""}}, + {"newtonls", {"Line search method", SNESNEWTONLS}}, + {"newtontr", {"Trust region method", SNESNEWTONTR}}, ++#if PETSC_VERSION_LT(3,9,0) ++ // SNESTEST functionality removed in petsc 3.9 + {"test", {"Tool to verify Jacobian approximation", SNESTEST}}, ++#endif + {"ngmres", {"Nonlinear generalised minimum residual method", + SNESNGMRES}}, + {"nrichardson", {"Richardson nonlinear method (Picard iteration)", +diff --git a/petsc_3_11.patch b/petsc_3_11.patch +new file mode 100644 +index 000000000..e69de29bb -- cgit v1.2.3-70-g09d2