ubuntu 16.04 安装cuda的方法

  很多神经网络架构都需要安装CUDA,安装这个的确费了我不少时间,是要总结一下流程了。

安装这个,最好使用官网的安装步骤和流程,不然,会走很多弯路:

https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1604&target_type=deblocal

  按照上面的流程走,下面就是根据各种问题去解决问题。

  错误log:

  执行:sudo apt-get install cuda

报错:

Get:59 file:/var/cuda-repo-9-2-local cuda 9.2.88-1 [2,508 B]
Fetched 694 kB in 22s (30.4 kB/s)
E: Failed to fetch http://114.80.80.238:8089/ceshi/index.html Hash Sum mismatch

E: Failed to fetch http://114.80.80.238:8089/ceshi/index.html Hash Sum mismatch

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

尝试了各种方法,按照:

http://www.th7.cn/system/lin/201706/216181.shtml

上面说的各种方法都尝试了,可是,依然没啥收获,最后在一个不起眼的地方找到了答案:

sudo vim /etc/apt/sources.list.d/cuda.list  把里面的代码改成:

deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64 

再重新编译,问题就解决了。

  2 make caffe2 报错:

[ 1%] Performing build step for 'nccl_external'
ls: cannot access '/usr/lib64/libcudart.so.*': No such file or directory
ls: cannot access '/usr/lib64/libcudart.so.*': No such file or directory
ls: cannot access '/usr/lib64/libcudart.so.*': No such file or directory
/bin/sh: 1: [: -lt: unexpected operator

  解决方法:

  搜索:locate libcudart.so 

  重定向:ln -s /usr/lib/x86_64-linux-gnu/libcudart.so /usr/lib64/libcudart.so

  重命名:/usr/lib64$ sudo ln -s libcudart.so libcudart.so.7.5 

原文地址:https://www.cnblogs.com/dylancao/p/9176131.html