Deepin15.4下双显卡切换以及CUDA开发环境配置
Tofloor
poster avatar
Deepin大法好
deepin
2017-05-10 01:25
Author
本帖最后由 liaodong2014 于 2017-5-9 18:07 编辑

Deepin15.4 下 CUDA 配置方法

deepin15.4不仅漂亮而且运行流畅,吸引了大批linuxer,其中也不乏搞cuda的小伙伴。但是有不少童鞋在deepin15.4下配置cuda遇到了困难,所以抽空写个博文说一下我配置的方法。主要针对电脑是intel 核显,nvidia显卡,需要运行cuda,并且有双显卡热切换需求的小朋友。


我的环境

先说一下我电脑的配置吧,大家的硬件环境不一样,我也没法一一测试。

  • CPU intel core i5 4210u
  • 显卡 nvidia gt840m
  • 系统 deepin 15.4 x64

目标
  • 安装nvidia-bumblebee,实现双显卡切换

    对于笔记本用户来说,一直开着独显的话发热量会明显增大,并且耗电也会变快,所以需要安装bumblebee来切换显卡,平时只用核显就足够了,需要运行cuda或者玩游戏的话才开启独显。

  • 安装cuda开发工具

    cuda在linux下的开发工具基本上够用了,有基于eclipse 的nsight,有visual profiler性能分析工具,还有pycuda库实现对python运算的加速。但是我以前在deepin上面尝试安装官方的.run包,均以失败告终,很容易把电脑搞崩溃。最近终于找到了从软件源直接安装cuda的方法



具体安装方法请见博客:http://blog.csdn.net/liaodong2010/article/details/71482304

Reply Favorite View the author
All Replies
avatar
markson
deepin
2017-05-10 01:53
#1
404 no found
Reply View the author
avatar
Deepin大法好
deepin
2017-05-10 01:55
#2

刚发上去,审核还没通过
Reply View the author
avatar
dikas2015
deepin
2017-05-10 06:45
#3
cuda是什么不知道,我比较关心双显卡切换,我严重怀疑我的独显没工作,能不能详细说下切换怎么弄的,
bumblebee bumblebee-nvidia都是安了的, nvidia-smi没找到啊
Reply View the author
avatar
Deepin大法好
deepin
2017-05-23 08:42
#4
dikas2015 发表于 2017-5-9 22:45
cuda是什么不知道,我比较关心双显卡切换,我严重怀疑我的独显没工作,能不能详细说下切换怎么弄的,
bumbl ...

深度的cdn源里有啊,你再试一下
Reply View the author
avatar
albertwy
deepin
2017-06-01 03:47
#5
这种方式到底cuda安装上没有啊?因为找不到cuda文件夹,导致后面cudnn不知道怎么安装。
Reply View the author
avatar
fanf6g
deepin
2017-08-31 16:57
#6
cudnn你在nvidia官网上找deb文件下载安装就好了
Reply View the author
avatar
pikachuhy
deepin
2017-09-02 02:34
#7
你有试过配置gpu版的caffe吗?
Reply View the author
avatar
ailick
deepin
2017-09-03 17:33
#8
本帖最后由 ailick 于 2017-9-3 09:51 编辑

楼主,我的就怎么也配置不好,都是奇怪的问题。这个pycuda和theano倒是没啥问题了
  1. [ailick@Ailick_Mj ~]$ optirun bash
  2. [ailick@Ailick_Mj ]$ python cuda.py
  3. alloc 517962752.0
  4. alloc 517961728.0
  5. alloc 517959680.0
  6. alloc 517955584.0
  7. alloc 517947392.0
  8. alloc 517931008.0
  9. alloc 517898240.0
  10. alloc 517832704.0
  11. alloc 517701632.0
  12. alloc 517439488.0
  13. alloc 516915200.0
  14. alloc 515866624.0
  15. alloc 513769472.0
  16. alloc 509575168.0
  17. alloc 501186560.0
  18. alloc 484409344.0
  19. alloc 450854912.0
  20. alloc 383746048.0
  21. alloc 249528320.0
  22. Traceback (most recent call last):
  23.   File "cuda.py", line 14, in
  24.     raise RuntimeError("couldn't find allocatable size")
  25. RuntimeError: couldn't find allocatable size
