CUDA與cudatoolkit


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

這類錯誤。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM