BigMoyan 2015-09-22 13:22 采纳率: 0%
浏览 2539

ubuntu下Theano使用GPU的问题

配置情况:
在ubuntu14.04下配置theano,在调用官方文档里GPU测试得函数是总是返回 Used CPU

CUDA应该安装的没问题,安装完可以运行测试用例

显卡也是没问题得,支持CUDA妥妥儿得

用的IDE是spyder

使用另一个测试用例
from theano import function, config, shared, sandbox
import theano.sandbox.cuda.basic_ops
import theano.tensor as T
import numpy
import time

vlen = 10 * 30 * 768 # 10 x #cores x # threads per core
iters = 1000

rng = numpy.random.RandomState(22)
x = shared(numpy.asarray(rng.rand(vlen), 'float32'))
f = function([], sandbox.cuda.basic_ops.gpu_from_host(T.exp(x)))
print(f.maker.fgraph.toposort())
t0 = time.time()
for i in xrange(iters):
r = f()
t1 = time.time()
print("Looping %d times took %f seconds" % (iters, t1 - t0))
print("Result is %s" % (r,))
print("Numpy result is %s" % (numpy.asarray(r),))
if numpy.any([isinstance(x.op, T.Elemwise) for x in f.maker.fgraph.toposort()]):
print('Used the cpu')
else:
print('Used the gpu')

的时候偶尔会返回 找不到nvcc的错误,提示我应该将nvcc加入路径中,但有时候重启一下就不提示这问题了。。虽然仍然显示调用得是cpu

出现这个问题时候我试着查看
nvcc -V -i
提示nvcc未安装,可使用apt-get安装
然后我用apt-get时又会这样:
Reading package lists... Done
Building dependency tree

Reading state information... Done
Note, selecting 'cuda-core-7-5' instead of 'nvcc'
cuda-core-7-5 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 320 not upgraded.

刚才说了我CUDA都安装好了nvcc肯定妥妥儿的啊,尝试按照CUDA手册上把运行库再添加到路径中一次:
gpu2@gpu2-All-Series:~$ export PATH=/usr/local/cuda-7.5/bin:$PATH
gpu2@gpu2-All-Series:~$ export LD_LIBRARY_PATH=/usr/local/cuda-7.5/lib64:$LD_LIBRARY_PATH

并没有任何卵用

求各位大神协助!感激不尽!

  • 写回答

2条回答 默认 最新

  • devmiao 2015-09-22 15:48
    关注
    评论

报告相同问题?

悬赏问题

  • ¥100 有人会搭建GPT-J-6B框架吗?有偿
  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名