Theano和Tensorflow多GPU使用问题

我使用的是tensorflow-gpu (1.2.1)和Theano (0.9.0),2个4G显存Nvidia Quadro M2000 GPU。


1. theano: ValueError: Could not infer context from inputs 

THEANO_FLAGS="contexts=dev0->cuda0;dev1->cuda1,gpuarray.preallocate=0.95,mode=FAST_RUN,floatX=float32,on_unused_input=warn"  python config.py

ERROR (theano.gof.opt): SeqOptimizer apply <theano.gpuarray.opt.GraphToGPU object at 0xdfe69210>
ERROR: SeqOptimizer apply <theano.gpuarray.opt.GraphToGPU object at 0xdfe69210>
ERROR (theano.gof.opt): Traceback:
ERROR: Traceback:
ERROR (theano.gof.opt): Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/theano/gof/opt.py", line 235, in apply
    sub_prof = optimizer.optimize(fgraph)
  File "/usr/lib/python2.7/site-packages/theano/gof/opt.py", line 87, in optimize
    ret = self.apply(fgraph, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/theano/gpuarray/opt.py", line 322, in apply
    target = infer_context_name(*fgraph.inputs)
  File "/usr/lib/python2.7/site-packages/theano/gpuarray/basic_ops.py", line 122, in infer_context_name
    raise ValueError("Could not infer context from inputs")
ValueError: Could not infer context from inputs 
theano不能自动支持多GPU,需要自己指定一个,只能在一个上面跑, 需要指定一个设备device=cuda0。

支持多GPU, 需要自己编程,参考http://deeplearning.net/software/theano/tutorial/using_multi_gpu.html#


2. tensorflow: ResourceExhaustedError: OOM when allocating tensor with 

    theano: MemoryError: Error allocating 1440000000 bytes of device memory (out of memory).

说明GPU内存不够,要调小输入或网络单元。


3. theano切换成新的GPU backend

WARNING (theano.sandbox.cuda): The cuda backend is deprecated and will be removed in the next release (v0.10)

theano 0.9.0从cuda backend切换gpuarray backend,需要安装python2-Cython-0.25+和libgpuarray-0.6.3+, 然后通过gpuarray.preallocate来指定。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值