Skip to content
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

update numpy easyblock for v1.26+ #3041

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
50 changes: 49 additions & 1 deletion easybuild/easyblocks/n/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,31 @@ def get_libs_for_mkl(varname):
cmd = "%s setup.py config" % self.python_cmd
run_cmd(cmd, log_all=True, simple=True)

if LooseVersion(self.version) >= LooseVersion('1.26'):
# control BLAS/LAPACK library being used
# see https://github.com/numpy/numpy/blob/v1.26.2/doc/source/release/1.26.1-notes.rst#build-system-changes
# and 'blas-order' in https://github.com/numpy/numpy/blob/v1.26.2/meson_options.txt
blas_lapack_names = {
toolchain.BLIS: 'blis',
toolchain.FLEXIBLAS: 'flexiblas',
toolchain.LAPACK: 'lapack',
toolchain.INTELMKL: 'mkl',
toolchain.OPENBLAS: 'openblas',
}
blas_family = self.toolchain.blas_family()
if blas_family in blas_lapack_names:
self.cfg.update('installopts', "-Csetup-args=-Dblas=" + blas_lapack_names[blas_family])
else:
raise EasyBuildError("Unknown BLAS library for numpy %s: %s", self.version, blas_family)

lapack_family = self.toolchain.lapack_family()
if lapack_family in blas_lapack_names:
self.cfg.update('installopts', "-Csetup-args=-Dlapack=" + blas_lapack_names[lapack_family])
else:
raise EasyBuildError("Unknown LAPACK library for numpy %s: %s", self.version, lapack_family)

self.cfg.update('installopts', "-Csetup-args=-Dallow-noblas=false")

def test_step(self):
"""Run available numpy unit tests, and more."""

Expand Down Expand Up @@ -332,7 +357,30 @@ def sanity_check_step(self, *args, **kwargs):

custom_commands = []

if LooseVersion(self.version) >= LooseVersion("1.10"):
if LooseVersion(self.version) >= LooseVersion('1.26'):
# make sure BLAS library was found
blas_check_pytxt = '; '.join([
"import numpy",
"numpy_config = numpy.show_config(mode='dicts')",
"numpy_build_deps = numpy_config['Build Dependencies']",
"blas_found = numpy_build_deps['blas']['found']",
"assert blas_found",
])
custom_commands.append('python -c "%s"' % blas_check_pytxt)

# if FlexiBLAS is used, make sure we are linking to it
# (rather than directly to a backend library like OpenBLAS or Intel MKL)
if self.toolchain.blas_family() == toolchain.FLEXIBLAS:
blas_check_pytxt = '; '.join([
"import numpy",
"numpy_config = numpy.show_config(mode='dicts')",
"numpy_build_deps = numpy_config['Build Dependencies']",
"blas_name = numpy_build_deps['blas']['name']",
"assert blas_name == 'flexiblas', 'BLAS library should be flexiblas, found %s' % blas_name",
])
custom_commands.append('python -c "%s"' % blas_check_pytxt)

elif LooseVersion(self.version) >= LooseVersion('1.10'):
# generic check to see whether numpy v1.10.x and up was built against a CBLAS-enabled library
# cfr. https://github.com/numpy/numpy/issues/6675#issuecomment-162601149
blas_check_pytxt = '; '.join([
Expand Down
Loading