| 1 |
project('test blas and lapack', 'c') |
| 2 |
|
| 3 |
# OpenBLAS LP64 and ILP64 |
| 4 |
openblas_dep = dependency('openblas', |
| 5 |
modules: [ |
| 6 |
'interface: lp64', |
| 7 |
'cblas', |
| 8 |
'lapack', |
| 9 |
], |
| 10 |
required: false, |
| 11 |
) |
| 12 |
openblas64_dep = dependency('openblas', |
| 13 |
modules: [ |
| 14 |
'interface: ilp64', |
| 15 |
'cblas', |
| 16 |
'lapack', |
| 17 |
], |
| 18 |
required: false, |
| 19 |
) |
| 20 |
|
| 21 |
# Accelerate LP64 and ILP64 |
| 22 |
accelerate_dep = dependency('accelerate', |
| 23 |
modules: [ |
| 24 |
'interface: lp64', |
| 25 |
'cblas', |
| 26 |
'lapack', |
| 27 |
], |
| 28 |
required: false, |
| 29 |
) |
| 30 |
accelerate64_dep = dependency('accelerate', |
| 31 |
modules: [ |
| 32 |
'interface: ilp64', |
| 33 |
'cblas', |
| 34 |
'lapack', |
| 35 |
], |
| 36 |
required: false, |
| 37 |
) |
| 38 |
|
| 39 |
# MKL LP64 and ILP64 |
| 40 |
mkl_dep = dependency('mkl', |
| 41 |
modules: [ |
| 42 |
'interface: lp64', |
| 43 |
'cblas', |
| 44 |
'lapack', |
| 45 |
], |
| 46 |
required: false, |
| 47 |
) |
| 48 |
mkl64_dep = dependency('mkl', |
| 49 |
modules: [ |
| 50 |
'interface: ilp64', |
| 51 |
'cblas', |
| 52 |
'lapack', |
| 53 |
], |
| 54 |
required: false, |
| 55 |
) |
| 56 |
|
| 57 |
|
| 58 |
if not openblas_dep.found() and not openblas64_dep.found() and not accelerate_dep.found() and not mkl_dep.found() |
| 59 |
error('MESON_SKIP_TEST: no BLAS/LAPACK libraries available') |
| 60 |
endif |
| 61 |
|
| 62 |
deps = { |
| 63 |
'openblas': openblas_dep, |
| 64 |
'openblas64': openblas64_dep, |
| 65 |
'accelerate': accelerate_dep, |
| 66 |
'accelerate64': accelerate64_dep, |
| 67 |
'mkl': mkl_dep, |
| 68 |
'mkl64': mkl64_dep, |
| 69 |
} |
| 70 |
|
| 71 |
foreach name, dep : deps |
| 72 |
if dep.found() |
| 73 |
blas_interface = dep.get_variable('interface') |
| 74 |
symbol_suffix = dep.get_variable('symbol_suffix') |
| 75 |
blas_c_args = ['-DBLAS_SYMBOL_SUFFIX=' + symbol_suffix] |
| 76 |
if blas_interface == 'ilp64' |
| 77 |
blas_c_args += ['-DHAVE_BLAS_ILP64'] |
| 78 |
if 'openblas' in dep.name() |
| 79 |
blas_c_args += ['-DOPENBLAS_ILP64_NAMING_SCHEME'] |
| 80 |
endif |
| 81 |
elif blas_interface != 'lp64' |
| 82 |
error(f'no interface var for %name% dependency!') |
| 83 |
endif |
| 84 |
|
| 85 |
c_exe = executable('cblas_lapack_c_' + blas_interface, |
| 86 |
'cblas_lapack.c', |
| 87 |
c_args: blas_c_args, |
| 88 |
dependencies: [dep] |
| 89 |
) |
| 90 |
test('cblas_lapack_dep_c', c_exe, timeout: 30) |
| 91 |
|
| 92 |
if add_languages('fortran', required: false) |
| 93 |
f_exe = executable('cblas_lapack_fortran_' + blas_interface, |
| 94 |
'main.f90', |
| 95 |
dependencies: [dep] |
| 96 |
) |
| 97 |
test('cblas_lapack_dep_fortran', f_exe, timeout: 30) |
| 98 |
endif |
| 99 |
endif |
| 100 |
endforeach |