diff options
Diffstat (limited to 'var/spack/repos/builtin/packages/dealii/package.py')
-rw-r--r-- | var/spack/repos/builtin/packages/dealii/package.py | 316 |
1 files changed, 176 insertions, 140 deletions
diff --git a/var/spack/repos/builtin/packages/dealii/package.py b/var/spack/repos/builtin/packages/dealii/package.py index 8f3e5d80ea..55cd7cbd00 100644 --- a/var/spack/repos/builtin/packages/dealii/package.py +++ b/var/spack/repos/builtin/packages/dealii/package.py @@ -1,36 +1,18 @@ -############################################################################## -# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. +# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. # -# This file is part of Spack. -# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. -# LLNL-CODE-647188 -# -# For details, see https://github.com/spack/spack -# Please also see the NOTICE and LICENSE files for our notice and the LGPL. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License (as -# published by the Free Software Foundation) version 2.1, February 1999. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and -# conditions of the GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -############################################################################## +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + from spack import * -import os -class Dealii(CMakePackage): +class Dealii(CMakePackage, CudaPackage): """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" + url = "https://github.com/dealii/dealii/releases/download/v8.4.1/dealii-8.4.1.tar.gz" + git = "https://github.com/dealii/dealii.git" maintainers = ['davydden', 'jppelteret'] @@ -38,30 +20,34 @@ class Dealii(CMakePackage): # only add for immediate deps. transitive_rpaths = False - version('8.5.1', '39b9ebd6ab083d63cfc9044319aaa2ee') - version('8.5.0', 'ef999cc310b007559a6343bf5b1759bc') - version('8.4.2', '84c6bd3f250d3e0681b645d24cb987a7') - version('8.4.1', 'efbaf16f9ad59cfccad62302f36c3c1d') - version('8.4.0', 'ac5dbf676096ff61e092ce98c80c2b00') - version('8.3.0', 'fc6cdcb16309ef4bea338a4f014de6fa') - version('8.2.1', '71c728dbec14f371297cd405776ccf08') - version('8.1.0', 'aa8fadc2ce5eb674f44f997461bf668d') - version('develop', git='https://github.com/dealii/dealii.git', branch='master') + version('develop', branch='master') + version('9.0.1', sha256='df2f0d666f2224be07e3741c0e8e02132fd67ea4579cd16a2429f7416146ee64') + version('9.0.0', sha256='c918dc5c1a31d62f6eea7b524dcc81c6d00b3c378d4ed6965a708ab548944f08') + version('8.5.1', sha256='d33e812c21a51f7e5e3d3e6af86aec343155650b611d61c1891fbc3cabce09ae') + version('8.5.0', sha256='e6913ff6f184d16bc2598c1ba31f879535b72b6dff043e15aef048043ff1d779') + version('8.4.2', sha256='ec7c00fadc9d298d1a0d16c08fb26818868410a9622c59ba624096872f3058e4') + version('8.4.1', sha256='00a0e92d069cdafd216816f1aff460f7dbd48744b0d9e0da193287ebf7d6b3ad') + version('8.4.0', sha256='36a20e097a03f17b557e11aad1400af8c6252d25f7feca40b611d5fc16d71990') + version('8.3.0', sha256='4ddf72632eb501e1c814e299f32fc04fd680d6fda9daff58be4209e400e41779') + version('8.2.1', sha256='d75674e45fe63cd9fa294460fe45228904d51a68f744dbb99cd7b60720f3b2a0') + version('8.1.0', sha256='d666bbda2a17b41b80221d7029468246f2658051b8c00d9c5907cd6434c4df99') variant('mpi', default=True, description='Compile with MPI') - variant('assimp', default=False, + variant('assimp', default=True, description='Compile with Assimp') variant('arpack', default=True, description='Compile with Arpack and PArpack (only with MPI)') - variant('adol-c', default=False, + variant('adol-c', default=True, description='Compile with Adol-c') variant('doc', default=False, description='Compile with documentation') + variant('gmsh', default=True, description='Compile with GMSH') variant('gsl', default=True, description='Compile with GSL') variant('hdf5', default=True, description='Compile with HDF5 (only with MPI)') variant('metis', default=True, description='Compile with Metis') - variant('nanoflann', default=False, description='Compile with Nanoflann') + variant('muparser', default=True, description='Compile with muParser') + variant('nanoflann', default=True, description='Compile with Nanoflann') variant('netcdf', default=True, description='Compile with Netcdf (only with MPI)') variant('oce', default=True, description='Compile with OCE') @@ -69,13 +55,15 @@ class Dealii(CMakePackage): description='Compile with P4est (only with MPI)') variant('petsc', default=True, description='Compile with Petsc (only with MPI)') - variant('sundials', default=False, + variant('scalapack', default=True, + description='Compile with ScaLAPACK (only with MPI)') + variant('sundials', default=True, description='Compile with Sundials') variant('slepc', default=True, description='Compile with Slepc (only with Petsc and MPI)') variant('trilinos', default=True, description='Compile with Trilinos (only with MPI)') - variant('python', default=True, + variant('python', default=False, description='Compile with Python bindings') variant('int64', default=False, description='Compile with 64 bit indices support') @@ -84,83 +72,115 @@ class Dealii(CMakePackage): variant('build_type', default='DebugRelease', description='The build type to build', values=('Debug', 'Release', 'DebugRelease')) - variant('cuda', default=False, - description='Build with CUDA') # required dependencies, light version - depends_on("blas") - # Boost 1.58 is blacklisted, see + depends_on('blas') + # Boost 1.58 is blacklisted, require at least 1.59, see # https://github.com/dealii/dealii/issues/1591 - # Require at least 1.59 - # +python won't affect @:8.4.2 - # FIXME: once concretizer can unite unconditional and - # conditional dependencies, simplify to: - # depends_on("boost@1.59.0+thread+system+serialization+iostreams") - # depends_on("boost+mpi", when='+mpi') - # depends_on("boost+python", when='+python') - depends_on("boost@1.59.0:1.63,1.66:+thread+system+serialization+iostreams", - when='@:8.4.2~mpi') - depends_on("boost@1.59.0:1.63,1.66:+thread+system+serialization+iostreams+mpi", - when='@:8.4.2+mpi') - # since @8.5.0: (and @develop) python bindings are introduced: - depends_on("boost@1.59.0:1.63,1.66:+thread+system+serialization+iostreams", - when='@8.5.0:~mpi~python') - depends_on("boost@1.59.0:1.63,1.66:+thread+system+serialization+iostreams+mpi", - when='@8.5.0:+mpi~python') - depends_on("boost@1.59.0:1.63,1.66:+thread+system+serialization+iostreams+python", - when='@8.5.0:~mpi+python') - depends_on("boost@1.59.0:1.63,1.66:+thread+system+serialization+iostreams+mpi+python", - when='@8.5.0:+mpi+python') + # There are issues with 1.65.1 and 1.65.0: + # https://github.com/dealii/dealii/issues/5262 + # we take the patch from https://github.com/boostorg/serialization/pull/79 + # more precisely its variation https://github.com/dealii/dealii/pull/5572#issuecomment-349742019 + # 1.68.0 has issues with serialization https://github.com/dealii/dealii/issues/7074 + # adopt https://github.com/boostorg/serialization/pull/105 as a fix + depends_on('boost@1.59.0:1.63,1.65.1,1.67.0:+thread+system+serialization+iostreams', + patches=[patch('boost_1.65.1_singleton.patch', + level=1, + when='@1.65.1'), + patch('boost_1.68.0.patch', + level=1, + when='@1.68.0'), + ], + when='~python') + depends_on('boost@1.59.0:1.63,1.65.1,1.67.0:+thread+system+serialization+iostreams+python', + patches=[patch('boost_1.65.1_singleton.patch', + level=1, + when='@1.65.1'), + patch('boost_1.68.0.patch', + level=1, + when='@1.68.0'), + ], + when='+python') # bzip2 is not needed since 9.0 - depends_on("bzip2", when='@:8.99') - depends_on("lapack") - depends_on("muparser") - depends_on("suite-sparse") - depends_on("tbb") - depends_on("zlib") + depends_on('bzip2', when='@:8.99') + depends_on('lapack') + depends_on('suite-sparse') + depends_on('tbb') + depends_on('zlib') # optional dependencies - depends_on("mpi", when="+mpi") - depends_on("adol-c@2.6.4:", when='@9.0:+adol-c') - depends_on("arpack-ng+mpi", when='+arpack+mpi') - depends_on("assimp", when='@9.0:+assimp') - depends_on("doxygen+graphviz", when='+doc') - depends_on("graphviz", when='+doc') - depends_on("gsl", when='@8.5.0:+gsl') - depends_on("hdf5+mpi", when='+hdf5+mpi') - depends_on("cuda@8:", when='+cuda') - depends_on("cmake@3.9:", when='+cuda') + depends_on('mpi', when='+mpi') + depends_on('adol-c@2.6.4:', when='@9.0:+adol-c') + depends_on('arpack-ng+mpi', when='+arpack+mpi') + depends_on('assimp', when='@9.0:+assimp') + depends_on('doxygen+graphviz', when='+doc') + depends_on('graphviz', when='+doc') + depends_on('gmsh+tetgen+netgen+oce', when='@9.0:+gmsh', type=('build', 'run')) + depends_on('gsl', when='@8.5.0:+gsl') + depends_on('hdf5+mpi+hl', when='+hdf5+mpi') + depends_on('cuda@8:', when='+cuda') + depends_on('cmake@3.9:', when='+cuda') + # older version of deal.II do not build with Cmake 3.10, see + # https://github.com/dealii/dealii/issues/5510 + depends_on('cmake@:3.9.99', when='@:8.99') # FIXME: concretizer bug. The two lines mimic what comes from PETSc # but we should not need it - depends_on("metis@5:+int64+real64", when='+metis+int64') - depends_on("metis@5:~int64+real64", when='+metis~int64') - depends_on("nanoflann", when="@9.0:+nanoflann") - depends_on("netcdf+mpi", when="+netcdf+mpi") - depends_on("netcdf-cxx", when='+netcdf+mpi') - depends_on("oce", when='+oce') - depends_on("p4est", when='+p4est+mpi') - depends_on("petsc+mpi~int64", when='+petsc+mpi~int64') - depends_on("petsc+mpi+int64", when='+petsc+mpi+int64') - depends_on("petsc@:3.6.4", when='@:8.4.1+petsc+mpi') + depends_on('metis@5:+int64+real64', when='+metis+int64') + depends_on('metis@5:~int64+real64', when='+metis~int64') + depends_on('muparser', when='+muparser') + depends_on('nanoflann', when='@9.0:+nanoflann') + depends_on('netcdf+mpi', when='+netcdf+mpi') + depends_on('netcdf-cxx', when='+netcdf+mpi') + depends_on('oce', when='+oce') + depends_on('p4est', when='+p4est+mpi') + depends_on('petsc+mpi~int64', when='+petsc+mpi~int64') + depends_on('petsc+mpi+int64', when='+petsc+mpi+int64') + depends_on('petsc@:3.6.4', when='@:8.4.1+petsc+mpi') depends_on('python', when='@8.5.0:+python') - depends_on("slepc", when='+slepc+petsc+mpi') - depends_on("slepc@:3.6.3", when='@:8.4.1+slepc+petsc+mpi') - depends_on("slepc~arpack", when='+slepc+petsc+mpi+int64') - depends_on("sundials~pthread", when='@9.0:+sundials') - depends_on("trilinos+amesos+aztec+epetra+ifpack+ml+muelu+sacado+teuchos", when='+trilinos+mpi~int64') - depends_on("trilinos+amesos+aztec+epetra+ifpack+ml+muelu+sacado+teuchos~hypre", when="+trilinos+mpi+int64") + depends_on('scalapack', when='@9.0:+scalapack') + depends_on('slepc', when='+slepc+petsc+mpi') + depends_on('slepc@:3.6.3', when='@:8.4.1+slepc+petsc+mpi') + depends_on('slepc~arpack', when='+slepc+petsc+mpi+int64') + depends_on('sundials~pthread', when='@9.0:+sundials') + # do not require +rol to make concretization of xsdk possible + depends_on('trilinos+amesos+aztec+epetra+ifpack+ml+muelu+sacado+teuchos', when='+trilinos+mpi~int64~cuda') + depends_on('trilinos+amesos+aztec+epetra+ifpack+ml+muelu+sacado+teuchos~hypre', when='+trilinos+mpi+int64~cuda') + # FIXME: temporary disable Tpetra when using CUDA due to + # namespace "Kokkos::Impl" has no member "cuda_abort" + depends_on('trilinos@master+amesos+aztec+epetra+ifpack+ml+muelu+rol+sacado+teuchos~amesos2~ifpack2~intrepid2~kokkos~tpetra~zoltan2', when='+trilinos+mpi~int64+cuda') + depends_on('trilinos@master+amesos+aztec+epetra+ifpack+ml+muelu+rol+sacado+teuchos~hypre~amesos2~ifpack2~intrepid2~kokkos~tpetra~zoltan2', when='+trilinos+mpi+int64+cuda') # check that the combination of variants makes sense - conflicts('+assimp', when='@:8.5.1') - conflicts('+nanoflann', when='@:8.5.1') - conflicts('+sundials', when='@:8.5.1') - conflicts('+adol-c', when='@:8.5.1') - conflicts('+gsl', when='@:8.4.2') - conflicts('+python', when='@:8.4.2') - conflicts('+cuda', when='%gcc@6:') - for p in ['+arpack', '+hdf5', '+netcdf', '+p4est', '+petsc', - '+slepc', '+trilinos']: - conflicts(p, when='~mpi') + # 64-bit BLAS: + for p in ['openblas', 'intel-mkl', 'intel-parallel-studio+mkl']: + conflicts('^{0}+ilp64'.format(p), when='@:8.5.1', + msg='64bit BLAS is only supported from 9.0.0') + + # interfaces added in 9.0.0: + for p in ['assimp', 'gmsh', 'nanoflann', 'scalapack', 'sundials', + 'adol-c']: + conflicts('+{0}'.format(p), when='@:8.5.1', + msg='The interface to {0} is supported from version 9.0.0 ' + 'onwards. Please explicitly disable this variant ' + 'via ~{0}'.format(p)) + + conflicts('+slepc', when='~petsc', + msg='It is not possible to enable slepc interfaces ' + 'without petsc.') + + # interfaces added in 8.5.0: + for p in ['gsl', 'python']: + conflicts('+{0}'.format(p), when='@:8.4.2', + msg='The interface to {0} is supported from version 8.5.0 ' + 'onwards. Please explicitly disable this variant ' + 'via ~{0}'.format(p)) + + # MPI requirements: + for p in ['arpack', 'hdf5', 'netcdf', 'p4est', 'petsc', 'scalapack', + 'slepc', 'trilinos']: + conflicts('+{0}'.format(p), when='~mpi', + msg='To enable {0} it is necessary to build deal.II with ' + 'MPI support enabled.'.format(p)) def cmake_args(self): spec = self.spec @@ -182,13 +202,17 @@ class Dealii(CMakePackage): '-DLAPACK_INCLUDE_DIRS=%s;%s' % ( spec['lapack'].prefix.include, spec['blas'].prefix.include), '-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, '-DZLIB_DIR=%s' % spec['zlib'].prefix, '-DDEAL_II_ALLOW_BUNDLED=OFF' ]) + if (spec.satisfies('^openblas+ilp64') or + spec.satisfies('^intel-mkl+ilp64') or + spec.satisfies('^intel-parallel-studio+mkl+ilp64')): + options.append('-DLAPACK_WITH_64BIT_BLAS_INDICES=ON') + if spec.satisfies('@:8.99'): options.extend([ # Cmake may still pick up system's bzip2, fix this: @@ -215,6 +239,15 @@ class Dealii(CMakePackage): '-DDEAL_II_COMPONENT_PYTHON_BINDINGS=%s' % ('ON' if '+python' in spec else 'OFF') ]) + if '+python' in spec: + python_exe = spec['python'].command.path + python_library = spec['python'].libs[0] + python_include = spec['python'].headers.directories[0] + options.extend([ + '-DPYTHON_EXECUTABLE=%s' % python_exe, + '-DPYTHON_INCLUDE_DIR=%s' % python_include, + '-DPYTHON_LIBRARY=%s' % python_library + ]) # Set directory structure: if spec.satisfies('@:8.2.1'): @@ -227,12 +260,25 @@ class Dealii(CMakePackage): ]) # CUDA - # FIXME -DDEAL_II_CUDA_FLAGS="-arch=sm_60" if '+cuda' in spec: - options.extend([ - '-DDEAL_II_WITH_CUDA=ON', - '-DDEAL_II_WITH_CXX14=OFF' - ]) + options.append( + '-DDEAL_II_WITH_CUDA=ON' + ) + if not spec.satisfies('^cuda@9:'): + options.append('-DDEAL_II_WITH_CXX14=OFF') + cuda_arch = spec.variants['cuda_arch'].value + if cuda_arch is not None and cuda_arch[0] is not '': + if len(cuda_arch) > 1: + raise InstallError( + 'deal.II only supports compilation for a single GPU!' + ) + flags = '-arch=sm_{0}'.format(cuda_arch[0]) + # FIXME: there are some compiler errors in dealii + # with: flags = ' '.join(self.cuda_flags(cuda_arch)) + # Stick with -arch=sm_xy for now. + options.append( + '-DDEAL_II_CUDA_FLAGS={0}'.format(flags) + ) else: options.extend([ '-DDEAL_II_WITH_CUDA=OFF', @@ -255,8 +301,8 @@ class Dealii(CMakePackage): # variables: for library in ( 'gsl', 'hdf5', 'p4est', 'petsc', 'slepc', 'trilinos', 'metis', - 'sundials', 'nanoflann'): - if library in spec: + 'sundials', 'nanoflann', 'assimp', 'gmsh', 'muparser'): + if ('+' + library) in spec: options.extend([ '-D%s_DIR=%s' % (library.upper(), spec[library].prefix), '-DDEAL_II_WITH_%s:BOOL=ON' % library.upper() @@ -295,36 +341,12 @@ class Dealii(CMakePackage): '-DDEAL_II_WITH_ARPACK=OFF' ]) - # Assimp - if '+assimp' in spec: - options.extend([ - '-DDEAL_II_WITH_ASSIMP=ON', - '-DASSIMP_DIR=%s' % spec['assimp'].prefix - ]) - else: - options.extend([ - '-DDEAL_II_WITH_ASSIMP=OFF' - ]) - # since Netcdf is spread among two, need to do it by hand: if '+netcdf' in spec and '+mpi' in spec: - # take care of lib64 vs lib installed lib locations: - if os.path.isdir(spec['netcdf-cxx'].prefix.lib): - netcdfcxx_lib_dir = spec['netcdf-cxx'].prefix.lib - else: - netcdfcxx_lib_dir = spec['netcdf-cxx'].prefix.lib64 - if os.path.isdir(spec['netcdf'].prefix.lib): - netcdf_lib_dir = spec['netcdf'].prefix.lib - else: - netcdf_lib_dir = spec['netcdf'].prefix.lib64 - + netcdf = spec['netcdf-cxx'].libs + spec['netcdf'].libs options.extend([ '-DNETCDF_FOUND=true', - '-DNETCDF_LIBRARIES=%s;%s' % ( - join_path(netcdfcxx_lib_dir, - 'libnetcdf_c++.%s' % dso_suffix), - join_path(netcdf_lib_dir, - 'libnetcdf.%s' % dso_suffix)), + '-DNETCDF_LIBRARIES=%s' % netcdf.joined(';'), '-DNETCDF_INCLUDE_DIRS=%s;%s' % ( spec['netcdf-cxx'].prefix.include, spec['netcdf'].prefix.include), @@ -334,6 +356,20 @@ class Dealii(CMakePackage): '-DDEAL_II_WITH_NETCDF=OFF' ]) + if '+scalapack' in spec: + scalapack = spec['scalapack'].libs + options.extend([ + '-DSCALAPACK_FOUND=true', + '-DSCALAPACK_INCLUDE_DIRS=%s' % ( + spec['scalapack'].prefix.include), + '-DSCALAPACK_LIBRARIES=%s' % scalapack.joined(';'), + '-DDEAL_II_WITH_SCALAPACK=ON' + ]) + else: + options.extend([ + '-DDEAL_II_WITH_SCALAPACK=OFF' + ]) + # Open Cascade if '+oce' in spec: options.extend([ |