Conda:如何防止 mkl 到 openblas 切换
Conda 想要将我的 blas、lapack 等软件包从 mkl 降级为 openblas 版本。我知道 conda 与 mkl 和 openblas 的混合似乎并不是一个不常见的问题。然而,我还没有找到适合我的解决方案。我安装了这些软件包
blas 2.113 mkl conda-forge
blas-devel 3.9.0 13_linux64_mkl conda-forge
libblas 3.9.0 13_linux64_mkl conda-forge
libcblas 3.9.0 13_linux64_mkl conda-forge
liblapack 3.9.0 13_linux64_mkl conda-forge
liblapacke 3.9.0 13_linux64_mkl conda-forge
mkl 2022.0.1 h06a4308_117
mkl-devel 2022.0.1 h66538d2_117
mkl-include 2022.0.1 h06a4308_117
mkl-service 2.4.0 py39h404a4ab_0 conda-forge
mkl_fft 1.3.1 py39h6964271_2 conda-forge
mkl_random 1.2.2 py39h8b66066_1 conda-forge
,并且有一个 .condarc
(在 Linux 上),其中包含
channels:
- conda-forge
- defaults
dependencies:
- python>=3.6
- numpy>=1.13
- scipy>=0.18
- cython>=0.29
- mkl
- mkl-devel
- libblas=*=*mkl
- bottleneck
- pip
- setuptools>=30.3.0
- h5py
- pyyaml
- pytest
ssl_verify: true
auto_activate_base: false
此外,在 conda-meta
目录中我有一个 pinned
文件,包含行 libblas=*=*mkl
。然而,在 conda update --all
上建议:
The following packages will be DOWNGRADED:
... other pkgs ...
libblas 3.9.0-13_linux64_mkl --> 3.9.0-13_linux64_openblas
libcblas 3.9.0-13_linux64_mkl --> 3.9.0-13_linux64_openblas
liblapack 3.9.0-13_linux64_mkl --> 3.9.0-13_linux64_openblas
为什么,尽管有 .condarc
和 pinned
文件,我还是得到了这个开关从 mkl 到 openblas,我还能做些什么来防止它?
Conda wants to downgrade my blas, lapack etc. packages from an mkl to an openblas version. I understand that conda juggling with mkl versus openblas seems not an uncommon issue. Yet, I have not found a solution to do the job for me. I have these packages installed
blas 2.113 mkl conda-forge
blas-devel 3.9.0 13_linux64_mkl conda-forge
libblas 3.9.0 13_linux64_mkl conda-forge
libcblas 3.9.0 13_linux64_mkl conda-forge
liblapack 3.9.0 13_linux64_mkl conda-forge
liblapacke 3.9.0 13_linux64_mkl conda-forge
mkl 2022.0.1 h06a4308_117
mkl-devel 2022.0.1 h66538d2_117
mkl-include 2022.0.1 h06a4308_117
mkl-service 2.4.0 py39h404a4ab_0 conda-forge
mkl_fft 1.3.1 py39h6964271_2 conda-forge
mkl_random 1.2.2 py39h8b66066_1 conda-forge
and I have a .condarc
(on linux) containing
channels:
- conda-forge
- defaults
dependencies:
- python>=3.6
- numpy>=1.13
- scipy>=0.18
- cython>=0.29
- mkl
- mkl-devel
- libblas=*=*mkl
- bottleneck
- pip
- setuptools>=30.3.0
- h5py
- pyyaml
- pytest
ssl_verify: true
auto_activate_base: false
Moreover in the conda-meta
directories I have a pinned
file, containing the line libblas=*=*mkl
. Yet, upon conda update --all
this is suggested:
The following packages will be DOWNGRADED:
... other pkgs ...
libblas 3.9.0-13_linux64_mkl --> 3.9.0-13_linux64_openblas
libcblas 3.9.0-13_linux64_mkl --> 3.9.0-13_linux64_openblas
liblapack 3.9.0-13_linux64_mkl --> 3.9.0-13_linux64_openblas
Why, despite of the the .condarc
and pinned
files, am I getting this switch from mkl to openblas, and what else can I do to prevent it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
请参阅 https://conda-forge 末尾的注释部分.org/docs/maintainer/knowledge_base.html#switching-blas-implementation
See the note section at the end of https://conda-forge.org/docs/maintainer/knowledge_base.html#switching-blas-implementation
我正在为我自己的操作发布一个奇怪的解决方法。这终于对我有用了。
首先,我无法说服
conda
尊重.condarc
中的频道顺序以及中的内容>在通过任何其他建议运行更新之前固定
文件,包括在stackoverflow之外找到的文件。第二,我存储了一个
conda列表 | grep mkl,一个 conda 列表 | grep intel 和 conda 列表 | grep open
供以后参考。然后我“屈服”并让“升级”发生,运行conda update --all
。不用说,在那之后,我的环境确实显示了所有mkl
类型库被openblas
内容不必要的替换。第三,在
openblas
感染的环境中,我“重新安装”了mkl
同时确保没有
openblas
-stuff 通过在任何相关包上执行conda remove
来保留。 (我并不是说上述所有命令实际上都是达到mkl
环境的原始状态所必需的。但这就是我所做的。)第四,比较根据前面第二步骤的参考说明,我检查了此时我的环境声称已返回“all-mkl”。此外,使用这个非常有用的网站 http://markus-beuckelmann.de/blog /boosting-numpy-blas.html 我还检查了,对于预期的典型
mkl
计时来说,这确实是正确的。另一方面,有一个非常奇怪和令人困惑的问题,它可能与OP无关,但我在这种情况下偶然发现:在
WWW
上,人们发现了很多许多引用指出,对于 numpy 或 scipy 实际“使用”mkl 来说,必须有这种输出
numpy/scipy.show_confi()
。总的来说,这似乎不正确。事实上,当人们得到这一点时,只要在
/home/abcd/efgh..../lib
中人们发现一切都像我所做的那样链接,就不会引起恐慌。
(
conda
太痛苦了。叹息)I'm posting a quirky workaround for my own OP. This finally worked for me.
First, I could not convince
conda
to respect the channel ordering in.condarc
nor the content in thepinned
files before running the update by any other suggestion, including those found outside of stackoverflow .Second, I stored a
conda list | grep mkl
, aconda list | grep intel
, and aconda list | grep open
away for later reference. Then I "gave in" and let the "upgrade" happen, runningconda update --all
. No need to mention that after that, my environment indeed showed the unwanted replacement of allmkl
-type libraries withopenblas
stuff.Third, and within the
openblas
-infested environment I "re-installed"mkl
Also make sure that no
openblas
-stuff remains by doing aconda remove
on whatever related package. (I'm not claiming that really all of the above commands are necessary to reach the original state of the environment regardingmkl
. But that's what I did.)Fourth, comparing with the reference notes from the preceding second step I checked that at this point my environment claimed to be back to "all-mkl". Moreover, using this extremely helpful site http://markus-beuckelmann.de/blog/boosting-numpy-blas.html I also checked, that this was indeed true regarding typical
mkl
timings to be expected.On the side, there is a really weird and confusing issue, which may not be related to the OP but which I stumbled across in this context: On the
WWW
one finds many many many quotes stating, that fornumpy
orscipy
actually "using"mkl
, one has to have this kind of outputfrom
numpy/scipy.show_confi()
. This seems not true in general. In fact when one getsthis is no cause for panic as long as in
/home/abcd/efgh..../lib
one finds everything linked aswhich I do.
(
conda
is just soo painful. sigh)每当 Intel MKL 包更新但 numpy 包没有更新时,包管理就会变得一团糟。我最终可能会安装 Intel MKL,但 numpy 使用的是 openblas。为了在我的设置中实现此功能,我经常在创建新环境时执行此操作:
以便与 numpy 同时安装 MKL,并且 numpy 将使用 MKL。这通常会导致旧版本的 MKL,因为 numpy 与旧版本的 MKL 链接。
如果没有 blas=*=*mkl,我通常会得到一个基于 openblas 的 numpy,并且安装了最新版本的 Intel MKL,但没有任何东西使用。
不幸的是,numpy 似乎没有在其版本 ID 中显示它所链接的 blas 库。通常,您的环境中最终会同时出现 openblas 和 mkl。
The package management can be a mess whenever the Intel MKL package has been updated, but the numpy package has not. I may end up with Intel MKL being installed, but numpy is using the openblas. To get this working in my setup, I often do this when creating a new environment:
so that the MKL is installed at the same time as numpy, and numpy will use the MKL. This often results in an older version of MKL, since numpy was linked against an older version of the MKL.
Without the
blas=*=*mkl
, I will often end up with an openblas based numpy installed with the newest version of the Intel MKL not being used by anything.Unfortunately, numpy does not appear to show the blas library it is linked against in its version id. Oftentimes, you will end up with both openblas and mkl in your environment.