1. 程式人生 > >cuda程式執行出錯: libcudart.so.8.0: cannot open shared object file: No such file or directory

cuda程式執行出錯: libcudart.so.8.0: cannot open shared object file: No such file or directory

問題描述: error while loading shared libraries: libcudart.so.8.0: cannot open shared object file: No such file or directory

解決辦法:首先確認/etc/profile中的路徑包含了cuda8.0的安裝路徑及相應的庫檔案

export PATH=$PATH:/usr/local/cuda-8.0/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-8.0/lib64
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/cuda-8.0/lib64

$source /etc/profile

使配置檔案生效,再次執行。

若仍提示相同的錯誤,則執行以下命令,將相應的庫檔案複製到/usr/lib

sudo cp /usr/local/cuda-8.0/lib64/libcudart.so.8.0 /usr/local/lib/libcudart.so.8.0 && sudo ldconfig sudo cp /usr/local/cuda-8.0/lib64/libcublas.so.8.0 /usr/local/lib/libcublas.so.8.0 && sudo ldconfig sudo cp /usr/local/cuda-8.0/lib64/libcurand.so.8.0 /usr/local/lib/libcurand.so.8.0 && sudo ldconfig
ps. ldconfig命令是一個動態連結庫管理命令,是為了讓動態連結庫為系統共享

至此,問題就解決啦,哈哈哈(*_^)