CUDA Toolkit是NVIDIA的CUDA工具包,包含了CUDA的全部工具。

conda安装的cudatoolkit是CUDA的一个子包,包含了主要的二进制文件。

一般conda安装的pytorch tensorflow会直接调用conda环境中的包,而如果使用pip安装的tensorflow不会自动接入conda中的cudatoolkit,进而会报

ImportError: libcudart.so.8.0: cannot open shared object file: No such file or directory

之类的错误。这种时候要么在本地安装CUDA Toolkit,要么在conda中安装对应版本的cudatoolkit,后者需要手动把cudatoolkit的lib路径(在pkgs对应的目录里)加入到LD_LIBRARY_PATH这个环境变量中。

事实上cudatoolkit并不包含所有的CUDA Toolkit二进制文件,而是分布在了多个包里,比如cudnn cupy,如果有需要还需要进一步安装,并把对应的lib路径也加入到LD_LIBRARY_PATH。

不然可能会报

ImportError: libcudnn.5: cannot open shared object file: No such file or directory
Attempting to fetch value instead of handling error Failed precondition: could not dlopen DSO: libcupti.so.9.0; dlerror: libcupti.so.9.0: cannot open shared object file: No such file or directory

这类错误。

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