Skip to content

Commit

Permalink
Merge pull request #3041 from boegel/20231124203624_new_pr_numpy
Browse files Browse the repository at this point in the history
update numpy easyblock for v1.26+
  • Loading branch information
bartoldeman committed Nov 25, 2023
2 parents 2e0b1f3 + f9b544a commit 1b74661
Showing 1 changed file with 49 additions and 1 deletion.
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

0 comments on commit 1b74661

Please sign in to comment.