Skip to content

Commit

Permalink
fix compatibility with NumPy 1.26
Browse files Browse the repository at this point in the history
Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz committed Sep 21, 2023
1 parent 544875e commit 832bca8
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 832bca8

Please sign in to comment.