Installed cuda without conda: Can pytorch use a non-conda cuda toolkit?

余生长醉 提交于 2020-08-06 05:28:30

问题


Some questions came up from https://superuser.com/questions/1572640/do-i-need-to-install-cuda-separately-after-installing-the-nvidia-display-driver. One of these questions:

Does conda pytorch need a different version than the official non-conda cuda at https://developer.nvidia.com/cuda-toolkit?

In other words: Can I use a non-conda cuda toolkit for a pytorch installation?

Context:

If you go through the "command helper" at https://pytorch.org/get-started/locally/, you can choose between cuda versions 9.2, 10.1, 10.2 and None.

Taking 10.2 can result in:

conda install pytorch torchvision cudatoolkit=10.2 -c pytorch

Taking "None" builds the following command, but then you also cannot use cuda in pytorch:

conda install pytorch torchvision cpuonly -c pytorch

The question arose since pytorch installs a different version (10.2 instead of the officially available 11.0 of the non-conda install), and the conda install takes 325 MB. If both versions were 11.0 and the installation were smaller, you might not even notice the possible difference.


回答1:


I imagine it is probably possible to get a conda-installed pytorch to use a non-conda-installed CUDA toolkit. I don't know how to do it, and in my experience, when using conda packages that depend on CUDA, its much easier just to provide a conda-installed CUDA toolkit, and let it use that, rather than anything else. This often means I have one CUDA toolkit installed inside conda, and one installed in the usual location.

However, regardless of how you install pytorch, if you install a binary package (e.g. via conda), that version of pytorch will depend on a specific version of CUDA (that it was compiled against, e.g. 10.2) and you cannot use any other version of CUDA, regardless of how or where it is installed, to satisfy that dependency.



来源:https://stackoverflow.com/questions/63163178/installed-cuda-without-conda-can-pytorch-use-a-non-conda-cuda-toolkit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!