suite-sparse package: add support for blas symbol suffix (#27510)

This commit is contained in:
Harmen Stoppels 2021-11-22 22:18:39 +01:00 committed by GitHub
parent 6f8fd5b7a7
commit abec10fcd5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -70,6 +70,30 @@ class SuiteSparse(Package):
conflicts('%gcc@:4.8', when='@5.2.0:', msg='gcc version must be at least 4.9 for suite-sparse@5.2.0:') conflicts('%gcc@:4.8', when='@5.2.0:', msg='gcc version must be at least 4.9 for suite-sparse@5.2.0:')
def symbol_suffix_blas(self, spec, args):
"""When using BLAS with a special symbol suffix we use defines to
replace blas symbols, e.g. dgemm_ becomes dgemm_64_ when
symbol_suffix=64_."""
# Currently only OpenBLAS does this.
if not spec.satisfies('^openblas'):
return
suffix = spec['openblas'].variants['symbol_suffix'].value
if suffix == 'none':
return
symbols = (
'dtrsv_', 'dgemv_', 'dtrsm_', 'dgemm_', 'dsyrk_', 'dger_', 'dscal_',
'dpotrf_', 'ztrsv_', 'zgemv_', 'ztrsm_', 'zgemm_', 'zherk_',
'zgeru_', 'zscal_', 'zpotrf_',
'dnrm2_', 'dlarf_', 'dlarfg_', 'dlarft_', 'dlarfb_', 'dznrm2_',
'zlarf_', 'zlarfg_', 'zlarft_', 'zlarfb_'
)
for symbol in symbols:
args.append('CFLAGS+=-D{0}={1}{2}'.format(symbol, symbol, suffix))
def install(self, spec, prefix): def install(self, spec, prefix):
# The build system of SuiteSparse is quite old-fashioned. # The build system of SuiteSparse is quite old-fashioned.
# It's basically a plain Makefile which include an header # It's basically a plain Makefile which include an header
@ -125,6 +149,9 @@ def install(self, spec, prefix):
spec.satisfies('^intel-parallel-studio+mkl+ilp64')): spec.satisfies('^intel-parallel-studio+mkl+ilp64')):
make_args.append('UMFPACK_CONFIG=-DLONGBLAS="long long"') make_args.append('UMFPACK_CONFIG=-DLONGBLAS="long long"')
# Handle symbol suffix of some BLAS'es (e.g. 64_ or _64 for ilp64)
self.symbol_suffix_blas(spec, make_args)
# SuiteSparse defaults to using '-fno-common -fexceptions' in # SuiteSparse defaults to using '-fno-common -fexceptions' in
# CFLAGS, but not all compilers use the same flags for these # CFLAGS, but not all compilers use the same flags for these
# optimizations # optimizations