New interface for passing build information among specs (#1875)
- Added a new interface for Specs to pass build information - Calls forwarded from Spec to Package are now explicit - Added descriptor within Spec to manage forwarding - Added state in Spec to maintain query information - Modified a few packages (the one involved in spack install pexsi) to showcase changes - This uses an object wrapper to `spec` to implement the `libs` sub-calls. - wrapper is returned from `__getitem__` only if spec is concrete - allows packagers to access build information easily
This commit is contained in:

committed by
Todd Gamblin

parent
5ce926d2d1
commit
ed582cef68
@@ -42,6 +42,9 @@ class Mpileaks(Package):
|
||||
depends_on("mpi")
|
||||
depends_on("callpath")
|
||||
|
||||
# Will be used to try raising an exception
|
||||
libs = None
|
||||
|
||||
def install(self, spec, prefix):
|
||||
pass
|
||||
|
||||
|
@@ -127,13 +127,13 @@ def install(self, spec, prefix):
|
||||
# BLAS/LAPACK
|
||||
if '+scalapack' in spec:
|
||||
oapp("--with-linalg-flavor=custom+scalapack")
|
||||
linalg = (spec['scalapack'].scalapack_libs +
|
||||
spec['lapack'].lapack_libs + spec['blas'].blas_libs)
|
||||
linalg = (spec['scalapack'].libs +
|
||||
spec['lapack'].libs + spec['blas'].libs)
|
||||
|
||||
# elif '+elpa' in spec:
|
||||
else:
|
||||
oapp("--with-linalg-flavor=custom")
|
||||
linalg = spec['lapack'].lapack_libs + spec['blas'].blas_libs
|
||||
linalg = spec['lapack'].libs + spec['blas'].libs
|
||||
|
||||
oapp("--with-linalg-libs=%s" % linalg.ld_flags)
|
||||
|
||||
|
@@ -55,9 +55,9 @@ def install(self, spec, prefix):
|
||||
# ARPACK support
|
||||
'-DARPACK_LIBRARY={0}'.format(arpack.joined()),
|
||||
# BLAS support
|
||||
'-DBLAS_LIBRARY={0}'.format(spec['blas'].blas_libs.joined()),
|
||||
'-DBLAS_LIBRARY={0}'.format(spec['blas'].libs.joined()),
|
||||
# LAPACK support
|
||||
'-DLAPACK_LIBRARY={0}'.format(spec['lapack'].lapack_libs.joined()),
|
||||
'-DLAPACK_LIBRARY={0}'.format(spec['lapack'].libs.joined()),
|
||||
# SuperLU support
|
||||
'-DSuperLU_INCLUDE_DIR={0}'.format(spec['superlu'].prefix.include),
|
||||
'-DSuperLU_LIBRARY={0}'.format(superlu.joined()),
|
||||
|
@@ -88,8 +88,8 @@ def install(self, spec, prefix):
|
||||
options.append('-DCMAKE_INSTALL_NAME_DIR:PATH=%s/lib' % prefix)
|
||||
|
||||
# Make sure we use Spack's blas/lapack:
|
||||
lapack_libs = spec['lapack'].lapack_libs.joined(';')
|
||||
blas_libs = spec['blas'].blas_libs.joined(';')
|
||||
lapack_libs = spec['lapack'].libs.joined(';')
|
||||
blas_libs = spec['blas'].libs.joined(';')
|
||||
|
||||
options.extend([
|
||||
'-DLAPACK_FOUND=true',
|
||||
@@ -129,8 +129,8 @@ def install(self, spec, prefix):
|
||||
])
|
||||
|
||||
options.extend([
|
||||
'--with-blas={0}'.format(spec['blas'].blas_libs.ld_flags),
|
||||
'--with-lapack={0}'.format(spec['lapack'].lapack_libs.ld_flags)
|
||||
'--with-blas={0}'.format(spec['blas'].libs.ld_flags),
|
||||
'--with-lapack={0}'.format(spec['lapack'].libs.ld_flags)
|
||||
])
|
||||
if '+shared' not in spec:
|
||||
options.append('--enable-shared=no')
|
||||
|
@@ -112,8 +112,7 @@ def install(self, spec, prefix):
|
||||
make("install")
|
||||
self.install_test()
|
||||
|
||||
@property
|
||||
def blas_libs(self):
|
||||
def libs(self):
|
||||
# libsatlas.[so,dylib,dll ] contains all serial APIs (serial lapack,
|
||||
# serial BLAS), and all ATLAS symbols needed to support them. Whereas
|
||||
# libtatlas.[so,dylib,dll ] is parallel (multithreaded) version.
|
||||
@@ -135,10 +134,6 @@ def blas_libs(self):
|
||||
to_find, root=self.prefix, shared=shared, recurse=True
|
||||
)
|
||||
|
||||
@property
|
||||
def lapack_libs(self):
|
||||
return self.blas_libs
|
||||
|
||||
def install_test(self):
|
||||
source_file = join_path(os.path.dirname(self.module.__file__),
|
||||
'test_cblas_dgemm.c')
|
||||
@@ -146,7 +141,7 @@ def install_test(self):
|
||||
'test_cblas_dgemm.output')
|
||||
|
||||
include_flags = ["-I%s" % self.spec.prefix.include]
|
||||
link_flags = self.lapack_libs.ld_flags.split()
|
||||
link_flags = self.libs.ld_flags.split()
|
||||
|
||||
output = compile_c_and_execute(source_file, include_flags, link_flags)
|
||||
compare_output_file(output, blessed_file)
|
||||
|
@@ -49,7 +49,7 @@ class Atompaw(Package):
|
||||
def install(self, spec, prefix):
|
||||
options = ['--prefix=%s' % prefix]
|
||||
|
||||
linalg = spec['lapack'].lapack_libs + spec['blas'].blas_libs
|
||||
linalg = spec['lapack'].libs + spec['blas'].libs
|
||||
options.extend([
|
||||
"--with-linalg-libs=%s" % linalg.ld_flags,
|
||||
"--enable-libxc",
|
||||
|
@@ -85,7 +85,7 @@ def install(self, spec, prefix):
|
||||
|
||||
# BLAS/LAPACK support
|
||||
if '+lapack' in spec:
|
||||
lapack_blas = spec['lapack'].lapack_libs + spec['blas'].blas_libs
|
||||
lapack_blas = spec['lapack'].libs + spec['blas'].libs
|
||||
options.extend([
|
||||
'blas_lapack_libs={0}'.format(','.join(lapack_blas.names)),
|
||||
'blas_lapack_dir={0}'.format(spec['lapack'].prefix.lib)
|
||||
|
@@ -88,12 +88,10 @@ def install(self, spec, prefix):
|
||||
cppflags = [
|
||||
'-D__FFTW3',
|
||||
'-D__LIBINT',
|
||||
'-I' + spec['fftw'].prefix.include
|
||||
spec['fftw'].cppflags
|
||||
]
|
||||
fcflags = copy.deepcopy(optflags[self.spec.compiler.name])
|
||||
fcflags.extend([
|
||||
'-I' + spec['fftw'].prefix.include
|
||||
])
|
||||
fcflags.append(spec['fftw'].cppflags)
|
||||
fftw = find_libraries(['libfftw3'], root=spec['fftw'].prefix.lib)
|
||||
ldflags = [fftw.search_flags]
|
||||
libs = [
|
||||
@@ -154,15 +152,17 @@ def install(self, spec, prefix):
|
||||
'-D__SCALAPACK'
|
||||
])
|
||||
fcflags.extend([
|
||||
# spec['elpa:fortran'].cppflags
|
||||
'-I' + join_path(
|
||||
spec['elpa'].prefix,
|
||||
'include',
|
||||
'elpa-{0}'.format(str(spec['elpa'].version)),
|
||||
'modules'
|
||||
),
|
||||
# spec[pexsi:fortran].cppflags
|
||||
'-I' + join_path(spec['pexsi'].prefix, 'fortran')
|
||||
])
|
||||
scalapack = spec['scalapack'].scalapack_libs
|
||||
scalapack = spec['scalapack'].libs
|
||||
ldflags.append(scalapack.search_flags)
|
||||
libs.extend([
|
||||
join_path(spec['elpa'].prefix.lib,
|
||||
@@ -184,8 +184,8 @@ def install(self, spec, prefix):
|
||||
libs.extend(self.spec['mpi'].mpicxx_shared_libs)
|
||||
libs.extend(self.compiler.stdcxx_libs)
|
||||
# LAPACK / BLAS
|
||||
lapack = spec['lapack'].lapack_libs
|
||||
blas = spec['blas'].blas_libs
|
||||
lapack = spec['lapack'].libs
|
||||
blas = spec['blas'].libs
|
||||
|
||||
ldflags.append((lapack + blas).search_flags)
|
||||
libs.extend([str(x) for x in (fftw, lapack, blas)])
|
||||
|
@@ -145,7 +145,7 @@ def cmake_args(self):
|
||||
options = []
|
||||
cxx_flags = []
|
||||
|
||||
lapack_blas = spec['lapack'].lapack_libs + spec['blas'].blas_libs
|
||||
lapack_blas = spec['lapack'].libs + spec['blas'].libs
|
||||
options.extend([
|
||||
'-DDEAL_II_COMPONENT_EXAMPLES=ON',
|
||||
'-DDEAL_II_WITH_THREADS:BOOL=ON',
|
||||
|
@@ -90,9 +90,9 @@ def configure(self, spec):
|
||||
blas = 'blas.a'
|
||||
lapack = 'lapack.a'
|
||||
if '+blas' in spec:
|
||||
blas = spec['blas'].blas_libs.joined()
|
||||
blas = spec['blas'].libs.joined()
|
||||
if '+lapack' in spec:
|
||||
lapack = spec['lapack'].lapack_libs.joined()
|
||||
lapack = spec['lapack'].libs.joined()
|
||||
# lapack must come before blas
|
||||
config['LIB_LPK'] = ' '.join([lapack, blas])
|
||||
|
||||
|
@@ -59,16 +59,16 @@ def install(self, spec, prefix):
|
||||
'FC={0}'.format(self.spec['mpi'].mpifc),
|
||||
'CXX={0}'.format(self.spec['mpi'].mpicxx),
|
||||
'FCFLAGS={0}'.format(
|
||||
spec['lapack'].lapack_libs.joined()
|
||||
spec['lapack'].libs.joined()
|
||||
),
|
||||
'LDFLAGS={0}'.format(
|
||||
spec['lapack'].lapack_libs.joined()
|
||||
spec['lapack'].libs.joined()
|
||||
),
|
||||
'SCALAPACK_FCFLAGS={0}'.format(
|
||||
spec['scalapack'].scalapack_libs.joined()
|
||||
spec['scalapack'].libs.joined()
|
||||
),
|
||||
'SCALAPACK_LDFLAGS={0}'.format(
|
||||
spec['scalapack'].scalapack_libs.joined()
|
||||
spec['scalapack'].libs.joined()
|
||||
),
|
||||
'--prefix={0}'.format(self.prefix)
|
||||
]
|
||||
|
@@ -88,7 +88,7 @@ def cmake_args(self):
|
||||
options.append('-DENABLE_OS_SPECIFIC_INSTALL=OFF')
|
||||
|
||||
# Make sure GMSH picks up correct BlasLapack by providing linker flags
|
||||
blas_lapack = spec['lapack'].lapack_libs + spec['blas'].blas_libs
|
||||
blas_lapack = spec['lapack'].libs + spec['blas'].libs
|
||||
options.append(
|
||||
'-DBLAS_LAPACK_LIBRARIES={0}'.format(blas_lapack.ld_flags))
|
||||
|
||||
|
@@ -78,7 +78,7 @@ def configure(self, spec, arch):
|
||||
'MPlib = -L{0}'.format(spec['mpi'].prefix.lib),
|
||||
# Linear Algebra library (BLAS or VSIPL)
|
||||
'LAinc = {0}'.format(spec['blas'].prefix.include),
|
||||
'LAlib = {0}'.format(spec['blas'].blas_libs.joined()),
|
||||
'LAlib = {0}'.format(spec['blas'].libs.joined()),
|
||||
# F77 / C interface
|
||||
'F2CDEFS = -DAdd_ -DF77_INTEGER=int -DStringSunStyle',
|
||||
# HPL includes / libraries / specifics
|
||||
|
@@ -62,8 +62,8 @@ def install(self, spec, prefix):
|
||||
os.environ['F77'] = spec['mpi'].mpif77
|
||||
|
||||
# Note: --with-(lapack|blas)_libs= needs space separated list of names
|
||||
lapack = spec['lapack'].lapack_libs
|
||||
blas = spec['blas'].blas_libs
|
||||
lapack = spec['lapack'].libs
|
||||
blas = spec['blas'].libs
|
||||
|
||||
configure_args = [
|
||||
'--prefix=%s' % prefix,
|
||||
|
@@ -83,7 +83,7 @@ def blas_libs(self):
|
||||
|
||||
@property
|
||||
def lapack_libs(self):
|
||||
return self.blas_libs
|
||||
return self.libs
|
||||
|
||||
@property
|
||||
def scalapack_libs(self):
|
||||
|
@@ -127,7 +127,7 @@ def blas_libs(self):
|
||||
|
||||
@property
|
||||
def lapack_libs(self):
|
||||
return self.blas_libs
|
||||
return self.libs
|
||||
|
||||
@property
|
||||
def scalapack_libs(self):
|
||||
|
@@ -53,8 +53,8 @@ def install(self, spec, prefix):
|
||||
mumps_flags = "-ldmumps -lmumps_common -lpord -lmpiseq"
|
||||
mumps_libcmd = "-L%s " % mumps_dir.lib + mumps_flags
|
||||
|
||||
blas_lib = spec['blas'].blas_libs.ld_flags
|
||||
lapack_lib = spec['lapack'].lapack_libs.ld_flags
|
||||
blas_lib = spec['blas'].libs.ld_flags
|
||||
lapack_lib = spec['lapack'].libs.ld_flags
|
||||
|
||||
configure_args = [
|
||||
"--prefix=%s" % prefix,
|
||||
|
@@ -102,7 +102,7 @@ def install(self, spec, prefix):
|
||||
options = ['PREFIX=%s' % prefix]
|
||||
|
||||
if '+lapack' in spec:
|
||||
lapack_lib = (spec['lapack'].lapack_libs + spec['blas'].blas_libs).ld_flags # NOQA: ignore=E501
|
||||
lapack_lib = (spec['lapack'].libs + spec['blas'].libs).ld_flags # NOQA: ignore=E501
|
||||
options.extend([
|
||||
'MFEM_USE_LAPACK=YES',
|
||||
'LAPACK_OPT=-I%s' % spec['lapack'].prefix.include,
|
||||
|
@@ -82,8 +82,8 @@ def write_makefile_inc(self):
|
||||
raise RuntimeError(
|
||||
'You cannot use the variants parmetis or ptscotch without mpi')
|
||||
|
||||
lapack_blas = (self.spec['lapack'].lapack_libs +
|
||||
self.spec['blas'].blas_libs)
|
||||
lapack_blas = (self.spec['lapack'].libs +
|
||||
self.spec['blas'].libs)
|
||||
makefile_conf = ["LIBBLAS = %s" % lapack_blas.ld_flags]
|
||||
|
||||
orderings = ['-Dpord']
|
||||
@@ -156,7 +156,7 @@ def write_makefile_inc(self):
|
||||
'OPTC = %s -O ' % fpic])
|
||||
|
||||
if '+mpi' in self.spec:
|
||||
scalapack = self.spec['scalapack'].scalapack_libs
|
||||
scalapack = self.spec['scalapack'].libs
|
||||
makefile_conf.extend(
|
||||
['CC = {0}'.format(self.spec['mpi'].mpicc),
|
||||
'FC = {0}'.format(self.spec['mpi'].mpifc),
|
||||
|
@@ -113,7 +113,7 @@ def install_one(self, spec, prefix, shared):
|
||||
if '+external-blas' in spec:
|
||||
cmake_args.extend([
|
||||
'-DUSE_OPTIMIZED_BLAS:BOOL=ON',
|
||||
'-DBLAS_LIBRARIES:PATH=%s' % spec['blas'].blas_libs.joined(';')
|
||||
'-DBLAS_LIBRARIES:PATH=%s' % spec['blas'].libs.joined(';')
|
||||
])
|
||||
|
||||
cmake_args.extend(std_cmake_args)
|
||||
|
@@ -74,8 +74,8 @@ def install(self, spec, prefix):
|
||||
]
|
||||
|
||||
# Make sure we use Spack's Lapack:
|
||||
blas = spec['blas'].blas_libs
|
||||
lapack = spec['lapack'].lapack_libs
|
||||
blas = spec['blas'].libs
|
||||
lapack = spec['lapack'].libs
|
||||
options.extend([
|
||||
'-DLAPACK_FOUND=true',
|
||||
'-DLAPACK_INCLUDE_DIRS=%s' % spec['lapack'].prefix.include,
|
||||
|
@@ -73,9 +73,9 @@ class Nwchem(Package):
|
||||
patch(url, when=condition, level=0, md5=md5)
|
||||
|
||||
def install(self, spec, prefix):
|
||||
scalapack = spec['scalapack'].scalapack_libs
|
||||
lapack = spec['lapack'].lapack_libs
|
||||
blas = spec['blas'].blas_libs
|
||||
scalapack = spec['scalapack'].libs
|
||||
lapack = spec['lapack'].libs
|
||||
blas = spec['blas'].libs
|
||||
# see http://www.nwchem-sw.org/index.php/Compiling_NWChem
|
||||
args = []
|
||||
args.extend([
|
||||
|
@@ -108,8 +108,8 @@ def configure_args(self):
|
||||
|
||||
# Required dependencies
|
||||
config_args.extend([
|
||||
"--with-blas=%s" % spec['blas'].blas_libs.ld_flags,
|
||||
"--with-lapack=%s" % spec['lapack'].lapack_libs.ld_flags
|
||||
"--with-blas=%s" % spec['blas'].libs.ld_flags,
|
||||
"--with-lapack=%s" % spec['lapack'].libs.ld_flags
|
||||
])
|
||||
|
||||
# Strongly recommended dependencies
|
||||
|
@@ -71,8 +71,8 @@ def url_for_version(self, version):
|
||||
def install(self, spec, prefix):
|
||||
arpack = find_libraries(['libarpack'], root=spec[
|
||||
'arpack-ng'].prefix.lib, shared=True)
|
||||
lapack = spec['lapack'].lapack_libs
|
||||
blas = spec['blas'].blas_libs
|
||||
lapack = spec['lapack'].libs
|
||||
blas = spec['blas'].libs
|
||||
args = []
|
||||
args.extend([
|
||||
'--prefix=%s' % prefix,
|
||||
@@ -105,8 +105,8 @@ def install(self, spec, prefix):
|
||||
])
|
||||
if '+scalapack' in spec:
|
||||
args.extend([
|
||||
'--with-blacs=%s' % spec['scalapack'].scalapack_libs,
|
||||
'--with-scalapack=%s' % spec['scalapack'].scalapack_libs,
|
||||
'--with-blacs=%s' % spec['scalapack'].libs,
|
||||
'--with-scalapack=%s' % spec['scalapack'].libs,
|
||||
])
|
||||
# --with-etsf-io-prefix=
|
||||
# --with-sparskit=${prefix}/lib/libskit.a
|
||||
|
@@ -59,17 +59,6 @@ class Openblas(MakefilePackage):
|
||||
|
||||
parallel = False
|
||||
|
||||
@property
|
||||
def blas_libs(self):
|
||||
shared = True if '+shared' in self.spec else False
|
||||
return find_libraries(
|
||||
['libopenblas'], root=self.prefix, shared=shared, recurse=True
|
||||
)
|
||||
|
||||
@property
|
||||
def lapack_libs(self):
|
||||
return self.blas_libs
|
||||
|
||||
@run_before('edit')
|
||||
def check_compilers(self):
|
||||
# As of 06/2016 there is no mechanism to specify that packages which
|
||||
@@ -151,13 +140,15 @@ def check_install(self):
|
||||
blessed_file = join_path(os.path.dirname(self.module.__file__),
|
||||
'test_cblas_dgemm.output')
|
||||
|
||||
include_flags = ["-I%s" % join_path(spec.prefix, "include")]
|
||||
link_flags = self.lapack_libs.ld_flags.split()
|
||||
include_flags = spec.cppflags
|
||||
link_flags = spec.libs.ld_flags
|
||||
if self.compiler.name == 'intel':
|
||||
link_flags.extend(["-lifcore"])
|
||||
link_flags.extend(["-lpthread"])
|
||||
link_flags += ' -lifcore'
|
||||
link_flags += ' -lpthread'
|
||||
if '+openmp' in spec:
|
||||
link_flags.extend([self.compiler.openmp_flag])
|
||||
link_flags += ' ' + self.compiler.openmp_flag
|
||||
|
||||
output = compile_c_and_execute(source_file, include_flags, link_flags)
|
||||
output = compile_c_and_execute(
|
||||
source_file, [include_flags], link_flags.split()
|
||||
)
|
||||
compare_output_file(output, blessed_file)
|
||||
|
@@ -116,6 +116,18 @@ def url_for_version(self, version):
|
||||
return "http://www.open-mpi.org/software/ompi/v%s/downloads/openmpi-%s.tar.bz2" % (
|
||||
version.up_to(2), version)
|
||||
|
||||
@property
|
||||
def libs(self):
|
||||
query_parameters = self.spec.last_query.extra_parameters
|
||||
libraries = ['libmpi']
|
||||
|
||||
if 'cxx' in query_parameters:
|
||||
libraries = ['libmpi_cxx'] + libraries
|
||||
|
||||
return find_libraries(
|
||||
libraries, root=self.prefix, shared=True, recurse=True
|
||||
)
|
||||
|
||||
def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
|
||||
spack_env.set('MPICC', join_path(self.prefix.bin, 'mpicc'))
|
||||
spack_env.set('MPICXX', join_path(self.prefix.bin, 'mpic++'))
|
||||
|
@@ -37,7 +37,7 @@ class Opium(Package):
|
||||
depends_on('lapack')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
libs = spec['lapack'].lapack_libs + spec['blas'].blas_libs
|
||||
libs = spec['lapack'].libs + spec['blas'].libs
|
||||
options = ['LDFLAGS=%s' % libs.ld_flags]
|
||||
|
||||
configure(*options)
|
||||
|
@@ -161,7 +161,7 @@ def install(self, spec, prefix):
|
||||
])
|
||||
# Make sure we use exactly the same Blas/Lapack libraries
|
||||
# across the DAG. To that end list them explicitly
|
||||
lapack_blas = spec['lapack'].lapack_libs + spec['blas'].blas_libs
|
||||
lapack_blas = spec['lapack'].libs + spec['blas'].libs
|
||||
options.extend([
|
||||
'--with-blas-lapack-lib=%s' % lapack_blas.joined()
|
||||
])
|
||||
|
@@ -36,7 +36,7 @@ DSUPERLU_INCLUDE = -I${DSUPERLU_DIR}/include
|
||||
INCLUDES = ${PEXSI_INCLUDE} ${DSUPERLU_INCLUDE}
|
||||
|
||||
# Libraries
|
||||
CPP_LIB = @STDCXX_LIB @MPICXX_LIB
|
||||
CPP_LIB = @MPICXX_LIB @STDCXX_LIB
|
||||
#GFORTRAN_LIB = /usr/lib/gcc/x86_64-linux-gnu/4.8/libgfortran.a
|
||||
LAPACK_LIB = @LAPACK_LIBS
|
||||
BLAS_LIB = @BLAS_LIBS
|
||||
|
@@ -59,7 +59,7 @@ def install(self, spec, prefix):
|
||||
'@MPICC': self.spec['mpi'].mpicc,
|
||||
'@MPICXX': self.spec['mpi'].mpicxx,
|
||||
'@MPIFC': self.spec['mpi'].mpifc,
|
||||
'@MPICXX_LIB': ' '.join(self.spec['mpi'].mpicxx_shared_libs),
|
||||
'@MPICXX_LIB': self.spec['mpi:cxx'].libs.joined(),
|
||||
'@RANLIB': 'ranlib',
|
||||
'@PEXSI_STAGE': self.stage.source_path,
|
||||
'@SUPERLU_PREFIX': self.spec['superlu-dist'].prefix,
|
||||
@@ -67,8 +67,9 @@ def install(self, spec, prefix):
|
||||
'@PARMETIS_PREFIX': self.spec['parmetis'].prefix,
|
||||
'@LAPACK_PREFIX': self.spec['lapack'].prefix,
|
||||
'@BLAS_PREFIX': self.spec['blas'].prefix,
|
||||
'@LAPACK_LIBS': self.spec['lapack'].lapack_libs.joined(),
|
||||
'@BLAS_LIBS': self.spec['lapack'].blas_libs.joined(),
|
||||
'@LAPACK_LIBS': self.spec['lapack'].libs.joined(),
|
||||
'@BLAS_LIBS': self.spec['blas'].libs.joined(),
|
||||
# FIXME : what to do with compiler provided libraries ?
|
||||
'@STDCXX_LIB': ' '.join(self.compiler.stdcxx_libs)
|
||||
}
|
||||
|
||||
|
@@ -62,10 +62,10 @@ class Psi4(Package):
|
||||
def install(self, spec, prefix):
|
||||
cmake_args = [
|
||||
'-DBLAS_TYPE={0}'.format(spec['blas'].name.upper()),
|
||||
'-DBLAS_LIBRARIES={0}'.format(spec['blas'].blas_libs.joined()),
|
||||
'-DBLAS_LIBRARIES={0}'.format(spec['blas'].libs.joined()),
|
||||
'-DLAPACK_TYPE={0}'.format(spec['lapack'].name.upper()),
|
||||
'-DLAPACK_LIBRARIES={0}'.format(
|
||||
spec['lapack'].lapack_libs.joined()),
|
||||
spec['lapack'].libs.joined()),
|
||||
'-DBOOST_INCLUDEDIR={0}'.format(spec['boost'].prefix.include),
|
||||
'-DBOOST_LIBRARYDIR={0}'.format(spec['boost'].prefix.lib),
|
||||
'-DENABLE_CHEMPS2=OFF'
|
||||
|
@@ -70,10 +70,10 @@ def patch(self):
|
||||
# for build notes see http://www.scipy.org/scipylib/building/linux.html
|
||||
lapackblas = LibraryList('')
|
||||
if '+lapack' in spec:
|
||||
lapackblas += spec['lapack'].lapack_libs
|
||||
lapackblas += spec['lapack'].libs
|
||||
|
||||
if '+blas' in spec:
|
||||
lapackblas += spec['blas'].blas_libs
|
||||
lapackblas += spec['blas'].libs
|
||||
|
||||
if '+blas' in spec or '+lapack' in spec:
|
||||
# note that one should not use [blas_opt] and [lapack_opt], see
|
||||
|
@@ -101,8 +101,8 @@ def install(self, spec, prefix):
|
||||
|
||||
# Make sure Spack's Blas/Lapack is used. Otherwise System's
|
||||
# Blas/Lapack might be picked up.
|
||||
blas = spec['blas'].blas_libs.ld_flags
|
||||
lapack = spec['lapack'].lapack_libs.ld_flags
|
||||
blas = spec['blas'].libs.ld_flags
|
||||
lapack = spec['lapack'].libs.ld_flags
|
||||
if '@4.5.1' in spec:
|
||||
# adding -lstdc++ is clearly an ugly way to do this, but it follows
|
||||
# with the TCOV path of SparseSuite 4.5.1's Suitesparse_config.mk
|
||||
|
@@ -80,8 +80,8 @@ def install(self, spec, prefix):
|
||||
cmake_args.extend([
|
||||
'-DLAPACK_ENABLE=ON',
|
||||
'-DLAPACK_LIBRARIES={0}'.format(
|
||||
(spec['lapack'].lapack_libs +
|
||||
spec['blas'].blas_libs).joined(';')
|
||||
(spec['lapack'].libs +
|
||||
spec['blas'].libs).joined(';')
|
||||
)
|
||||
])
|
||||
else:
|
||||
|
@@ -53,7 +53,7 @@ class SuperluDist(Package):
|
||||
depends_on('metis@5:')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
lapack_blas = spec['lapack'].lapack_libs + spec['blas'].blas_libs
|
||||
lapack_blas = spec['lapack'].libs + spec['blas'].libs
|
||||
makefile_inc = []
|
||||
makefile_inc.extend([
|
||||
'PLAT = _mac_x',
|
||||
@@ -61,17 +61,17 @@ def install(self, spec, prefix):
|
||||
'DSUPERLULIB = $(DSuperLUroot)/lib/libsuperlu_dist.a',
|
||||
'BLASDEF = -DUSE_VENDOR_BLAS',
|
||||
'BLASLIB = %s' % lapack_blas.ld_flags,
|
||||
'METISLIB = -L%s -lmetis' % spec['metis'].prefix.lib,
|
||||
'PARMETISLIB = -L%s -lparmetis' % spec['parmetis'].prefix.lib,
|
||||
'METISLIB = %s' % spec['metis'].libs.ld_flags,
|
||||
'PARMETISLIB = %s' % spec['parmetis'].libs.ld_flags,
|
||||
'FLIBS =',
|
||||
'LIBS = $(DSUPERLULIB) $(BLASLIB) $(PARMETISLIB) $(METISLIB)', # noqa
|
||||
'ARCH = ar',
|
||||
'ARCHFLAGS = cr',
|
||||
'RANLIB = true',
|
||||
'CC = {0}'.format(self.spec['mpi'].mpicc),
|
||||
'CFLAGS = -fPIC -std=c99 -O2 -I%s -I%s %s' % (
|
||||
spec['parmetis'].prefix.include,
|
||||
spec['metis'].prefix.include,
|
||||
'CFLAGS = -fPIC -std=c99 -O2 %s %s %s' % (
|
||||
spec['parmetis'].cppflags,
|
||||
spec['metis'].cppflags,
|
||||
'-D_LONGINT' if '+int64' in spec else ''),
|
||||
'NOOPTS = -fPIC -std=c99',
|
||||
'FORTRAN = {0}'.format(self.spec['mpi'].mpif77),
|
||||
|
@@ -86,7 +86,7 @@ def configure(self, spec):
|
||||
if '+blas' in spec:
|
||||
config.extend([
|
||||
'BLASDEF = -DUSE_VENDOR_BLAS',
|
||||
'BLASLIB = {0}'.format(spec['blas'].blas_libs.ld_flags)
|
||||
'BLASLIB = {0}'.format(spec['blas'].libs.ld_flags)
|
||||
])
|
||||
else:
|
||||
config.append('BLASLIB = ../lib/libblas$(PLAT).a')
|
||||
|
@@ -48,7 +48,7 @@ class Superlu(Package):
|
||||
def install(self, spec, prefix):
|
||||
cmake_args = [
|
||||
'-Denable_blaslib=OFF',
|
||||
'-DBLAS_blas_LIBRARY={0}'.format(spec['blas'].blas_libs.joined())
|
||||
'-DBLAS_blas_LIBRARY={0}'.format(spec['blas'].libs.joined())
|
||||
]
|
||||
|
||||
if '+fpic' in spec:
|
||||
@@ -76,7 +76,7 @@ def install(self, spec, prefix):
|
||||
'SUPERLULIB = $(SuperLUroot)/lib/libsuperlu_{0}.a' \
|
||||
.format(self.spec.version),
|
||||
'BLASDEF = -DUSE_VENDOR_BLAS',
|
||||
'BLASLIB = {0}'.format(spec['blas'].blas_libs.ld_flags),
|
||||
'BLASLIB = {0}'.format(spec['blas'].libs.ld_flags),
|
||||
# or BLASLIB = -L/usr/lib64 -lblas
|
||||
'TMGLIB = libtmglib.a',
|
||||
'LIBS = $(SUPERLULIB) $(BLASLIB)',
|
||||
|
@@ -147,8 +147,8 @@ def cmake_args(self):
|
||||
|
||||
mpi_bin = spec['mpi'].prefix.bin
|
||||
# Note: -DXYZ_LIBRARY_NAMES= needs semicolon separated list of names
|
||||
blas = spec['blas'].blas_libs
|
||||
lapack = spec['lapack'].lapack_libs
|
||||
blas = spec['blas'].libs
|
||||
lapack = spec['lapack'].libs
|
||||
options.extend([
|
||||
'-DTrilinos_ENABLE_ALL_PACKAGES:BOOL=ON',
|
||||
'-DTrilinos_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=ON',
|
||||
|
@@ -44,17 +44,12 @@ class Veclibfort(Package):
|
||||
provides('blas')
|
||||
provides('lapack')
|
||||
|
||||
@property
|
||||
def blas_libs(self):
|
||||
def libs(self):
|
||||
shared = True if '+shared' in self.spec else False
|
||||
return find_libraries(
|
||||
['libvecLibFort'], root=self.prefix, shared=shared, recurse=True
|
||||
)
|
||||
|
||||
@property
|
||||
def lapack_libs(self):
|
||||
return self.blas_libs
|
||||
|
||||
def install(self, spec, prefix):
|
||||
if sys.platform != 'darwin':
|
||||
raise InstallError('vecLibFort can be installed on macOS only')
|
||||
@@ -65,6 +60,6 @@ def install(self, spec, prefix):
|
||||
# test
|
||||
fc = which('fc')
|
||||
flags = ['-o', 'tester', '-O', 'tester.f90']
|
||||
flags.extend(self.lapack_libs.ld_flags.split())
|
||||
flags.extend(spec.libs.ld_flags.split())
|
||||
fc(*flags)
|
||||
Executable('./tester')()
|
||||
|
@@ -47,8 +47,8 @@ class Wannier90(Package):
|
||||
|
||||
def install(self, spec, prefix):
|
||||
|
||||
lapack = self.spec['lapack'].lapack_libs
|
||||
blas = self.spec['blas'].blas_libs
|
||||
lapack = self.spec['lapack'].libs
|
||||
blas = self.spec['blas'].libs
|
||||
substitutions = {
|
||||
'@F90': spack_fc,
|
||||
'@MPIF90': self.spec['mpi'].mpifc,
|
||||
|
Reference in New Issue
Block a user