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
這類錯誤。