Merge pull request #724 from davydden/metis_suitesparse_dealii

Metis and suitesparse fixes
This commit is contained in:
Todd Gamblin 2016-04-04 11:20:53 -07:00
commit 220fb068aa
3 changed files with 69 additions and 9 deletions

View file

@ -23,8 +23,10 @@ class Dealii(Package):
# required dependencies, light version # required dependencies, light version
depends_on ("blas") depends_on ("blas")
depends_on ("boost", when='~mpi') # Boost 1.58 is blacklisted, see https://github.com/dealii/dealii/issues/1591
depends_on ("boost+mpi", when='+mpi') # require at least 1.59
depends_on ("boost@1.59.0:", when='~mpi')
depends_on ("boost@1.59.0:+mpi", when='+mpi')
depends_on ("bzip2") depends_on ("bzip2")
depends_on ("cmake") depends_on ("cmake")
depends_on ("lapack") depends_on ("lapack")
@ -174,6 +176,19 @@ def install(self, spec, prefix):
make('release') make('release')
make('run',parallel=False) make('run',parallel=False)
# An example which uses Metis + PETSc
# FIXME: switch step-18 to MPI
with working_dir('examples/step-18'):
print('=====================================')
print('============= Step-18 ===============')
print('=====================================')
# list the number of cycles to speed up
filter_file(r'(end_time = 10;)', ('end_time = 3;'), 'step-18.cc')
if '^petsc' in spec and '^metis' in spec:
cmake('.')
make('release')
make('run',parallel=False)
# take step-40 which can use both PETSc and Trilinos # take step-40 which can use both PETSc and Trilinos
# FIXME: switch step-40 to MPI run # FIXME: switch step-40 to MPI run
with working_dir('examples/step-40'): with working_dir('examples/step-40'):

View file

@ -79,10 +79,28 @@ def install(self, spec, prefix):
if '+double' in spec: if '+double' in spec:
filter_file('REALTYPEWIDTH 32', 'REALTYPEWIDTH 64', metis_header) filter_file('REALTYPEWIDTH 32', 'REALTYPEWIDTH 64', metis_header)
# Make clang 7.3 happy.
# Prevents "ld: section __DATA/__thread_bss extends beyond end of file"
# See upstream LLVM issue https://llvm.org/bugs/show_bug.cgi?id=27059
# Adopted from https://github.com/Homebrew/homebrew-science/blob/master/metis.rb
if spec.satisfies('%clang@7.3.0'):
filter_file('#define MAX_JBUFS 128', '#define MAX_JBUFS 24', join_path(source_directory, 'GKlib', 'error.c'))
with working_dir(build_directory, create=True): with working_dir(build_directory, create=True):
cmake(source_directory, *options) cmake(source_directory, *options)
make() make()
make("install") make("install")
# now run some tests:
for f in ["4elt", "copter2", "mdual"]:
graph = join_path(source_directory,'graphs','%s.graph' % f)
Executable(join_path(prefix.bin,'graphchk'))(graph)
Executable(join_path(prefix.bin,'gpmetis'))(graph,'2')
Executable(join_path(prefix.bin,'ndmetis'))(graph)
graph = join_path(source_directory,'graphs','test.mgraph')
Executable(join_path(prefix.bin,'gpmetis'))(graph,'2')
graph = join_path(source_directory,'graphs','metis.mesh')
Executable(join_path(prefix.bin,'mpmetis'))(graph,'2')
# install GKlib headers, which will be needed for ParMETIS # install GKlib headers, which will be needed for ParMETIS
GKlib_dist = join_path(prefix.include,'GKlib') GKlib_dist = join_path(prefix.include,'GKlib')

View file

@ -10,10 +10,18 @@ class SuiteSparse(Package):
version('4.5.1', 'f0ea9aad8d2d1ffec66a5b6bfeff5319') version('4.5.1', 'f0ea9aad8d2d1ffec66a5b6bfeff5319')
# FIXME: (see below)
# variant('tbb', default=True, description='Build with Intel TBB')
depends_on('blas') depends_on('blas')
depends_on('lapack') depends_on('lapack')
depends_on('metis@5.1.0', when='@4.5.1') depends_on('metis@5.1.0', when='@4.5.1')
# FIXME:
# in @4.5.1. TBB support in SPQR seems to be broken as TBB-related linkng flags
# does not seem to be used, which leads to linking errors on Linux.
# Try re-enabling in future versions.
# depends_on('tbb', when='+tbb')
def install(self, spec, prefix): def install(self, spec, prefix):
# The build system of SuiteSparse is quite old-fashioned # The build system of SuiteSparse is quite old-fashioned
@ -21,16 +29,35 @@ def install(self, spec, prefix):
# with a lot of convoluted logic in it. # with a lot of convoluted logic in it.
# Any kind of customization will need to go through filtering of that file # Any kind of customization will need to go through filtering of that file
# FIXME : this actually uses the current workaround make_args = ['INSTALL=%s' % prefix]
# FIXME : (blas / lapack always provide libblas and liblapack as aliases)
make('install', 'INSTALL=%s' % prefix,
# inject Spack compiler wrappers # inject Spack compiler wrappers
make_args.extend([
'AUTOCC=no', 'AUTOCC=no',
'CC=cc', 'CC=cc',
'CXX=c++', 'CXX=c++',
'F77=f77', 'F77=f77',
])
# BLAS arguments require path to libraries # use Spack's metis in CHOLMOD/Partition module,
'BLAS=-lblas', # otherwise internal Metis will be compiled
'LAPACK=-llapack') make_args.extend([
'MY_METIS_LIB=-L%s -lmetis' % spec['metis'].prefix.lib,
'MY_METIS_INC=%s' % spec['metis'].prefix.include,
])
# Intel TBB in SuiteSparseQR
if '+tbb' in spec:
make_args.extend([
'SPQR_CONFIG=-DHAVE_TBB',
'TBB=-L%s -ltbb' % spec['tbb'].prefix.lib,
])
# BLAS arguments require path to libraries
# FIXME : (blas / lapack always provide libblas and liblapack as aliases)
make_args.extend([
'BLAS=-lblas',
'LAPACK=-llapack'
])
make('install', *make_args)