RuntimeError: Cannot initialize CUDA without ATen_cuda library.

RuntimeError: Cannot initialize CUDA without ATen_cuda library. PyTorch splits its backend into two shared libraries: a CPU library and a CUDA library; this error has occurred because you are trying to use some CUDA functionality, but the CUDA library has not been loaded by the dynamic linker for some reason.  The CUDA library MUST be loaded, EVEN IF you don't directly use any symbols from the CUDA library! One common culprit is a lack of -Wl,--no-as-needed in your link arguments; many dynamic linkers will delete dynamic library dependencies if you don't depend on any of their symbols.  You can check if this has occurred by using ldd on your binary to see if there is a dependency on *_cuda.so library.

没有ATen_cuda库不能初始化CUDA。PyTorch将后端分成两个共享库:一个CPU库和一个CUDA库;这个错误已经发生,因为你试图使用一些CUDA功能,但CUDA库没有加载的动态链接器出于某种原因。必须加载CUDA库,即使你没有直接使用任何来自CUDA库的符号!一个常见的罪魁祸首是链接参数中缺少-Wl,—no-as-needed;许多动态链接器会删除动态库依赖,如果你不依赖他们的符号。你可以通过在你的二进制文件上使用ldd来检查是否有对*_cuda的依赖。所以图书馆。

在这里插入图片描述
Cannot initialize CUDA without ATen_cuda library… because you are trying to use some CUDA functionality

解决办法:https://github.com/zdevito/ATen/issues/216

即:加入LD_LIBRARY_PATH路径。具体见https://blog.csdn.net/m0_37644085/article/details/81837410的g)~h)

:https://blog.csdn.net/m0_37644085/article/details/81837410#t9

:https://github.com/zdevito/ATen/issues/216

你可能感兴趣的:(Ubuntu配置,Ubuntu使用技巧)