fix installation of superlu_dist headers and add it as a dependency to petsc; add a variant to hypre to disable internal superlu

This commit is contained in:
Denis Davydov 2016-03-28 17:49:20 +02:00
parent 5eefca43e7
commit 09e77812b6
3 changed files with 29 additions and 8 deletions

View file

@ -14,6 +14,8 @@ class Hypre(Package):
# 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)")
# SuperluDist have conflicting headers with those in Hypre
variant('internal-superlu', default=True, description="Use internal Superlu routines")
depends_on("mpi")
depends_on("blas")
@ -38,6 +40,9 @@ def install(self, spec, prefix):
if '+shared' in self.spec:
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
# cd into it.
with working_dir("src"):

View file

@ -28,6 +28,7 @@ class Petsc(Package):
variant('boost', default=True, description='Activates support for Boost')
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
depends_on('blas')
@ -43,8 +44,11 @@ class Petsc(Package):
depends_on('hdf5+mpi', when='+hdf5+mpi')
depends_on('parmetis', when='+metis+mpi')
depends_on('hypre', when='+hypre+mpi~complex') # Hypre does not support complex numbers
# 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')
@ -61,7 +65,7 @@ def mpi_dependent_options(self):
# If mpi is disabled (~mpi), it's an error to have any of these enabled.
# This generates a list of any such errors.
errors = [error_message_fmt.format(library=x)
for x in ('hdf5', 'hypre', 'parmetis','mumps')
for x in ('hdf5', 'hypre', 'parmetis','mumps','superlu-dist')
if ('+'+x) in self.spec]
if errors:
errors = ['incompatible variants given'] + errors
@ -101,6 +105,17 @@ def install(self, spec, prefix):
options.append(
'--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)

View file

@ -1,4 +1,5 @@
from spack import *
import glob
class SuperluDist(Package):
"""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"
# need to install by hand
headers_location = join_path(self.prefix.include,'superlu_dist')
headers_location = self.prefix.include
mkdirp(headers_location)
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']:
superludist_header = join_path(self.stage.source_path, 'SRC/',header)
install(superludist_header, headers_location)
headers = glob.glob(join_path(self.stage.source_path, 'SRC','*.h'))
for h in headers:
install(h,headers_location)
superludist_lib = join_path(self.stage.source_path, 'lib/libsuperlu_dist.a')
install(superludist_lib,self.prefix.lib)