Skip to content

Commit

Permalink
Merge 1bf2302 into d391670
Browse files Browse the repository at this point in the history
  • Loading branch information
KineticTheory committed May 18, 2016
2 parents d391670 + 1bf2302 commit 4cd8d26
Show file tree
Hide file tree
Showing 2 changed files with 146 additions and 90 deletions.
58 changes: 37 additions & 21 deletions var/spack/repos/builtin/packages/petsc/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@

class Petsc(Package):
"""
PETSc is a suite of data structures and routines for the scalable (parallel) solution of scientific applications
modeled by partial differential equations.
PETSc is a suite of data structures and routines for the scalable
(parallel) solution of scientific applications modeled by partial
differential equations.
"""

homepage = "http://www.mcs.anl.gov/petsc/index.html"
Expand Down Expand Up @@ -68,29 +69,35 @@ class Petsc(Package):

depends_on('hdf5+mpi', when='+hdf5+mpi')
depends_on('parmetis', when='+metis+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
# 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('superlu-dist@:4.3', when='+superlu-dist+mpi')
depends_on('mumps+mpi', when='+mumps+mpi')
depends_on('scalapack', when='+mumps+mpi')

def mpi_dependent_options(self):
if '~mpi' in self.spec:
compiler_opts = [
'--with-cc=%s' % os.environ['CC'],
'--with-cxx=%s' % (os.environ['CXX'] if self.compiler.cxx is not None else '0'),
'--with-fc=%s' % (os.environ['FC'] if self.compiler.fc is not None else '0'),
'--with-cxx=%s' % (os.environ['CXX']
if self.compiler.cxx is not None else '0'),
'--with-fc=%s' % (os.environ['FC']
if self.compiler.fc is not None else '0'),
'--with-mpi=0'
]
error_message_fmt = '\t{library} support requires "+mpi" to be activated'
error_message_fmt = '\t{library} support requires "+mpi" to be ' \
'activated'

# If mpi is disabled (~mpi), it's an error to have any of these enabled.
# This generates a list of any such errors.
# 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','superlu-dist')
if ('+'+x) in self.spec]
for x in ('hdf5', 'hypre', 'parmetis', 'mumps',
'superlu-dist')
if ('+' + x) in self.spec]
if errors:
errors = ['incompatible variants given'] + errors
raise RuntimeError('\n'.join(errors))
Expand All @@ -105,26 +112,35 @@ def install(self, spec, prefix):
options = ['--with-ssl=0']
options.extend(self.mpi_dependent_options())
options.extend([
'--with-precision=%s' % ('double' if '+double' in spec else 'single'),
'--with-scalar-type=%s' % ('complex' if '+complex' in spec else 'real'),
'--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-debugging=%s' % ('1' if '+debug' in spec else '0'),
'--with-blas-lapack-dir=%s' % spec['lapack'].prefix
])
# Activates library support if needed
for library in ('metis', 'boost', 'hdf5', 'hypre', 'parmetis','mumps','scalapack'):
for library in ('metis', 'boost', 'hdf5', 'hypre', 'parmetis',
'mumps', 'scalapack'):
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'))
)
if library in spec:
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
# 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-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:
Expand Down
Loading

0 comments on commit 4cd8d26

Please sign in to comment.