Skip to content

Commit

Permalink
fix compatibility with NumPy 1.26 (#2853)
Browse files Browse the repository at this point in the history
Fix #2852.

Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz authored Sep 22, 2023
1 parent 0f07afa commit c35ab61
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion deepmd/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,20 @@ def set_mkl():
check whether the numpy is built by mkl, see
https://github.com/numpy/numpy/issues/14751
"""
if "mkl_rt" in np.__config__.get_info("blas_mkl_info").get("libraries", []):
try:
is_mkl = (
np.show_config("dicts")
.get("Build Dependencies", {})
.get("blas", {})
.get("name", "")
.lower()
.startswith("mkl")
)
except TypeError:
is_mkl = "mkl_rt" in np.__config__.get_info("blas_mkl_info").get(
"libraries", []
)
if is_mkl:
set_env_if_empty("KMP_BLOCKTIME", "0")
set_env_if_empty("KMP_AFFINITY", "granularity=fine,verbose,compact,1,0")
reload(np)
Expand Down

0 comments on commit c35ab61

Please sign in to comment.