openblas: add "locking" variant, updated blaspp (#21770)
BlasPP by ECP SLATE will fail to install by default (`spack install blaspp`) because: - the default BLAS installation in Spack is OpenBLAS - BlasPP conflicts with `threads=none` for all recent OpenBLAS releases OpenBLAS introduced a threadsafe compile option with 0.3.7+ aka `USE_LOCKING`: ``` 61 # If you want to build a single-threaded OpenBLAS, but expect to call this 62 # from several concurrent threads in some other program, comment this in for 63 # thread safety. (This is done automatically for USE_THREAD=1 , and should not 64 # be necessary when USE_OPENMP=1) 65 # USE_LOCKING = 1 ``` According to tests, with `spack install --test root blaspp`, this exactly addresses the issues in BlasPP tests. It also seems to be a good option to set by default for OpenBLAS and users that do not need this safety net can always disable it. Solve issues with newer OpenBLAS by requiring `+locking` over none-default threading options.
This commit is contained in:
parent
7226bd64dc
commit
bcc370102f
@ -29,8 +29,13 @@ class Blaspp(CMakePackage, CudaPackage):
|
|||||||
depends_on('cmake@3.15.0:', type='build')
|
depends_on('cmake@3.15.0:', type='build')
|
||||||
depends_on('blas')
|
depends_on('blas')
|
||||||
|
|
||||||
|
# only supported with clingo solver: virtual dependency preferences
|
||||||
|
# depends_on('openblas threads=openmp', when='+openmp ^openblas')
|
||||||
|
|
||||||
# BLASpp tests will fail when using openblas > 0.3.5 without multithreading support
|
# BLASpp tests will fail when using openblas > 0.3.5 without multithreading support
|
||||||
conflicts('^openblas@0.3.6: threads=none', msg='BLASpp requires openblas multithreading support')
|
# locking is only supported in openblas 3.7+
|
||||||
|
conflicts('^openblas@0.3.6 threads=none', msg='BLASpp requires a threadsafe openblas')
|
||||||
|
conflicts('^openblas@0.3.7: ~locking', msg='BLASpp requires a threadsafe openblas')
|
||||||
|
|
||||||
def cmake_args(self):
|
def cmake_args(self):
|
||||||
spec = self.spec
|
spec = self.spec
|
||||||
|
@ -44,6 +44,7 @@ class Openblas(MakefilePackage):
|
|||||||
variant('shared', default=True, description='Build shared libraries')
|
variant('shared', default=True, description='Build shared libraries')
|
||||||
variant('consistent_fpcsr', default=False, description='Synchronize FP CSR between threads (x86/x86_64 only)')
|
variant('consistent_fpcsr', default=False, description='Synchronize FP CSR between threads (x86/x86_64 only)')
|
||||||
|
|
||||||
|
variant('locking', default=True, description='Build with thread safety')
|
||||||
variant(
|
variant(
|
||||||
'threads', default='none',
|
'threads', default='none',
|
||||||
description='Multithreading support',
|
description='Multithreading support',
|
||||||
@ -126,6 +127,7 @@ class Openblas(MakefilePackage):
|
|||||||
conflicts('+consistent_fpcsr', when='threads=none',
|
conflicts('+consistent_fpcsr', when='threads=none',
|
||||||
msg='FPCSR consistency only applies to multithreading')
|
msg='FPCSR consistency only applies to multithreading')
|
||||||
|
|
||||||
|
conflicts('threads=pthreads', when='~locking', msg='Pthread support requires +locking')
|
||||||
conflicts('threads=openmp', when='%apple-clang', msg="Apple's clang does not support OpenMP")
|
conflicts('threads=openmp', when='%apple-clang', msg="Apple's clang does not support OpenMP")
|
||||||
conflicts('threads=openmp @:0.2.19', when='%clang', msg='OpenBLAS @:0.2.19 does not support OpenMP with clang!')
|
conflicts('threads=openmp @:0.2.19', when='%clang', msg='OpenBLAS @:0.2.19 does not support OpenMP with clang!')
|
||||||
|
|
||||||
@ -255,6 +257,13 @@ def make_defs(self):
|
|||||||
if self.spec.satisfies('@0.2.16'):
|
if self.spec.satisfies('@0.2.16'):
|
||||||
make_defs += ['BUILD_LAPACK_DEPRECATED=1']
|
make_defs += ['BUILD_LAPACK_DEPRECATED=1']
|
||||||
|
|
||||||
|
# serial, but still thread-safe version
|
||||||
|
if self.spec.satisfies('@0.3.7:'):
|
||||||
|
if '+locking' in self.spec:
|
||||||
|
make_defs += ['USE_LOCKING=1']
|
||||||
|
else:
|
||||||
|
make_defs += ['USE_LOCKING=0']
|
||||||
|
|
||||||
# Add support for multithreading
|
# Add support for multithreading
|
||||||
if self.spec.satisfies('threads=openmp'):
|
if self.spec.satisfies('threads=openmp'):
|
||||||
make_defs += ['USE_OPENMP=1', 'USE_THREAD=1']
|
make_defs += ['USE_OPENMP=1', 'USE_THREAD=1']
|
||||||
|
Loading…
Reference in New Issue
Block a user