8000 BLD: check for CBLAS header in "unoptimized" blas by juliantaylor · Pull Request #3 · charris/numpy · GitHub
[go: up one dir, main page]

Skip to content

BLD: check for CBLAS header in "unoptimized" blas #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion numpy/distutils/system_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -1560,9 +1560,33 @@ def calc_info(self):
info = self.check_libs(lib_dirs, blas_libs, [])
if info is None:
return
info['language'] = 'f77' # XXX: is it generally true?
if self.has_cblas():
info['language'] = 'c'
info['d 8000 efine_macros'] = [('HAVE_CBLAS', None)]
else:
info['language'] = 'f77' # XXX: is it generally true?
self.set_info(**info)

def has_cblas(self):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks OK.

# primitive cblas check by looking for the header
res = False
c = distutils.ccompiler.new_compiler()
tmpdir = tempfile.mkdtemp()
s = """#include <cblas.h>"""
src = os.path.join(tmpdir, 'source.c')
try:
with open(src, 'wt') as f:
f.write(s)
try:
c.compile([src], output_dir=tmpdir,
include_dirs=self.get_include_dirs())
res = True
except distutils.ccompiler.CompileError:
res = False
finally:
shutil.rmtree(tmpdir)
return res


class openblas_info(blas_info):
section = 'openblas'
Expand Down
0