petsc: added variants and dips (#24725)
Add HPDDM, MMG, ParMMG and Tetgen to PETSc. Add mmg version 5.5.2 (compatible with PETSc). Add parmmg, depending on mmg. Add pic variant to tetgen for PETSc.
This commit is contained in:
parent
5823a9b302
commit
213ec6df5f
@ -128,6 +128,9 @@ def install(self, spec, prefix):
|
||||
|
||||
if '+shared' in spec:
|
||||
options.append('-DBUILD_SHARED_LIBS=ON')
|
||||
else:
|
||||
options.append('-DBUILD_SHARED_LIBS=OFF')
|
||||
options.append('-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true')
|
||||
|
||||
cmake('.', *options)
|
||||
make()
|
||||
|
11
var/spack/repos/builtin/packages/freefem/acmpi.patch
Normal file
11
var/spack/repos/builtin/packages/freefem/acmpi.patch
Normal file
@ -0,0 +1,11 @@
|
||||
--- a/etc/config/m4/acmpi.m4 2021-04-19 21:45:30.000000000 +0200
|
||||
+++ b/etc/config/m4/acmpi.m4 2021-07-06 09:53:06.100076241 +0200
|
||||
@@ -296,7 +296,7 @@
|
||||
test -n "$MPICC" && ff_mpicshow=`$MPICC -show` 2>/dev/null
|
||||
test -n "$MPIFC" && ff_mpifcshow=`$MPIFC -show` 2>/dev/null
|
||||
if test "$with_mpilibs" = no -o -z "$with_mpilibs" ; then
|
||||
- [ff_MPI_INCLUDE=`echo $ff_mpishow|tr ' ' '\n'| grep -E '^[-/][^WLlOgpf]|^-Wp,'|tr '\n' ' '`]
|
||||
+ [ff_MPI_INCLUDE=`echo $ff_mpishow|tr ' ' '\n' | sed '1 d'| grep -E '^[-/][^WLlOgpf]|^-Wp,'|tr '\n' ' '`]
|
||||
ff_MPI_LIB_DIRS=""
|
||||
[ff_MPI_LIB=`echo $ff_mpishow|tr ' ' '\n'| grep -E '^-[Llp]|^-Wl,'|tr '\n' ' '`]
|
||||
[ff_MPI_LIBC=`echo $ff_mpicshow|tr ' ' '\n'| grep -E '^-[Llp]|^-Wl,'|tr '\n' ' '`]
|
11
var/spack/repos/builtin/packages/freefem/acmpi4.8.patch
Normal file
11
var/spack/repos/builtin/packages/freefem/acmpi4.8.patch
Normal file
@ -0,0 +1,11 @@
|
||||
--- a/etc/config/m4/acmpi.m4 2021-04-19 21:45:30.000000000 +0200
|
||||
+++ b/etc/config/m4/acmpi.m4 2021-07-06 09:53:06.100076241 +0200
|
||||
@@ -296,7 +296,7 @@
|
||||
test -n "$MPICC" && ff_mpicshow=`$MPICC -show` 2>/dev/null
|
||||
test -n "$MPIFC" && ff_mpifcshow=`$MPIFC -show` 2>/dev/null
|
||||
if test "$with_mpilibs" = no -o -z "$with_mpilibs" ; then
|
||||
- [ff_MPI_INCLUDE=`echo $ff_mpishow|tr ' ' '\n'| grep -E '^[-/][^WLlOgp]|^-Wp,'|tr '\n' ' '`]
|
||||
+ [ff_MPI_INCLUDE=`echo $ff_mpishow|tr ' ' '\n' | sed '1 d'| grep -E '^[-/][^WLlOgpf]|^-Wp,'|tr '\n' ' '`]
|
||||
ff_MPI_LIB_DIRS=""
|
||||
[ff_MPI_LIB=`echo $ff_mpishow|tr ' ' '\n'| grep -E '^-[Llp]|^-Wl,'|tr '\n' ' '`]
|
||||
[ff_MPI_LIBC=`echo $ff_mpicshow|tr ' ' '\n'| grep -E '^-[Llp]|^-Wl,'|tr '\n' ' '`]
|
64
var/spack/repos/builtin/packages/freefem/package.py
Normal file
64
var/spack/repos/builtin/packages/freefem/package.py
Normal file
@ -0,0 +1,64 @@
|
||||
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
|
||||
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||
#
|
||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||
|
||||
from spack import *
|
||||
|
||||
|
||||
class Freefem(AutotoolsPackage):
|
||||
"""FreeFEM is a popular 2D and 3D partial differential equations (PDE) solver.
|
||||
It allows you to easily implement your own physics modules using the provided
|
||||
FreeFEM language. FreeFEM offers a large list of finite elements, like the
|
||||
Lagrange, Taylor-Hood, etc., usable in the continuous and discontinuous
|
||||
Galerkin method framework.
|
||||
"""
|
||||
|
||||
homepage = "https://freefem.org"
|
||||
url = "https://github.com/FreeFem/FreeFem-sources/archive/refs/tags/v4.9.tar.gz"
|
||||
|
||||
maintainers = ['corentin-dev']
|
||||
|
||||
version('4.9', sha256='299ba2b73dfff578b7890f693c1e835680bf55eba87263cabd60d81909e1e0e4')
|
||||
version('4.8', sha256='499b1ca24d45088226a238412ea1492d9cc3eb6088866904145511469780180d')
|
||||
version('4.7-1', sha256='60d84424d20b5f6abaee638dc423480fc76f9c389bba1a2f23fd984e39a3fb96')
|
||||
version('4.7', sha256='c1797b642e9c3d543eaad4949d26ce1e986f531ee9be14fff606ea525ada9206')
|
||||
version('4.6', sha256='6c09af8e189fc02214b0e664b679b49832c134e29cf1ede3cab29cf754f6078f')
|
||||
version('4.5', sha256='5b2d4125c312da8fbedd49a72e742f18f35e0ae100c82fb493067dfad5d51432')
|
||||
|
||||
variant('mpi', default=False,
|
||||
description='Activate MPI support')
|
||||
variant('petsc', default=False,
|
||||
description='Compile with PETSc/SLEPc')
|
||||
|
||||
depends_on('mpi', when='+mpi')
|
||||
depends_on('slepc', when='+petsc')
|
||||
|
||||
# Patches to help configure find correctly MPI flags
|
||||
# when using full path for compilers.
|
||||
patch('acmpi.patch', when='@4.9', sha256='8157d89fc19227a555b54a4f2eb1c44da8aef3192077a6df2e88093b850f4c50')
|
||||
patch('acmpi4.8.patch', when='@:4.8', sha256='be84f7b1b8182ff0151c258056a09bda70d72a611b0a4da1fa1954df2e0fe84e')
|
||||
|
||||
def autoreconf(self, spec, prefix):
|
||||
autoreconf = which('autoreconf')
|
||||
autoreconf('-i')
|
||||
|
||||
def configure_args(self):
|
||||
spec = self.spec
|
||||
options = ['--disable-mkl',
|
||||
'CFLAGS=%s' % ' '.join(spec.compiler_flags['cflags']),
|
||||
'FFLAGS=%s' % ' '.join(spec.compiler_flags['fflags']),
|
||||
'CXXFLAGS=%s' % ' '.join(spec.compiler_flags['cxxflags'])]
|
||||
|
||||
if '+petsc' in spec:
|
||||
options.append('--with-petsc=%s'
|
||||
% spec['petsc'].prefix.lib.petsc.conf.petscvariables)
|
||||
options.append('--with-slepc-ldflags=%s'
|
||||
% spec['slepc'].libs.ld_flags)
|
||||
options.append('--with-slepc-include=%s'
|
||||
% spec['slepc'].headers.include_flags)
|
||||
else:
|
||||
options.append('--without-petsc')
|
||||
options.append('--without-slepc')
|
||||
|
||||
return options
|
75
var/spack/repos/builtin/packages/hpddm/package.py
Normal file
75
var/spack/repos/builtin/packages/hpddm/package.py
Normal file
@ -0,0 +1,75 @@
|
||||
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
|
||||
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||
#
|
||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||
|
||||
from spack import *
|
||||
|
||||
|
||||
class Hpddm(Package):
|
||||
"""High-performance unified framework for domain decomposition methods."""
|
||||
|
||||
homepage = "https://github.com/hpddm/hpddm"
|
||||
url = "https://github.com/hpddm/hpddm"
|
||||
git = "https://github.com/hpddm/hpddm.git"
|
||||
|
||||
maintainers = ['corentin-dev']
|
||||
|
||||
version('main', branch='main')
|
||||
version('2.1.2', commit='e58205623814f59bf2aec2e2bab8eafcfbd22466')
|
||||
|
||||
depends_on('mpi')
|
||||
depends_on('blas')
|
||||
depends_on('lapack')
|
||||
depends_on('mumps')
|
||||
depends_on('hypre')
|
||||
depends_on('scalapack')
|
||||
depends_on('arpack-ng')
|
||||
depends_on('python')
|
||||
|
||||
def configure(self):
|
||||
makefile_inc = []
|
||||
# cflags = [
|
||||
makefile_inc.append('SOLVER ?= MUMPS')
|
||||
makefile_inc.append('SUBSOLVER ?= MUMPS')
|
||||
makefile_inc.append('EIGENSOLVER ?= ARPACK')
|
||||
makefile_inc.append('MPICXX ?= mpic++')
|
||||
makefile_inc.append('MPICC ?= mpicc')
|
||||
makefile_inc.append('MPIF90 ?= mpif90')
|
||||
makefile_inc.append('MPIRUN ?= mpirun -np')
|
||||
|
||||
makefile_inc.append('override CXXFLAGS += -std=c++11 -O3 -fPIC')
|
||||
makefile_inc.append('override CFLAGS += -std=c99 -O3')
|
||||
makefile_inc.append('INCS =')
|
||||
makefile_inc.append('LIBS =')
|
||||
|
||||
makefile_inc.append("HPDDMFLAGS ?= -DHPDM_NUMBERING=\'C\'")
|
||||
|
||||
makefile_inc.append('MUMPS_INCS = ')
|
||||
makefile_inc.append('PYTHON_INCS = ')
|
||||
makefile_inc.append('BLAS_LIBS = -lopenblas')
|
||||
makefile_inc.append('ARPACK_LIBS = -larpack')
|
||||
makefile_inc.append('SCALAPACK_LIBS = -lscalapack')
|
||||
makefile_inc.append(' '.join([
|
||||
'MUMPS_LIBS', '=',
|
||||
'-lcmumps',
|
||||
'-ldmumps',
|
||||
'-lsmumps',
|
||||
'-lzmumps',
|
||||
'-lmumps_common',
|
||||
'-lpord',
|
||||
'-fopenmp']))
|
||||
makefile_inc.append('HYPRE_LIBS = -lHYPRE')
|
||||
makefile_inc.append('PYTHON_LIBS = -lpython3')
|
||||
|
||||
with working_dir('.'):
|
||||
with open('Makefile.inc', 'w') as fh:
|
||||
fh.write('\n'.join(makefile_inc))
|
||||
|
||||
def patch(self):
|
||||
self.configure()
|
||||
|
||||
def install(self, spec, prefix):
|
||||
make()
|
||||
install_tree('include', prefix.include)
|
||||
# make('install')
|
@ -26,6 +26,7 @@ class Mmg(CMakePackage):
|
||||
homepage = "http://www.mmgtools.org/"
|
||||
url = "https://github.com/MmgTools/mmg/archive/v5.3.13.tar.gz"
|
||||
|
||||
version('5.5.2', sha256='58e3b866101e6f0686758e16bcf9fb5fb06c85184533fc5054ef1c8adfd4be73')
|
||||
version('5.4.0', sha256='2b5cc505018859856766be901797ff5d4789f89377038a0211176a5571039750')
|
||||
version('5.3.13', sha256='d9a5925b69b0433f942ab2c8e55659d9ccea758743354b43d54fdf88a6c3c191')
|
||||
|
||||
|
35
var/spack/repos/builtin/packages/parmmg/package.py
Normal file
35
var/spack/repos/builtin/packages/parmmg/package.py
Normal file
@ -0,0 +1,35 @@
|
||||
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
|
||||
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||
#
|
||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||
|
||||
from spack import *
|
||||
|
||||
|
||||
class Parmmg(CMakePackage):
|
||||
"""ParMMG is a parallel remesher based on MMG"""
|
||||
|
||||
homepage = "https://www.mmgtools.org"
|
||||
url = "https://github.com/MmgTools/ParMmg/archive/refs/tags/v1.3.0.tar.gz"
|
||||
|
||||
maintainers = ['corentin-dev']
|
||||
|
||||
version('1.3.0', sha256='d43b73a73b62545b5a31bbe25562f69c9e63ad8a6d416bd459781203e37427cf')
|
||||
version('1.2.0', sha256='99729cc292dcb59c87e3f25d4cabf5a64841e83b624d383e1fd3fb7f960df672')
|
||||
version('1.1.0', sha256='a5904f1f56b7809ab9ec2f6118b03a082ec2b5564355a73c74fc55426cc69600')
|
||||
version('1.0.0', sha256='614feb815ff6cdfc9bced30e8105994f0bf3a812243619d3349203ec1851cf6d')
|
||||
|
||||
depends_on('mmg')
|
||||
depends_on('metis')
|
||||
depends_on('vtk')
|
||||
depends_on('mpi')
|
||||
|
||||
variant('pic', default=True,
|
||||
description='Build with position independent code')
|
||||
|
||||
def cmake_args(self):
|
||||
args = [
|
||||
self.define_from_variant('CMAKE_POSITION_INDEPENDENT_CODE', 'pic'),
|
||||
]
|
||||
|
||||
return args
|
@ -91,6 +91,14 @@ class Petsc(Package, CudaPackage, ROCmPackage):
|
||||
description='Activates support for HDF5 (only parallel)')
|
||||
variant('hypre', default=True,
|
||||
description='Activates support for Hypre (only parallel)')
|
||||
variant('hpddm', default=False,
|
||||
description='Activates support for HPDDM (only parallel)')
|
||||
variant('mmg', default=False,
|
||||
description='Activates support for MMG')
|
||||
variant('parmmg', default=False,
|
||||
description='Activates support for ParMMG (only parallel)')
|
||||
variant('tetgen', default=False,
|
||||
description='Activates support for Tetgen')
|
||||
# Mumps is disabled by default, because it depends on Scalapack
|
||||
# which is not portable to all HPC systems
|
||||
variant('mumps', default=False,
|
||||
@ -161,6 +169,8 @@ class Petsc(Package, CudaPackage, ROCmPackage):
|
||||
conflicts('+fftw', when='~mpi', msg=mpi_msg)
|
||||
conflicts('+hdf5', when='~mpi', msg=mpi_msg)
|
||||
conflicts('+hypre', when='~mpi', msg=mpi_msg)
|
||||
conflicts('+hpddm', when='~mpi', msg=mpi_msg)
|
||||
conflicts('+parmmg', when='~mpi', msg=mpi_msg)
|
||||
conflicts('+moab', when='~mpi', msg=mpi_msg)
|
||||
conflicts('+mumps', when='~mpi', msg=mpi_msg)
|
||||
conflicts('+p4est', when='~mpi', msg=mpi_msg)
|
||||
@ -229,6 +239,9 @@ class Petsc(Package, CudaPackage, ROCmPackage):
|
||||
depends_on('parmetis+int64', when='+metis+mpi+int64')
|
||||
depends_on('parmetis~int64', when='+metis+mpi~int64')
|
||||
depends_on('valgrind', when='+valgrind')
|
||||
depends_on('mmg', when='+mmg')
|
||||
depends_on('parmmg', when='+parmmg')
|
||||
depends_on('tetgen+pic', when='+tetgen')
|
||||
# Hypre does not support complex numbers.
|
||||
# Also PETSc prefer to build it without internal superlu, likely due to
|
||||
# conflict in headers see
|
||||
@ -417,6 +430,9 @@ def install(self, spec, prefix):
|
||||
(jpeg_sp, 'libjpeg', True, True),
|
||||
(scalapack_sp, 'scalapack', False, True),
|
||||
'strumpack',
|
||||
'mmg',
|
||||
'parmmg',
|
||||
('tetgen', 'tetgen', False, False),
|
||||
):
|
||||
# Cannot check `library in spec` because of transitive deps
|
||||
# Cannot check variants because parmetis keys on +metis
|
||||
@ -472,6 +488,11 @@ def install(self, spec, prefix):
|
||||
'--with-mkl_pardiso-dir=%s' % spec['mkl'].prefix
|
||||
)
|
||||
|
||||
# For the moment, HPDDM does not work as a dependency
|
||||
# using download instead
|
||||
if '+hpddm' in spec:
|
||||
options.append('--download-hpddm')
|
||||
|
||||
python('configure', '--prefix=%s' % prefix, *options)
|
||||
|
||||
# PETSc has its own way of doing parallel make.
|
||||
|
@ -21,6 +21,7 @@ class Tetgen(Package):
|
||||
version('1.5.0', sha256='4d114861d5ef2063afd06ef38885ec46822e90e7b4ea38c864f76493451f9cf3', url='http://www.tetgen.org/1.5/src/tetgen1.5.0.tar.gz')
|
||||
version('1.4.3', sha256='952711bb06b7f64fd855eb24c33f08e3faf40bdd54764de10bbe5ed5b0dce034', url='http://www.tetgen.org/files/tetgen1.4.3.tar.gz')
|
||||
|
||||
variant('pic', default=True, description='Builds the library in pic mode.')
|
||||
variant('debug', default=False, description='Builds the library in debug mode.')
|
||||
variant('except', default=False, description='Replaces asserts with exceptions for better C++ compatibility.')
|
||||
|
||||
@ -28,9 +29,12 @@ class Tetgen(Package):
|
||||
|
||||
def patch(self):
|
||||
cflags = '-g -O0' if '+debug' in self.spec else '-g0 -O3'
|
||||
cflags = cflags + ' -fPIC' if '+pic' in self.spec else cflags
|
||||
predcflags = '-fPIC' if '+pic' in self.spec else ''
|
||||
|
||||
mff = FileFilter('makefile')
|
||||
mff.filter(r'^(C(XX)?FLAGS\s*=)(.*)$', r'\1 {0}'.format(cflags))
|
||||
mff.filter(r'^(PREDC(XX)?FLAGS\s*=.*)$', r'\1 {0}'.format(predcflags))
|
||||
|
||||
if '+except' in self.spec:
|
||||
hff = FileFilter('tetgen.h')
|
||||
|
Loading…
Reference in New Issue
Block a user