Copy the Code
  1. [ailick@Ailick_Mj Build]$ DEVICE=cuda python -c "import pygpu;pygpu.test()"
  2. pygpu is installed in /usr/lib/python3.6/site-packages/pygpu-0.7.1-py3.6-linux-x86_64.egg/pygpu
  3. NumPy version 1.13.1
  4. NumPy relaxed strides checking option: True
  5. NumPy is installed in /usr/lib/python3.6/site-packages/numpy
  6. Python version 3.6.2 (default, Jul 20 2017, 03:52:27) [GCC 7.1.1 20170630]
  7. nose version 1.3.7
  8. *** Testing for GeForce GTX 760M
  9. mpi4py found: False
  10. ...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................SSSSSSS...................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
  11. ----------------------------------------------------------------------
  12. Ran 7253 tests in 162.373s

  13. OK (SKIP=7)
Copy the Code

  1. [ailick@Ailick_Mj ~]$ python
  2. Python 3.6.2 (default, Jul 20 2017, 03:52:27)
  3. [GCC 7.1.1 20170630] on linux
  4. Type "help", "copyright", "credits" or "license" for more information.
  5. >>> import theano
  6. WARNING (theano.sandbox.cuda): The cuda backend is deprecated and will be removed in the next release (v0.10).  Please switch to the gpuarray backend. You can get more information about how to switch at this URL:
  7. https://github.com/Theano/Theano/wiki/Converting-to-the-new-gpu-back-end%28gpuarray%29

  8. Using gpu device 0: GeForce GTX 760M (CNMeM is disabled, cuDNN 7001)
  9. /usr/lib/python3.6/site-packages/theano/sandbox/cuda/__init__.py:631: UserWarning: Your cuDNN version is more recent than the one Theano officially supports. If you see any problems, try updating Theano or downgrading cuDNN to version 5.1.
  10.   warnings.warn(warn)
  11. >>>
Copy the Code
Reply View the author
avatar
lgdlkq
deepin
2017-11-26 22:14
#9
安装完成tensorflow找不到cuda怎么破?
Reply View the author
avatar
Deepin大法好
deepin
2018-01-07 19:12
#10
https://bbs.deepin.org/post/139192
你有试过配置gpu版的caffe吗?

没有呢,等下次有时间试一下
Reply View the author
avatar
Deepin大法好
deepin
2018-01-07 19:17
#11
https://bbs.deepin.org/post/139192
楼主,我的就怎么也配置不好,都是奇怪的问题。这个pycuda和theano倒是没啥问题了

有时候就是会出现一些奇怪的问题,我也是折腾了好久才把pycuda搞定的。
Reply View the author
avatar
Deepin大法好
deepin
2018-01-07 19:17
#12
https://bbs.deepin.org/post/139192
安装完成tensorflow找不到cuda怎么破?

是找不到cuda的运行环境?你是笔记本还是台式机呢
Reply View the author
avatar
gavin21
deepin
2018-01-13 23:32
#13
按你的方法,运行optirun后出现
[ 6121.229696] [ERROR]Cannot access secondary GPU - error: Could not load GPU driver

[ 6121.229733] [ERROR]Aborting because fallback start is disabled.

怎么办?
Reply View the author
avatar
Deepin大法好
deepin
2018-01-15 17:51
#14
https://bbs.deepin.org/post/139192
按你的方法,运行optirun后出现
[ 6121.229696] [ERROR]Cannot access secondary GPU - error: Could not lo ...

现在深度的显卡管理器已经可以自动安装bumblebee了,你可以尝试一下
Reply View the author