cuda程序执行出错: libcudart.so.8.0: cannot open shared object file: No such file or directory

时间:2022-04-21 19:36:53

问题描述: 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命令是一个动态链接库管理命令,是为了让动态链接库为系统共享

至此,问题就解决啦,哈哈哈(*_^)