diff options
author | Nick Papior <nickpapior@gmail.com> | 2015-09-17 22:00:12 +0000 |
---|---|---|
committer | Nick Papior <nickpapior@gmail.com> | 2015-09-17 22:00:12 +0000 |
commit | 62e87ab001710bcafa54786a2b3d413f77398066 (patch) | |
tree | 442157e5374663e5f9e94ec287bfcb8e9315ccb3 /numpy | |
parent | 772c80b1ce1db7e30497fcf555ac9af56b0d7fce (diff) | |
download | numpy-62e87ab001710bcafa54786a2b3d413f77398066.tar.gz |
ENH: enabled extra_link_args in OpenBLAS segment
The extra_link_args is sadly not intrinsically used
for many parts of the system_info code.
This commit adds the linking properties stored
when using extra_link_args in the openblas section
to bypass any difficulties in the usage of OpenBLAS.
This is especially helpful when linking against external
LAPACK libraries which requires -lgfortran and possibly
-lm for correct linking.
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/distutils/system_info.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py index 90c053298..be94c8704 100644 --- a/numpy/distutils/system_info.py +++ b/numpy/distutils/system_info.py @@ -1703,6 +1703,10 @@ class openblas_info(blas_info): if info is None: return + # Add extra info for OpenBLAS + extra_info = self.calc_extra_info() + dict_append(info, **extra_info) + if not self.check_embedded_lapack(info): return @@ -1729,13 +1733,19 @@ class openblas_lapack_info(openblas_info): }""" src = os.path.join(tmpdir, 'source.c') out = os.path.join(tmpdir, 'a.out') + # Add the additional "extra" arguments + try: + extra_args = info['extra_link_args'] + except: + extra_args = [] try: with open(src, 'wt') as f: f.write(s) obj = c.compile([src], output_dir=tmpdir) try: c.link_executable(obj, out, libraries=info['libraries'], - library_dirs=info['library_dirs']) + library_dirs=info['library_dirs'], + extra_postargs=extra_args) res = True except distutils.ccompiler.LinkError: res = False @@ -1752,7 +1762,8 @@ class openblas_lapack_info(openblas_info): obj = c.compile([src], output_dir=tmpdir) try: c.link_executable(obj, out, libraries=info['libraries'], - library_dirs=info['library_dirs']) + library_dirs=info['library_dirs'], + extra_postargs=extra_args) res = True except distutils.ccompiler.LinkError: res = False |