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

@@ -51,6 +51,7 @@ class Atlas(Package):
url='http://sourceforge.net/projects/math-atlas/files/Developer%20%28unstable%29/3.11.34/atlas3.11.34.tar.bz2')
variant('shared', default=True, description='Builds shared library')
variant('pthread', default=False, description='Use multithreaded libraries')
provides('blas')
provides('lapack')
@@ -107,18 +108,32 @@ def install(self, spec, prefix):
make("install")
self.install_test()
def setup_dependent_package(self, module, dspec):
@property
def blas_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.
name = 'libsatlas.%s' % dso_suffix
libdir = find_library_path(name,
self.prefix.lib64,
self.prefix.lib)
is_threaded = '+pthread' in self.spec
if '+shared' in self.spec:
self.spec.blas_shared_lib = join_path(libdir, name)
self.spec.lapack_shared_lib = self.spec.blas_shared_lib
to_find = ['libtatlas'] if is_threaded else ['libsatlas']
shared = True
else:
interfaces = [
'libptcblas',
'libptf77blas'
] if is_threaded else [
'libcblas',
'libf77blas'
]
to_find = ['liblapack'] + interfaces + ['libatlas']
shared = False
return find_libraries(
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__),
@@ -126,9 +141,8 @@ def install_test(self):
blessed_file = join_path(os.path.dirname(self.module.__file__),
'test_cblas_dgemm.output')
include_flags = ["-I%s" % join_path(self.spec.prefix, "include")]
link_flags = ["-L%s" % join_path(self.spec.prefix, "lib"),
"-lsatlas"]
include_flags = ["-I%s" % self.spec.prefix.include]
link_flags = self.lapack_libs.ld_flags
output = compile_c_and_execute(source_file, include_flags, link_flags)
compare_output_file(output, blessed_file)