fix formatting
This commit is contained in:
parent
361b629034
commit
eba264fcd0
@ -25,7 +25,8 @@
|
|||||||
from spack import *
|
from spack import *
|
||||||
import os
|
import os
|
||||||
|
|
||||||
def compile_c_and_execute(source_file,include_flags, link_flags):
|
|
||||||
|
def compile_c_and_execute(source_file, include_flags, link_flags):
|
||||||
"""Compile C @p source_file with @p include_flags and @p link_flags,
|
"""Compile C @p source_file with @p include_flags and @p link_flags,
|
||||||
run and return the output.
|
run and return the output.
|
||||||
"""
|
"""
|
||||||
@ -46,14 +47,15 @@ def compare_output(current_output, blessed_output):
|
|||||||
if not (current_output == blessed_output):
|
if not (current_output == blessed_output):
|
||||||
print "Produced output does not match expected output."
|
print "Produced output does not match expected output."
|
||||||
print "Expected output:"
|
print "Expected output:"
|
||||||
print '-'*80
|
print '-' * 80
|
||||||
print blessed_output
|
print blessed_output
|
||||||
print '-'*80
|
print '-' * 80
|
||||||
print "Produced output:"
|
print "Produced output:"
|
||||||
print '-'*80
|
print '-' * 80
|
||||||
print current_output
|
print current_output
|
||||||
print '-'*80
|
print '-' * 80
|
||||||
raise RuntimeError("Ouput check failed. See spack_output.log for details")
|
raise RuntimeError("Ouput check failed.",
|
||||||
|
"See spack_output.log for details")
|
||||||
|
|
||||||
|
|
||||||
def compare_output_file(current_output, blessed_output_file):
|
def compare_output_file(current_output, blessed_output_file):
|
||||||
@ -61,4 +63,4 @@ def compare_output_file(current_output, blessed_output_file):
|
|||||||
with open(blessed_output_file, 'r') as f:
|
with open(blessed_output_file, 'r') as f:
|
||||||
blessed_output = f.read()
|
blessed_output = f.read()
|
||||||
|
|
||||||
compare_output(current_output,blessed_output)
|
compare_output(current_output, blessed_output)
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
from spack import *
|
from spack import *
|
||||||
from spack.package_test import *
|
from spack.package_test import *
|
||||||
import sys
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
|
||||||
|
|
||||||
class Openblas(Package):
|
class Openblas(Package):
|
||||||
"""OpenBLAS: An optimized BLAS library"""
|
"""OpenBLAS: An optimized BLAS library"""
|
||||||
@ -14,9 +13,9 @@ class Openblas(Package):
|
|||||||
version('0.2.16', 'fef46ab92463bdbb1479dcec594ef6dc')
|
version('0.2.16', 'fef46ab92463bdbb1479dcec594ef6dc')
|
||||||
version('0.2.15', 'b1190f3d3471685f17cfd1ec1d252ac9')
|
version('0.2.15', 'b1190f3d3471685f17cfd1ec1d252ac9')
|
||||||
|
|
||||||
variant('shared', default=True, description="Build shared libraries as well as static libs.")
|
variant('shared', default=True, description="Build shared libraries as well as static libs.") # NOQA: ignore=E501
|
||||||
variant('openmp', default=False, description="Enable OpenMP support.")
|
variant('openmp', default=False, description="Enable OpenMP support.")
|
||||||
variant('fpic', default=True, description="Build position independent code")
|
variant('fpic', default=True, description="Build position independent code") # NOQA: ignore=E501
|
||||||
|
|
||||||
# virtual dependency
|
# virtual dependency
|
||||||
provides('blas')
|
provides('blas')
|
||||||
@ -48,11 +47,11 @@ def install(self, spec, prefix):
|
|||||||
|
|
||||||
# Add support for OpenMP
|
# Add support for OpenMP
|
||||||
if '+openmp' in spec:
|
if '+openmp' in spec:
|
||||||
# Note: Apple's most recent Clang 7.3.0 still does not support OpenMP.
|
# Openblas (as of 0.2.18) hardcoded that OpenMP cannot
|
||||||
# What is worse, Openblas (as of 0.2.18) hardcoded that OpenMP cannot
|
|
||||||
# be used with any (!) compiler named clang, bummer.
|
# be used with any (!) compiler named clang, bummer.
|
||||||
if spec.satisfies('%clang'):
|
if spec.satisfies('%clang'):
|
||||||
raise InstallError('OpenBLAS does not support OpenMP with clang!')
|
raise InstallError('OpenBLAS does not support ',
|
||||||
|
'OpenMP with clang!')
|
||||||
|
|
||||||
make_defs += ['USE_OPENMP=1']
|
make_defs += ['USE_OPENMP=1']
|
||||||
|
|
||||||
@ -69,29 +68,34 @@ def install(self, spec, prefix):
|
|||||||
symlink('libopenblas.a', 'blas.a')
|
symlink('libopenblas.a', 'blas.a')
|
||||||
symlink('libopenblas.a', 'libblas.a')
|
symlink('libopenblas.a', 'libblas.a')
|
||||||
if '+shared' in spec:
|
if '+shared' in spec:
|
||||||
symlink('libopenblas.%s' % dso_suffix, 'libblas.%s' % dso_suffix)
|
symlink('libopenblas.%s' % dso_suffix,
|
||||||
|
'libblas.%s' % dso_suffix)
|
||||||
|
|
||||||
# Lapack virtual package should provide liblapack.a
|
# Lapack virtual package should provide liblapack.a
|
||||||
with working_dir(prefix.lib):
|
with working_dir(prefix.lib):
|
||||||
symlink('libopenblas.a', 'liblapack.a')
|
symlink('libopenblas.a', 'liblapack.a')
|
||||||
if '+shared' in spec:
|
if '+shared' in spec:
|
||||||
symlink('libopenblas.%s' % dso_suffix, 'liblapack.%s' % dso_suffix)
|
symlink('libopenblas.%s' % dso_suffix,
|
||||||
|
'liblapack.%s' % dso_suffix)
|
||||||
|
|
||||||
# Openblas may pass its own test but still fail to compile Lapack
|
# Openblas may pass its own test but still fail to compile Lapack
|
||||||
# symbols. To make sure we get working Blas and Lapack, do a small test.
|
# symbols. To make sure we get working Blas and Lapack, do a small
|
||||||
|
# test.
|
||||||
self.check_install(spec)
|
self.check_install(spec)
|
||||||
|
|
||||||
|
|
||||||
def setup_dependent_package(self, module, dspec):
|
def setup_dependent_package(self, module, dspec):
|
||||||
# This is WIP for a prototype interface for virtual packages.
|
# This is WIP for a prototype interface for virtual packages.
|
||||||
# We can update this as more builds start depending on BLAS/LAPACK.
|
# We can update this as more builds start depending on BLAS/LAPACK.
|
||||||
libdir = find_library_path('libopenblas.a', self.prefix.lib64, self.prefix.lib)
|
libdir = find_library_path('libopenblas.a',
|
||||||
|
self.prefix.lib64,
|
||||||
|
self.prefix.lib)
|
||||||
|
|
||||||
self.spec.blas_static_lib = join_path(libdir, 'libopenblas.a')
|
self.spec.blas_static_lib = join_path(libdir, 'libopenblas.a')
|
||||||
self.spec.lapack_static_lib = self.spec.blas_static_lib
|
self.spec.lapack_static_lib = self.spec.blas_static_lib
|
||||||
|
|
||||||
if '+shared' in self.spec:
|
if '+shared' in self.spec:
|
||||||
self.spec.blas_shared_lib = join_path(libdir, 'libopenblas.%s' % dso_suffix)
|
self.spec.blas_shared_lib = join_path(libdir, 'libopenblas.%s' %
|
||||||
|
dso_suffix)
|
||||||
self.spec.lapack_shared_lib = self.spec.blas_shared_lib
|
self.spec.lapack_shared_lib = self.spec.blas_shared_lib
|
||||||
|
|
||||||
def check_install(self, spec):
|
def check_install(self, spec):
|
||||||
@ -108,5 +112,5 @@ def check_install(self, spec):
|
|||||||
if '+openmp' in spec:
|
if '+openmp' in spec:
|
||||||
link_flags.extend([self.compiler.openmp_flag])
|
link_flags.extend([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)
|
||||||
compare_output_file(output,blessed_file)
|
compare_output_file(output, blessed_file)
|
||||||
|
Loading…
Reference in New Issue
Block a user