diff --git a/deepmd/env.py b/deepmd/env.py index d8875cabd2..075e37446f 100644 --- a/deepmd/env.py +++ b/deepmd/env.py @@ -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)