Reworking of lapack_shared_libs and similar properties (#1682)

* Turned <provider>_libs into an iterable

Modifications :
- added class LibraryList + unit tests
- added convenience functions `find_libraries` and `dedupe`
- modifed non Intel blas/lapack providers
- modified packages using blas_shared_libs and similar functions

* atlas : added pthread variant

* intel packages : added lapack_libs and blas_libs

* find_library_path : removed unused function

* PR review : fixed last issues

* LibraryList : added test on __add__ return type

* LibraryList : added __radd__ fixed unit tests

fix : failing unit tests due to missing `self`

* cp2k and dependecies : fixed blas-lapack related statements in package.py
This commit is contained in:
Massimiliano Culpo
2016-09-21 21:27:59 +02:00
committed by Todd Gamblin
parent 6b6f868f2a
commit d848559f70
33 changed files with 526 additions and 244 deletions

View File

@@ -28,10 +28,11 @@
class NetlibScalapack(Package):
"""ScaLAPACK is a library of high-performance linear algebra routines for
parallel distributed memory machines"""
parallel distributed memory machines
"""
homepage = "http://www.netlib.org/scalapack/"
url = "http://www.netlib.org/scalapack/scalapack-2.0.2.tgz"
url = "http://www.netlib.org/scalapack/scalapack-2.0.2.tgz"
version('2.0.2', '2f75e600a2ba155ed9ce974a1c4b536f')
version('2.0.1', '17b8cde589ea0423afe1ec43e7499161')
@@ -39,10 +40,16 @@ class NetlibScalapack(Package):
# versions before 2.0.0 are not using cmake and requires blacs as
# a separated package
variant('shared', default=True,
description='Build the shared library version')
variant('fpic', default=False,
description="Build with -fpic compiler option")
variant(
'shared',
default=True,
description='Build the shared library version'
)
variant(
'fpic',
default=False,
description='Build with -fpic compiler option'
)
provides('scalapack')
@@ -51,6 +58,13 @@ class NetlibScalapack(Package):
depends_on('blas')
depends_on('cmake', when='@2.0.0:', type='build')
@property
def scalapack_libs(self):
shared = True if '+shared' in self.spec else False
return find_libraries(
['libscalapack'], root=self.prefix, shared=shared, recurse=True
)
def install(self, spec, prefix):
options = [
"-DBUILD_SHARED_LIBS:BOOL=%s" % ('ON' if '+shared' in spec else
@@ -60,14 +74,13 @@ def install(self, spec, prefix):
]
# Make sure we use Spack's Lapack:
blas = spec['blas'].blas_libs
lapack = spec['lapack'].lapack_libs
options.extend([
'-DLAPACK_FOUND=true',
'-DLAPACK_LIBRARIES=%s' % (
spec['lapack'].lapack_shared_lib if '+shared' in spec else
spec['lapack'].lapack_static_lib),
'-DBLAS_LIBRARIES=%s' % (
spec['blas'].blas_shared_lib if '+shared' in spec else
spec['blas'].blas_static_lib)
'-DLAPACK_INCLUDE_DIRS=%s' % spec['lapack'].prefix.include,
'-DLAPACK_LIBRARIES=%s' % (lapack.joined()),
'-DBLAS_LIBRARIES=%s' % (blas.joined())
])
if '+fpic' in spec:
@@ -86,12 +99,3 @@ def install(self, spec, prefix):
# The shared libraries are not installed correctly on Darwin:
if (sys.platform == 'darwin') and ('+shared' in spec):
fix_darwin_install_name(prefix.lib)
def setup_dependent_package(self, module, dependent_spec):
spec = self.spec
lib_suffix = dso_suffix if '+shared' in spec else 'a'
spec.fc_link = '-L%s -lscalapack' % spec.prefix.lib
spec.cc_link = spec.fc_link
spec.libraries = [join_path(spec.prefix.lib,
'libscalapack.%s' % lib_suffix)]