Merge pull request #1269 from davydden/pkg/hypre_trilinos_blas

Pkg/hypre trilinos blas
This commit is contained in:
Todd Gamblin
2016-07-18 03:06:37 -07:00
committed by GitHub
3 changed files with 44 additions and 20 deletions

View File

@@ -23,7 +23,9 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
import os, sys
import os
import sys
class Hypre(Package):
"""Hypre is a library of high performance preconditioners that
@@ -37,7 +39,7 @@ class Hypre(Package):
version('2.10.0b', '768be38793a35bb5d055905b271f5b8e')
# 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")
@@ -46,21 +48,26 @@ class Hypre(Package):
depends_on("lapack")
def install(self, spec, prefix):
blas_dir = spec['blas'].prefix
lapack_dir = spec['lapack'].prefix
mpi_dir = spec['mpi'].prefix
os.environ['CC'] = os.path.join(mpi_dir, 'bin', 'mpicc')
os.environ['CXX'] = os.path.join(mpi_dir, 'bin', 'mpicxx')
os.environ['F77'] = os.path.join(mpi_dir, 'bin', 'mpif77')
os.environ['CC'] = spec['mpi'].mpicc
os.environ['CXX'] = spec['mpi'].mpicxx
os.environ['F77'] = spec['mpi'].mpif77
# Since +shared does not build on macOS and also Atlas does not have
# a single static lib to build against, link against shared libs with
# a hope that --whole-archive linker option (or alike) was used
# to command the linker to include whole static libs' content into the
# shared lib
# Note: --with-(lapack|blas)_libs= needs space separated list of names
configure_args = [
"--prefix=%s" % prefix,
"--with-lapack-libs=lapack",
"--with-lapack-lib-dirs=%s/lib" % lapack_dir,
"--with-blas-libs=blas",
"--with-blas-lib-dirs=%s/lib" % blas_dir]
'--prefix=%s' % prefix,
'--with-lapack-libs=%s' % to_lib_name(
spec['lapack'].lapack_shared_lib),
'--with-lapack-lib-dirs=%s/lib' % spec['lapack'].prefix,
'--with-blas-libs=%s' % to_lib_name(
spec['blas'].blas_shared_lib),
'--with-blas-lib-dirs=%s/lib' % spec['blas'].prefix
]
if '+shared' in self.spec:
configure_args.append("--enable-shared")
@@ -76,4 +83,12 @@ def install(self, spec, prefix):
configure(*configure_args)
make()
if self.run_tests:
make("check")
make("test")
Executable(join_path('test', 'ij'))()
sstruct = Executable(join_path('test', 'struct'))
sstruct()
sstruct('-in', 'test/sstruct.in.default', '-solver', '40',
'-rhsone')
make("install")

View File

@@ -118,6 +118,7 @@ def install(self, spec, prefix):
options.extend(std_cmake_args)
mpi_bin = spec['mpi'].prefix.bin
# Note: -DXYZ_LIBRARY_NAMES= needs semicolon separated list of names
options.extend([
'-DTrilinos_ENABLE_ALL_PACKAGES:BOOL=ON',
'-DTrilinos_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=ON',
@@ -131,10 +132,12 @@ def install(self, spec, prefix):
'-DTPL_ENABLE_MPI:BOOL=ON',
'-DMPI_BASE_DIR:PATH=%s' % spec['mpi'].prefix,
'-DTPL_ENABLE_BLAS=ON',
'-DBLAS_LIBRARY_NAMES=blas', # FIXME: don't hardcode names
'-DBLAS_LIBRARY_NAMES=%s' % to_lib_name(
spec['blas'].blas_shared_lib),
'-DBLAS_LIBRARY_DIRS=%s' % spec['blas'].prefix.lib,
'-DTPL_ENABLE_LAPACK=ON',
'-DLAPACK_LIBRARY_NAMES=lapack',
'-DLAPACK_LIBRARY_NAMES=%s' % to_lib_name(
spec['lapack'].lapack_shared_lib),
'-DLAPACK_LIBRARY_DIRS=%s' % spec['lapack'].prefix,
'-DTrilinos_ENABLE_EXPLICIT_INSTANTIATION:BOOL=ON',
'-DTrilinos_ENABLE_CXX11:BOOL=ON',