add MoFEM packages (#8700)

* add mofem-cephas package

* add mofem fracture module

* add user modules build and fracture modyle

* add minimal surface module

* add slepc variant

* bump mofem core lib version

* bump mofem core lib version

* bump version

* fix bug

* set upper bound to petsc version  and other chanes

* fix indentation

* add minimal med file installation

* chcekc with flake8 and installation with spack packages

* add variants to med package

* upper bound to adol-c and remove obsolete internal package install

* fix basic module install

* module install from external source in extended prefix

* remove obsolte code and reverse to variant doxygen

* fix git adress

* improve packaging for mofem users modules

* fix flake8

* move dependencies after variants

* move  root_cmakelists_dir right before cmake_args

* remove unused variants

* use append for single element

* replace root_cmakelists_dir

* use install_tree instead copy tree

* simplify code

* remove phase and mkdirp

* add run tests

* instal ext modules to ext_users_modules directory

* move version below url

* simplify directory name

* use underscore in variant name

* remove unused variable

* fix link to blas libs

* add missing boost dependence

* fix problem with copying module source code

* change variant name form doxygen to docs

* add expanded description

* make installation consistent with spack

* fix flake8

* make extensions installed

* code comments and minor corrections

* make slepc variant false by default
This commit is contained in:
Lukasz 2018-07-22 21:26:30 +01:00 committed by Adam J. Stewart
parent a1d6909864
commit a18a642074
6 changed files with 456 additions and 0 deletions

View File

@ -37,6 +37,7 @@ class AdolC(AutotoolsPackage):
version('2.6.3', 'f78f67f70d5874830a1ad1c0f54e54f7')
version('2.6.2', '0f9547584c99c0673e4f81cf64e8d865')
version('2.6.1', '1032b28427d6e399af4610e78c0f087b')
version('2.5.2', '96f81b80e93cca57398066ea4afe28f0')
variant('advanced_branching', default=False,
description='Enable advanced branching to reduce retaping')

View File

@ -0,0 +1,71 @@
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# 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
##############################################################################
from spack import *
class Med(CMakePackage):
"""The MED file format is a specialization of the HDF5 standard."""
homepage = "http://docs.salome-platform.org/latest/dev/MEDCoupling/med-file.html"
url = "http://files.salome-platform.org/Salome/other/med-3.2.0.tar.gz"
maintainers = ['likask']
version('3.2.0', 'eb61df92f0624feb6328f517cd756a23')
variant('api23', default=True, description='Enable API2.3')
depends_on('mpi')
depends_on('hdf5@:1.8.19+mpi')
# FIXME This is minimal installation.
def cmake_args(self):
spec = self.spec
options = []
if '+api23' in spec:
options.extend([
'-DCMAKE_CXX_FLAGS:STRING=-DMED_API_23=1',
'-DCMAKE_C_FLAGS:STRING=-DMED_API_23=1',
'-DMED_API_23=1'])
options.extend([
'-DMEDFILE_USE_MPI=YES'
'-DMEDFILE_BUILD_TESTS={0}'.format(
'ON' if self.run_tests else 'OFF'),
'-DMEDFILE_BUILD_PYTHON=OFF',
'-DMEDFILE_INSTALL_DOC=OFF',
'-DMEDFILE_BUILD_SHARED_LIBS=OFF',
'-DMEDFILE_BUILD_STATIC_LIBS=ON',
'-DCMAKE_Fortran_COMPILER='])
options.extend([
'-DHDF5_ROOT_DIR=%s' % spec['hdf5'].prefix,
'-DMPI_ROOT_DIR=%s' % spec['mpi'].prefix])
return options

View File

@ -0,0 +1,100 @@
##############################################################################
# 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
##############################################################################
from spack import *
class MofemCephas(CMakePackage):
"""mofem-cephas core library"""
homepage = "http://mofem.eng.gla.ac.uk"
url = "https://bitbucket.org/likask/mofem-cephas.git"
maintainers = ['likask']
version('0.8.7', git='https://bitbucket.org/likask/mofem-cephas.git',
tag='v0.8.7', submodules=True)
version('develop',
git='https://bitbucket.org/likask/mofem-cephas.git',
branch='develop', submodules=True)
# This option can be only used for development of core lib
variant('copy_user_modules', default=True,
description='Copy user modules directory instead linking to source')
variant('adol-c', default=True, description='Compile with Adol-C')
variant('tetgen', default=True, description='Compile with Tetgen')
variant('med', default=True, description='Compile with Med')
variant('slepc', default=False, description='Compile with Slepc')
depends_on("mpi")
depends_on("boost")
depends_on("parmetis")
# Fixed version of hdf5, to remove some problems with dependent
# packages, f.e. MED format
depends_on("hdf5@:1.8.19+hl+mpi")
depends_on("petsc@:3.9.2+mumps+mpi")
depends_on('slepc', when='+slepc')
depends_on("moab")
# Upper bound set to ADOL-C until issues with memory leaks
# for versions 2.6: fully resolved
depends_on("adol-c@2.5.2~examples", when="+adol-c")
depends_on("tetgen", when="+tetgen")
depends_on("med", when='+med')
extendable = True
root_cmakelists_dir = 'mofem'
def cmake_args(self):
spec = self.spec
options = []
# obligatory options
options.extend([
'-DWITH_SPACK=YES',
'-DPETSC_DIR=%s' % spec['petsc'].prefix,
'-DPETSC_ARCH=',
'-DMOAB_DIR=%s' % spec['moab'].prefix,
'-DBOOST_DIR=%s' % spec['boost'].prefix])
# build tests
options.append('-DMOFEM_BUILD_TETS={0}'.format(
'ON' if self.run_tests else 'OFF'))
# variant packages
if '+adol-c' in spec:
options.append('-DADOL-C_DIR=%s' % spec['adol-c'].prefix)
if '+tetgen' in spec:
options.append('-DTETGEN_DIR=%s' % spec['tetgen'].prefix)
if '+med' in spec:
options.append('-DMED_DIR=%s' % spec['med'].prefix)
if '+slepc' in spec:
options.append('-DSLEPC_DIR=%s' % spec['slepc'].prefix)
# copy users modules, i.e. stand alone vs linked users modules
options.append(
'-DSTAND_ALLONE_USERS_MODULES=%s' %
('YES' if '+copy_user_modules' in spec else 'NO'))
return options

View File

@ -0,0 +1,107 @@
##############################################################################
# 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
##############################################################################
from spack import *
class MofemFractureModule(CMakePackage):
"""mofem fracture module"""
homepage = "http://mofem.eng.gla.ac.uk"
url = "https://bitbucket.org/likask/mofem_um_fracture_mechanics"
maintainers = ['likask']
version('0.9.42',
git='https://bitbucket.org/likask/mofem_um_fracture_mechanics',
tag='v0.9.42')
version('develop',
git='https://bitbucket.org/likask/mofem_um_fracture_mechanics',
branch='develop')
variant('copy_user_modules', default=True,
description='Copy user modules directory instead linking')
extends('mofem-cephas')
depends_on("mofem-users-modules", type=('build', 'link', 'run'))
# The CMakeLists.txt installed with mofem-cephas package set cmake
# environment to install extension from extension repository. It searches
# for modules in user provides paths, for example in Spack source path.Also
# it finds all cmake exported targets installed in lib directory, which are
# built with dependent extensions, f.e.mofem - users - modules or others if
# needed.
@property
def root_cmakelists_dir(self):
"""The relative path to the directory containing CMakeLists.txt
This path is relative to the root of the extracted tarball,
not to the ``build_directory``. Defaults to the current directory.
:return: directory containing CMakeLists.txt
"""
spec = self.spec
return spec['mofem-cephas'].prefix.users_modules
def cmake_args(self):
spec = self.spec
source = self.stage.source_path
options = []
# obligatory options
options.extend([
'-DWITH_SPACK=YES',
'-DEXTERNAL_MODULES_BUILD=YES',
'-DUM_INSTALL_BREFIX=%s' % spec['mofem-users-modules'].prefix,
'-DEXTERNAL_MODULE_SOURCE_DIRS=%s' % source,
'-DSTAND_ALLONE_USERS_MODULES=%s' %
('YES' if '+copy_user_modules' in spec else 'NO')])
# Set module version
if self.spec.version == Version('develop'):
options.extend([
'-DFM_VERSION_MAJOR=%s' % 0,
'-DFM_VERSION_MINOR=%s' % 0,
'-DFM_VERSION_BUILD=%s' % 0])
else:
options.extend([
'-DFM_VERSION_MAJOR=%s' % self.spec.version[0],
'-DFM_VERSION_MINOR=%s' % self.spec.version[1],
'-DFM_VERSION_BUILD=%s' % self.spec.version[2]])
# build tests
options.append('-DMOFEM_UM_BUILD_TETS={0}'.format(
'ON' if self.run_tests else 'OFF'))
return options
# This function is not needed to run code installed by extension, nor in
# the install process. However for users like to have access to source code
# to play and make with it. Having source code at hand one can compile in
# own build directory it in mofem-cephas view when the extension is
# activated.
@run_after('install')
def copy_source_code(self):
source = self.stage.source_path
prefix = self.prefix
install_tree(source, prefix.ext_users_modules.fracture_mechanics)

View File

@ -0,0 +1,95 @@
##############################################################################
# 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
##############################################################################
from spack import *
class MofemMinimalSurfaceEquation(CMakePackage):
"""mofem minimal surface equation"""
homepage = "http://mofem.eng.gla.ac.uk"
url = "https://bitbucket.org/likask/mofem_um_minimal_surface_equation"
maintainers = ['likask']
version('0.3.9',
git='https://bitbucket.org/likask/mofem_um_minimal_surface_equation',
tag='v0.3.9')
version('develop',
git='https://bitbucket.org/likask/mofem_um_minimal_surface_equation',
branch='develop')
variant('copy_user_modules', default=True,
description='Copy user modules directory instead linking')
extends('mofem-cephas')
depends_on("mofem-users-modules", type=('build', 'link', 'run'))
# The CMakeLists.txt installed with mofem - cephas package set cmake
# environment to install extension from extension repository.It searches
# for modules in user provides paths, for example in Spack source path.Also
# it finds all cmake exported targets installed in lib directory, which are
# built with dependent extensions, f.e.mofem - users - modules or others if
# needed.
@property
def root_cmakelists_dir(self):
"""The relative path to the directory containing CMakeLists.txt
This path is relative to the root of the extracted tarball,
not to the ``build_directory``. Defaults to the current directory.
:return: directory containing CMakeLists.txt
"""
spec = self.spec
return spec['mofem-cephas'].prefix.users_modules
def cmake_args(self):
spec = self.spec
source = self.stage.source_path
options = []
# obligatory options
options.extend([
'-DWITH_SPACK=YES',
'-DEXTERNAL_MODULES_BUILD=YES',
'-DUM_INSTALL_BREFIX=%s' % spec['mofem-users-modules'].prefix,
'-DEXTERNAL_MODULE_SOURCE_DIRS=%s' % source,
'-DSTAND_ALLONE_USERS_MODULES=%s' %
('YES' if '+copy_user_modules' in spec else 'NO')])
# build tests
options.append('-DMOFEM_UM_BUILD_TETS={0}'.format(
'ON' if self.run_tests else 'OFF'))
return options
# This function is not needed to run code installed by extension, nor in
# the install process. However for users like to have access to source code
# to play and make with it. Having source code at hand one can compile in
# own build directory it in mofem-cephas view when the extension is
# activated.
@run_after('install')
def copy_source_code(self):
source = self.stage.source_path
prefix = self.prefix
install_tree(source, prefix.ext_users_modules.minimal_surface_equation)

View File

@ -0,0 +1,82 @@
##############################################################################
# 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
##############################################################################
from spack import *
class MofemUsersModules(CMakePackage):
"""MofemUsersModules creates installation environment for user-provided
modules and extends of mofem-cephas package. The CMakeList.txt file for
user modules is located in mofem-cephas/user_modules prefix.
MofemUsersModules itself does not contain any code (is a dummy with a
single dummy version). It provide sources location of users modules, i.e.
mofem-fracture-module. Those are kept as a stand-alone package (instead
of resources) as they have different versions and developers. One can
install the extension, f.e. spack installs extension spack install
mofem-fracture-module. Next, create a symlink to run the code, f.e. spack
view symlink um_view mofem-cephas, and activate the extension, i.e. spack
activate um_view mofem-minimal-surface-equation. Basic mofem
functionality is available when with spack install mofem-users-modules,
it provides simple examples for calculating elasticity problems,
magnetostatics, saturated and unsaturated flow and a couple more. For
more information how to work with Spack and MoFEM see
http://mofem.eng.gla.ac.uk/mofem/html/install_spack.html"""
homepage = "http://mofem.eng.gla.ac.uk"
url = "https://bitbucket.org/likask/mofem-joseph/downloads/users_modules_dummy"
version('1.0', '5a8b22c9cdcad7bbad92b1590d55edb1', expand=False)
maintainers = ['likask']
variant('copy_user_modules', default=True,
description='Copy user modules directory instead linking')
extends('mofem-cephas')
@property
def root_cmakelists_dir(self):
"""The relative path to the directory containing CMakeLists.txt
This path is relative to the root of the extracted tarball,
not to the ``build_directory``. Defaults to the current directory.
:return: directory containing CMakeLists.txt
"""
spec = self.spec
return spec['mofem-cephas'].prefix.users_modules
def cmake_args(self):
spec = self.spec
options = []
# obligatory options
options.extend([
'-DWITH_SPACK=YES',
'-DSTAND_ALLONE_USERS_MODULES=%s' %
('YES' if '+copy_user_modules' in spec else 'NO')])
# build tests
options.append('-DMOFEM_UM_BUILD_TETS={0}'.format(
'ON' if self.run_tests else 'OFF'))
return options