summaryrefslogtreecommitdiff
path: root/tools/openblas_support.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/openblas_support.py')
-rw-r--r--tools/openblas_support.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/tools/openblas_support.py b/tools/openblas_support.py
index 460f36de5..297dc6436 100644
--- a/tools/openblas_support.py
+++ b/tools/openblas_support.py
@@ -192,6 +192,22 @@ def test_setup(arches):
raise RuntimeError('Could not setup %s' % arch)
print(target)
+def test_version(expected_version):
+ """
+ Assert that expected OpenBLAS version is
+ actually available via NumPy
+ """
+ import numpy
+ import ctypes
+
+ dll = ctypes.CDLL(numpy.core._multiarray_umath.__file__)
+ get_config = dll.openblas_get_config
+ get_config.restype=ctypes.c_char_p
+ res = get_config()
+ print('OpenBLAS get_config returned', str(res))
+ check_str = b'OpenBLAS %s' % expected_version[0].encode()
+ assert check_str in res
+
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser(
@@ -199,8 +215,12 @@ if __name__ == '__main__':
'architecture')
parser.add_argument('--test', nargs='*', default=None,
help='Test different architectures. "all", or any of %s' % ARCHITECTURES)
+ parser.add_argument('--check_version', nargs=1, default=None,
+ help='Check provided OpenBLAS version string against available OpenBLAS')
args = parser.parse_args()
- if args.test is None:
+ if args.check_version is not None:
+ test_version(args.check_version)
+ elif args.test is None:
print(setup_openblas())
else:
if len(args.test) == 0 or 'all' in args.test: