Merge pull request #674 from davydden/petsc_extra
extend petsc variants by mumps, complex and debug, fix headers in superlu_dist, add variant to hypre
This commit is contained in:
commit
dd61795bb8
@ -14,6 +14,8 @@ class Hypre(Package):
|
|||||||
|
|
||||||
# hypre does not know how to build shared libraries on Darwin
|
# hypre does not know how to build shared libraries on Darwin
|
||||||
variant('shared', default=sys.platform!='darwin', description="Build shared library version (disables static library)")
|
variant('shared', default=sys.platform!='darwin', description="Build shared library version (disables static library)")
|
||||||
|
# SuperluDist have conflicting headers with those in Hypre
|
||||||
|
variant('internal-superlu', default=True, description="Use internal Superlu routines")
|
||||||
|
|
||||||
depends_on("mpi")
|
depends_on("mpi")
|
||||||
depends_on("blas")
|
depends_on("blas")
|
||||||
@ -38,6 +40,9 @@ def install(self, spec, prefix):
|
|||||||
if '+shared' in self.spec:
|
if '+shared' in self.spec:
|
||||||
configure_args.append("--enable-shared")
|
configure_args.append("--enable-shared")
|
||||||
|
|
||||||
|
if '~internal-superlu' in self.spec:
|
||||||
|
configure_args.append("--without-superlu")
|
||||||
|
|
||||||
# Hypre's source is staged under ./src so we'll have to manually
|
# Hypre's source is staged under ./src so we'll have to manually
|
||||||
# cd into it.
|
# cd into it.
|
||||||
with working_dir("src"):
|
with working_dir("src"):
|
||||||
|
@ -17,14 +17,18 @@ class Petsc(Package):
|
|||||||
version('3.5.1', 'a557e029711ebf425544e117ffa44d8f')
|
version('3.5.1', 'a557e029711ebf425544e117ffa44d8f')
|
||||||
version('3.4.4', '7edbc68aa6d8d6a3295dd5f6c2f6979d')
|
version('3.4.4', '7edbc68aa6d8d6a3295dd5f6c2f6979d')
|
||||||
|
|
||||||
variant('shared', default=True, description='Enables the build of shared libraries')
|
variant('shared', default=True, description='Enables the build of shared libraries')
|
||||||
variant('mpi', default=True, description='Activates MPI support')
|
variant('mpi', default=True, description='Activates MPI support')
|
||||||
variant('double', default=True, description='Switches between single and double precision')
|
variant('double', default=True, description='Switches between single and double precision')
|
||||||
|
variant('complex', default=False, description='Build with complex numbers')
|
||||||
|
variant('debug', default=False, description='Compile in debug mode')
|
||||||
|
|
||||||
variant('metis', default=True, description='Activates support for metis and parmetis')
|
variant('metis', default=True, description='Activates support for metis and parmetis')
|
||||||
variant('hdf5', default=True, description='Activates support for HDF5 (only parallel)')
|
variant('hdf5', default=True, description='Activates support for HDF5 (only parallel)')
|
||||||
variant('boost', default=True, description='Activates support for Boost')
|
variant('boost', default=True, description='Activates support for Boost')
|
||||||
variant('hypre', default=True, description='Activates support for Hypre')
|
variant('hypre', default=True, description='Activates support for Hypre (only parallel)')
|
||||||
|
variant('mumps', default=True, description='Activates support for MUMPS (only parallel)')
|
||||||
|
variant('superlu-dist', default=True, description='Activates support for SuperluDist (only parallel)')
|
||||||
|
|
||||||
# Virtual dependencies
|
# Virtual dependencies
|
||||||
depends_on('blas')
|
depends_on('blas')
|
||||||
@ -40,7 +44,13 @@ class Petsc(Package):
|
|||||||
|
|
||||||
depends_on('hdf5+mpi', when='+hdf5+mpi')
|
depends_on('hdf5+mpi', when='+hdf5+mpi')
|
||||||
depends_on('parmetis', when='+metis+mpi')
|
depends_on('parmetis', when='+metis+mpi')
|
||||||
depends_on('hypre', when='+hypre+mpi')
|
# Hypre does not support complex numbers.
|
||||||
|
# Also PETSc prefer to build it without internal superlu, likely due to conflict in headers
|
||||||
|
# see https://bitbucket.org/petsc/petsc/src/90564b43f6b05485163c147b464b5d6d28cde3ef/config/BuildSystem/config/packages/hypre.py
|
||||||
|
depends_on('hypre~internal-superlu', when='+hypre+mpi~complex')
|
||||||
|
depends_on('superlu-dist', when='+superlu-dist+mpi')
|
||||||
|
depends_on('mumps+mpi', when='+mumps+mpi')
|
||||||
|
depends_on('scalapack', when='+mumps+mpi')
|
||||||
|
|
||||||
def mpi_dependent_options(self):
|
def mpi_dependent_options(self):
|
||||||
if '~mpi' in self.spec:
|
if '~mpi' in self.spec:
|
||||||
@ -55,7 +65,7 @@ def mpi_dependent_options(self):
|
|||||||
# If mpi is disabled (~mpi), it's an error to have any of these enabled.
|
# If mpi is disabled (~mpi), it's an error to have any of these enabled.
|
||||||
# This generates a list of any such errors.
|
# This generates a list of any such errors.
|
||||||
errors = [error_message_fmt.format(library=x)
|
errors = [error_message_fmt.format(library=x)
|
||||||
for x in ('hdf5', 'hypre', 'parmetis')
|
for x in ('hdf5', 'hypre', 'parmetis','mumps','superlu-dist')
|
||||||
if ('+'+x) in self.spec]
|
if ('+'+x) in self.spec]
|
||||||
if errors:
|
if errors:
|
||||||
errors = ['incompatible variants given'] + errors
|
errors = ['incompatible variants given'] + errors
|
||||||
@ -77,16 +87,17 @@ def mpi_dependent_options(self):
|
|||||||
return compiler_opts
|
return compiler_opts
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
def install(self, spec, prefix):
|
||||||
options = ['--with-debugging=0',
|
options = ['--with-ssl=0']
|
||||||
'--with-ssl=0']
|
|
||||||
options.extend(self.mpi_dependent_options())
|
options.extend(self.mpi_dependent_options())
|
||||||
options.extend([
|
options.extend([
|
||||||
'--with-precision=%s' % ('double' if '+double' in spec else 'single'),
|
'--with-precision=%s' % ('double' if '+double' in spec else 'single'),
|
||||||
|
'--with-scalar-type=%s' % ('complex' if '+complex' in spec else 'real'),
|
||||||
'--with-shared-libraries=%s' % ('1' if '+shared' in spec else '0'),
|
'--with-shared-libraries=%s' % ('1' if '+shared' in spec else '0'),
|
||||||
|
'--with-debugging=%s' % ('1' if '+debug' in spec else '0'),
|
||||||
'--with-blas-lapack-dir=%s' % spec['lapack'].prefix
|
'--with-blas-lapack-dir=%s' % spec['lapack'].prefix
|
||||||
])
|
])
|
||||||
# Activates library support if needed
|
# Activates library support if needed
|
||||||
for library in ('metis', 'boost', 'hdf5', 'hypre', 'parmetis'):
|
for library in ('metis', 'boost', 'hdf5', 'hypre', 'parmetis','mumps','scalapack'):
|
||||||
options.append(
|
options.append(
|
||||||
'--with-{library}={value}'.format(library=library, value=('1' if library in spec else '0'))
|
'--with-{library}={value}'.format(library=library, value=('1' if library in spec else '0'))
|
||||||
)
|
)
|
||||||
@ -94,6 +105,17 @@ def install(self, spec, prefix):
|
|||||||
options.append(
|
options.append(
|
||||||
'--with-{library}-dir={path}'.format(library=library, path=spec[library].prefix)
|
'--with-{library}-dir={path}'.format(library=library, path=spec[library].prefix)
|
||||||
)
|
)
|
||||||
|
# PETSc does not pick up SuperluDist from the dir as they look for superlu_dist_4.1.a
|
||||||
|
if 'superlu-dist' in spec:
|
||||||
|
options.extend([
|
||||||
|
'--with-superlu_dist-include=%s' % spec['superlu-dist'].prefix.include,
|
||||||
|
'--with-superlu_dist-lib=%s' % join_path(spec['superlu-dist'].prefix.lib, 'libsuperlu_dist.a'),
|
||||||
|
'--with-superlu_dist=1'
|
||||||
|
])
|
||||||
|
else:
|
||||||
|
options.append(
|
||||||
|
'--with-superlu_dist=0'
|
||||||
|
)
|
||||||
|
|
||||||
configure('--prefix=%s' % prefix, *options)
|
configure('--prefix=%s' % prefix, *options)
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
from spack import *
|
from spack import *
|
||||||
|
import glob
|
||||||
|
|
||||||
class SuperluDist(Package):
|
class SuperluDist(Package):
|
||||||
"""A general purpose library for the direct solution of large, sparse, nonsymmetric systems of linear equations on high performance machines."""
|
"""A general purpose library for the direct solution of large, sparse, nonsymmetric systems of linear equations on high performance machines."""
|
||||||
@ -52,13 +53,13 @@ def install(self, spec, prefix):
|
|||||||
# system "make"
|
# system "make"
|
||||||
|
|
||||||
# need to install by hand
|
# need to install by hand
|
||||||
headers_location = join_path(self.prefix.include,'superlu_dist')
|
headers_location = self.prefix.include
|
||||||
mkdirp(headers_location)
|
mkdirp(headers_location)
|
||||||
mkdirp(prefix.lib)
|
mkdirp(prefix.lib)
|
||||||
# FIXME: fetch all headers in the folder automatically
|
|
||||||
for header in ['Cnames.h','cublas_utils.h','dcomplex.h','html_mainpage.h','machines.h','old_colamd.h','psymbfact.h','superlu_ddefs.h','superlu_defs.h','superlu_enum_consts.h','superlu_zdefs.h','supermatrix.h','util_dist.h']:
|
headers = glob.glob(join_path(self.stage.source_path, 'SRC','*.h'))
|
||||||
superludist_header = join_path(self.stage.source_path, 'SRC/',header)
|
for h in headers:
|
||||||
install(superludist_header, headers_location)
|
install(h,headers_location)
|
||||||
|
|
||||||
superludist_lib = join_path(self.stage.source_path, 'lib/libsuperlu_dist.a')
|
superludist_lib = join_path(self.stage.source_path, 'lib/libsuperlu_dist.a')
|
||||||
install(superludist_lib,self.prefix.lib)
|
install(superludist_lib,self.prefix.lib)
|
||||||
|
Loading…
Reference in New Issue
Block a user