[py-numpy, py-scipy] Enable MKL & ARMpl (#34979)

This commit is contained in:
Stephen Sachs 2023-01-19 16:01:31 +01:00 committed by GitHub
parent a357a39963
commit 45ea7c19e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 10 deletions

View File

@ -1101,6 +1101,7 @@ def _setup_dependent_env_callback(self, env, dependent_spec, compilers_of_client
"CMAKE_PREFIX_PATH": self.normalize_path("mkl"), "CMAKE_PREFIX_PATH": self.normalize_path("mkl"),
"CMAKE_LIBRARY_PATH": self.component_lib_dir("mkl"), "CMAKE_LIBRARY_PATH": self.component_lib_dir("mkl"),
"CMAKE_INCLUDE_PATH": self.component_include_dir("mkl"), "CMAKE_INCLUDE_PATH": self.component_include_dir("mkl"),
"PKG_CONFIG_PATH": os.path.join(self.normalize_path("mkl"), "bin", "pkgconfig"),
} }
env.set("MKLROOT", env_mods["MKLROOT"]) env.set("MKLROOT", env_mods["MKLROOT"])
@ -1108,6 +1109,7 @@ def _setup_dependent_env_callback(self, env, dependent_spec, compilers_of_client
env.append_path("CMAKE_PREFIX_PATH", env_mods["CMAKE_PREFIX_PATH"]) env.append_path("CMAKE_PREFIX_PATH", env_mods["CMAKE_PREFIX_PATH"])
env.append_path("CMAKE_LIBRARY_PATH", env_mods["CMAKE_LIBRARY_PATH"]) env.append_path("CMAKE_LIBRARY_PATH", env_mods["CMAKE_LIBRARY_PATH"])
env.append_path("CMAKE_INCLUDE_PATH", env_mods["CMAKE_INCLUDE_PATH"]) env.append_path("CMAKE_INCLUDE_PATH", env_mods["CMAKE_INCLUDE_PATH"])
env.append_path("PKG_CONFIG_PATH", env_mods["PKG_CONFIG_PATH"])
debug_print("adding/modifying build env:", env_mods) debug_print("adding/modifying build env:", env_mods)

View File

@ -150,9 +150,9 @@ class PyNumpy(PythonPackage):
# NVHPC support added in https://github.com/numpy/numpy/pull/17344 # NVHPC support added in https://github.com/numpy/numpy/pull/17344
conflicts("%nvhpc", when="@:1.19") conflicts("%nvhpc", when="@:1.19")
# Newer versions will not build with Intel https://github.com/numpy/numpy/issues/22011 # See https://github.com/numpy/numpy/issues/22011
conflicts("%intel", when="@1.23.0:") conflicts("%intel", when="@1.23.0:1.23.3")
conflicts("%oneapi", when="@1.23.0:") conflicts("%oneapi", when="@1.23.0:1.23.3")
def url_for_version(self, version): def url_for_version(self, version):
url = "https://files.pythonhosted.org/packages/source/n/numpy/numpy-{}.{}" url = "https://files.pythonhosted.org/packages/source/n/numpy/numpy-{}.{}"
@ -314,6 +314,12 @@ def write_library_dirs(f, dirs):
f.write("include_dirs = {0}\n".format(lapack_header_dirs)) f.write("include_dirs = {0}\n".format(lapack_header_dirs))
f.write("extra_link_args = {0}\n".format(self.spec["lapack"].libs.ld_flags)) f.write("extra_link_args = {0}\n".format(self.spec["lapack"].libs.ld_flags))
if "^armpl-gcc" in spec:
f.write("[blas]\n")
f.write("libraries = {0}\n".format(lapackblas_lib_names))
write_library_dirs(f, lapackblas_lib_dirs)
f.write("include_dirs = {0}\n".format(lapackblas_header_dirs))
def setup_build_environment(self, env): def setup_build_environment(self, env):
# Tell numpy which BLAS/LAPACK libraries we want to use. # Tell numpy which BLAS/LAPACK libraries we want to use.
# https://github.com/numpy/numpy/pull/13132 # https://github.com/numpy/numpy/pull/13132

View File

@ -130,11 +130,6 @@ class PyScipy(PythonPackage):
# Meson adds this flag for all Python extensions which include Fortran code. # Meson adds this flag for all Python extensions which include Fortran code.
conflicts("%oneapi", when="@1.9:") conflicts("%oneapi", when="@1.9:")
# FIXME: mysterious build issues with MKL
conflicts("^intel-mkl", when="@1.9:")
conflicts("^intel-oneapi-mkl", when="@1.9:")
conflicts("^intel-parallel-studio", when="@1.9:")
# https://github.com/scipy/scipy/issues/12860 # https://github.com/scipy/scipy/issues/12860
patch( patch(
"https://git.sagemath.org/sage.git/plain/build/pkgs/scipy/patches/extern_decls.patch?id=711fe05025795e44b84233e065d240859ccae5bd", "https://git.sagemath.org/sage.git/plain/build/pkgs/scipy/patches/extern_decls.patch?id=711fe05025795e44b84233e065d240859ccae5bd",
@ -200,14 +195,16 @@ def setup_build_environment(self, env):
def install(self, spec, prefix): def install(self, spec, prefix):
blas = spec["blas"].libs.names[0] blas = spec["blas"].libs.names[0]
lapack = spec["lapack"].libs.names[0] lapack = spec["lapack"].libs.names[0]
# FIXME: MKL support doesn't work, why?
if spec["blas"].name in ["intel-mkl", "intel-parallel-studio", "intel-oneapi-mkl"]: if spec["blas"].name in ["intel-mkl", "intel-parallel-studio", "intel-oneapi-mkl"]:
blas = "mkl-dynamic-lp64-seq" blas = "mkl-dynamic-lp64-seq"
if spec["lapack"].name in ["intel-mkl", "intel-parallel-studio", "intel-oneapi-mkl"]: if spec["lapack"].name in ["intel-mkl", "intel-parallel-studio", "intel-oneapi-mkl"]:
lapack = "mkl-dynamic-lp64-seq" lapack = "mkl-dynamic-lp64-seq"
if spec["blas"].name in ["blis", "amdblis"]: if spec["blas"].name in ["blis", "amdblis"]:
blas = "blis" blas = "blis"
if blas == "armpl":
blas += "-dynamic-lp64-seq"
if lapack == "armpl":
lapack += "-dynamic-lp64-seq"
args = [ args = [
"setup", "setup",