summaryrefslogtreecommitdiff
path: root/tools/openblas_support.py
diff options
context:
space:
mode:
authorTyler Reddy <tyler.je.reddy@gmail.com>2019-07-14 10:52:04 -0600
committerTyler Reddy <tyler.je.reddy@gmail.com>2019-07-14 16:25:45 -0600
commit2b504ea85c485f340bed0808793db1c45c89640a (patch)
treed634127b9db413ef154ab0dedeb4a0e4f8a4bffe /tools/openblas_support.py
parent3d4986fe7adb7c16f3c5c903d83a1480803c250e (diff)
downloadnumpy-2b504ea85c485f340bed0808793db1c45c89640a.tar.gz
TST, MAINT: expand OpenBLAS version checking
* add a function to tools/openblas_support.py that may be used to test OpenBLAS version available through NumPy in a manner agnostic to any specific CI service * expand OpenBLAS version checking to include ppc64le and POWER8 CI runs; a separate PR will be provided to bump these versions to 0.3.7.dev * OpenBLAS install was broken on ppc64le Travis CI after migration to tools/openblas_support.py; fixed that * Azure CI config no longer uses a single-line 280-character Python "program" assigned to an environment variable to check OpenBLAS version; instead, it now leverages tools/openblas_support.py to perform the same operation using a conventional Python function
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: