提交 c2b33a27 authored 作者: Frederic Bastien's avatar Frederic Bastien

fix cuda tests in FAST_COMPILE. Too many gpu op don't implement the perform methode.

上级 f7e2eec4
...@@ -19,8 +19,12 @@ import theano.sandbox.cuda as cuda ...@@ -19,8 +19,12 @@ import theano.sandbox.cuda as cuda
import theano.compile.mode import theano.compile.mode
from theano.tests import unittest_tools as utt from theano.tests import unittest_tools as utt
mode_with_gpu = theano.compile.mode.get_default_mode().including('gpu') if theano.config.mode=='FAST_COMPILE':
mode_without_gpu = theano.compile.mode.get_default_mode().excluding('gpu') mode_with_gpu = theano.compile.mode.get_mode('FAST_RUN').including('gpu')
mode_without_gpu = theano.compile.mode.get_mode('FAST_RUN').excluding('gpu')
else:
mode_with_gpu = theano.compile.mode.get_default_mode().including('gpu')
mode_without_gpu = theano.compile.mode.get_default_mode().excluding('gpu')
def tes_use(): def tes_use():
tcn.use() tcn.use()
......
...@@ -17,7 +17,11 @@ from theano.tensor.signal.downsample import DownsampleFactorMax ...@@ -17,7 +17,11 @@ from theano.tensor.signal.downsample import DownsampleFactorMax
import theano.compile.mode import theano.compile.mode
mode_with_gpu = theano.compile.mode.get_default_mode().including('gpu')
if theano.config.mode=='FAST_COMPILE':
mode_with_gpu = theano.compile.mode.get_mode('FAST_RUN').including('gpu')
else:
mode_with_gpu = theano.compile.mode.get_default_mode().including('gpu')
def my_rand(*shape): def my_rand(*shape):
return theano._asarray(numpy.random.rand(*shape),dtype='float32') return theano._asarray(numpy.random.rand(*shape),dtype='float32')
......
...@@ -7,7 +7,13 @@ from nose.plugins.skip import SkipTest ...@@ -7,7 +7,13 @@ from nose.plugins.skip import SkipTest
import theano.sandbox.cuda as cuda_ndarray import theano.sandbox.cuda as cuda_ndarray
if cuda_ndarray.cuda_available == False: if cuda_ndarray.cuda_available == False:
raise SkipTest('Optional package cuda disabled') raise SkipTest('Optional package cuda disabled')
#needed as the gpu conv don't have a perform implementation.
if theano.config.mode=='FAST_COMPILE':
theano_mode = theano.compile.mode.get_mode('FAST_RUN').including('gpu')
else:
theano_mode = theano.compile.mode.get_default_mode().including('gpu')
cuda_tensor4 = cuda_ndarray.CudaNdarrayType([False]*4) cuda_tensor4 = cuda_ndarray.CudaNdarrayType([False]*4)
def py_conv_valid_numpy(img, kern): def py_conv_valid_numpy(img, kern):
...@@ -86,7 +92,7 @@ def _params_allgood(ishape, kshape, mode, subsample=(1,1), img_stride=(1,1), ker ...@@ -86,7 +92,7 @@ def _params_allgood(ishape, kshape, mode, subsample=(1,1), img_stride=(1,1), ker
i = cuda_tensor4() i = cuda_tensor4()
k = cuda_tensor4() k = cuda_tensor4()
op = theano.sandbox.cuda.blas.GpuConv(border_mode=mode,subsample=subsample, version=version, verbose=verbose)(i,k) op = theano.sandbox.cuda.blas.GpuConv(border_mode=mode,subsample=subsample, version=version, verbose=verbose)(i,k)
f=theano.function([i,k],op) f=theano.function([i,k],op, mode=theano_mode)
gpuval = f(img,kern) gpuval = f(img,kern)
t2 = time.time() t2 = time.time()
for i in range(nb_iter): for i in range(nb_iter):
......
...@@ -13,7 +13,10 @@ if cuda_ndarray.cuda_available == False: ...@@ -13,7 +13,10 @@ if cuda_ndarray.cuda_available == False:
import theano.compile.mode import theano.compile.mode
mode_with_gpu = theano.compile.mode.get_default_mode().including('gpu') if theano.config.mode=='FAST_COMPILE':
mode_with_gpu = theano.compile.mode.get_mode('FAST_RUN').including('gpu')
else:
mode_with_gpu = theano.compile.mode.get_default_mode().including('gpu')
import theano.sandbox.cuda as cuda import theano.sandbox.cuda as cuda
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论