caffe安装+Ubuntu16.04+三显卡gpu加速

来源:互联网 发布:淘宝直播申请入口关闭 编辑:程序博客网 时间:2024/05/23 16:54

转载请注明:http://blog.csdn.net/c602273091/article/details/53907162

最近实验室新到了一个GPU服务器:2块GTX1080+1块intel低端显卡+2块至强CPU+256GSSD+64G内存+4T磁盘。然后因为做Semantic SLAM需要训练自己的很大的模型,所以需要装caffe。整个过程遇到了很多坑,最坑的当然就是显卡驱动这个问题。一方面ubuntu16.04、显卡都是比较新的版本,nvidia在这方面的支持也是一如既往地让人吐槽。在安装显卡驱动过程中,遇到了闪屏、循环登录等等问题。我会在本篇博客说一下我怎么解决的,以记录我两天的心酸历程。

    • CPU版本安装
    • GPU版本安装
    • 问题总结

CPU版本安装

我找的我觉得最好的版本是:
https://github.com/BVLC/caffe/wiki/Ubuntu-16.04-or-15.10-Installation-Guide
1、安装依赖项:

sudo apt-get updatesudo apt-get upgradesudo apt-get install -y build-essential cmake git pkg-configsudo apt-get install -y libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compilersudo apt-get install -y libatlas-base-dev sudo apt-get install -y --no-install-recommends libboost-all-devsudo apt-get install -y libgflags-dev libgoogle-glog-dev liblmdb-dev# (Python general) sudo apt-get install -y python-pip# (Python 2.7 development files) sudo apt-get install -y python-dev sudo apt-get install -y python-numpy python-scipy

2、下载caffe:直接git。

https://github.com/BVLC/caffe

照着链接里面写的把Makefile.conf进行修改就可以跑了。

当然你也可以按照caffe官网走一遍:
http://caffe.berkeleyvision.org/installation.html#compilation
http://caffe.berkeleyvision.org/installation.html#compilation

这样就可以跑CPU版本了。如果安装不对可以考虑是某些库没装好,再装一边,或者考虑是Makefile.conf没有写好。要在python中import caffe的话需要把caffe的python加入到bashrc里。

GPU版本安装

我建议还是多花时间安装GPU版本,我跑faster rcnn的时候,出一张图片用GPu是0.1s,CPU是20s,差距悬殊。

GPU安装的过程继续参考:
https://github.com/BVLC/caffe/wiki/Ubuntu-16.04-or-15.10-Installation-Guide
cuda,cudnn版本一定要匹配。

问题总结

关键的地方来了,显卡驱动的各种坑。请看必杀技:
不需要驱动的使用: http://f.dataguru.cn/thread-725568-1-1.html
http://m.blog.csdn.net/article/details?id=51321887
http://blog.csdn.net/t5131828/article/details/53258925
记得不要装opengl,这个装了你就准备循环登录吧。

循环登录或者闪屏的话,不要想着重装。不到万不得已,不要重装。按ctrl+F1进入命令行模式,把刚才装的驱动删了,把关闭的nouveau的配置文件删了,更新一下。

看了那么多修改nouveau的教程,关闭,删除什么的,都没有什么卵用。

修改nouveau:
http://m.blog.csdn.net/article/details?id=52433609
http://blog.chinaunix.net/uid-11581508-id-3905393.html
http://www.360doc.com/content/15/1212/01/26884432_519759639.shtml
http://askubuntu.com/questions/223501/ubuntu-gets-stuck-in-a-login-loop
http://forum.ubuntu.org.cn/viewtopic.php?f=48&t=477846&sid=b80c818379ae3640e4e3f5b3c7dae381&start=15
http://www.cnblogs.com/taopanpan/p/4263951.html
http://www.linuxdiyf.com/linux/26370.html
http://m.blog.csdn.net/article/details?id=52433609

非常好的教程:
http://blog.csdn.net/t5131828/article/details/53258925
http://www.52nlp.cn/%E6%B7%B1%E5%BA%A6%E5%AD%A6%E4%B9%A0%E4%B8%BB%E6%9C%BA%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE-ubuntu-16-04-nvidia-gtx-1080-cuda-8
http://lib.csdn.net/article/deeplearning/51314
http://m.2cto.com/os/201608/535727.html
http://blog.csdn.net/t5131828/article/details/53258925
http://qoofan.com/read/vnWeVBzVGM.html
http://f.dataguru.cn/thread-718537-1-1.html

cuDNN下载及安装教程:
下载地址:https://developer.nvidia.com/rdp/cudnn-download
http://blog.csdn.net/lee_j_r/article/details/52693724

安装cudnn的详细教程:
http://blog.csdn.net/jhszh418762259/article/details/52958287?locationNum=8&fps=1
http://blog.csdn.net/jhszh418762259/article/details/52958287?locationNum=8&fps=1

hdf5的问题解决: http://www.linuxdiyf.com/linux/21717.html
http://blog.csdn.net/zouyu1746430162/article/details/53391283
http://www.cnblogs.com/taopanpan/p/4263951.html

装完之后测试: http://www.linuxdiyf.com/linux/21717.html

安装opencv: http://blog.csdn.net/xiaxiazls/article/details/52039473

Makefile.conf的书写:
http://www.cnblogs.com/anmengcv/p/5368846.html
http://blog.csdn.net/jbddygb/article/details/52721808

1 0