Disable py-numpy AVX512 instructions when compiled with Intel (#47941)

* Disable numpy AVX512 when compiled with Intel classic

* Add py-numpy v1.26.5

* Add patch to handle AVX512 conversions

* Remove unneeded patch.

* Remove unnecessary tag

* Move blas_config_settings to config_settings

* Cleaned up blas settings
This commit is contained in:
David Huber 2025-01-03 18:27:59 +00:00 committed by GitHub
parent 690a6045a9
commit ec286e857f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -316,7 +316,8 @@ def blas_lapack_pkg_config(self) -> Tuple[str, str]:
@when("@1.26:")
def config_settings(self, spec, prefix):
blas, lapack = self.blas_lapack_pkg_config()
return {
settings = {
"builddir": "build",
"compile-args": f"-j{make_jobs}",
"setup-args": {
@ -330,6 +331,22 @@ def config_settings(self, spec, prefix):
},
}
# Disable AVX512 features for Intel Classic compilers
# https://numpy.org/doc/stable/reference/simd/build-options.html
# https://github.com/numpy/numpy/issues/27840
# https://github.com/matplotlib/matplotlib/issues/28762
archs = ("x86_64_v4:", "cannonlake:", "mic_knl")
if any([self.spec.satisfies(f"target={arch} %intel") for arch in archs]):
intel_setup_args = {
"-Dcpu-dispatch": (
"MAX -AVX512F -AVX512CD -AVX512_KNL -AVX512_KNM -AVX512_SKX "
+ "-AVX512_CLX -AVX512_CNL -AVX512_ICL -AVX512_SPR"
)
}
settings["setup-args"].update(intel_setup_args)
return settings
def blas_lapack_site_cfg(self) -> None:
"""Write a site.cfg file to configure BLAS/LAPACK."""
spec = self.spec