Skip to content

Commit c35ab61

Browse files
authored
fix compatibility with NumPy 1.26 (#2853)
Fix #2852. Signed-off-by: Jinzhe Zeng <[email protected]>
1 parent 0f07afa commit c35ab61

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

deepmd/env.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,20 @@ def set_mkl():
245245
check whether the numpy is built by mkl, see
246246
https://github.com/numpy/numpy/issues/14751
247247
"""
248-
if "mkl_rt" in np.__config__.get_info("blas_mkl_info").get("libraries", []):
248+
try:
249+
is_mkl = (
250+
np.show_config("dicts")
251+
.get("Build Dependencies", {})
252+
.get("blas", {})
253+
.get("name", "")
254+
.lower()
255+
.startswith("mkl")
256+
)
257+
except TypeError:
258+
is_mkl = "mkl_rt" in np.__config__.get_info("blas_mkl_info").get(
259+
"libraries", []
260+
)
261+
if is_mkl:
249262
set_env_if_empty("KMP_BLOCKTIME", "0")
250263
set_env_if_empty("KMP_AFFINITY", "granularity=fine,verbose,compact,1,0")
251264
reload(np)

0 commit comments

Comments
 (0)