提交 b40917ab authored 作者: Frederic's avatar Frederic

Make the gpuarray tests run by default.

上级 47270716
...@@ -11,6 +11,7 @@ _logger.setLevel(logging.WARNING) ...@@ -11,6 +11,7 @@ _logger.setLevel(logging.WARNING)
error = _logger.error error = _logger.error
info = _logger.info info = _logger.info
pygpu_activated = False
try: try:
import pygpu import pygpu
import pygpu.gpuarray import pygpu.gpuarray
...@@ -24,8 +25,10 @@ import opt ...@@ -24,8 +25,10 @@ import opt
def init_dev(dev): def init_dev(dev):
global pygpu_activated
context = pygpu.init(dev) context = pygpu.init(dev)
pygpu.set_default_context(context) pygpu.set_default_context(context)
pygpu_activated = True
if pygpu: if pygpu:
try: try:
...@@ -37,12 +40,8 @@ if pygpu: ...@@ -37,12 +40,8 @@ if pygpu:
optdb.add_tags('gpuarray_opt', 'fast_run', 'inplace') optdb.add_tags('gpuarray_opt', 'fast_run', 'inplace')
elif config.gpuarray.init_device != '': elif config.gpuarray.init_device != '':
init_dev(config.gpuarray.init_device) init_dev(config.gpuarray.init_device)
else:
info("pygpu support not configured, disabling")
pygpu = None
except Exception: except Exception:
error("Could not initialize pygpu, support disabled", exc_info=True) error("Could not initialize pygpu, support disabled", exc_info=True)
pygpu = None
else: else:
if (config.gpuarray.init_device != '' or if (config.gpuarray.init_device != '' or
config.device.startswith('opencl') or config.device.startswith('opencl') or
......
...@@ -11,7 +11,14 @@ from theano.tests.unittest_tools import SkipTest ...@@ -11,7 +11,14 @@ from theano.tests.unittest_tools import SkipTest
from numpy.testing.noseclasses import KnownFailureTest from numpy.testing.noseclasses import KnownFailureTest
import theano.sandbox.gpuarray import theano.sandbox.gpuarray
if theano.sandbox.gpuarray.pygpu is None:
import theano.sandbox.cuda as cuda_ndarray
if cuda_ndarray.cuda_available and not theano.sandbox.gpuarray.pygpu_activated:
if not cuda_ndarray.use.device_number:
cuda_ndarray.use('gpu')
theano.sandbox.gpuarray.init_dev('cuda')
if not theano.sandbox.gpuarray.pygpu_activated:
raise SkipTest("pygpu disabled") raise SkipTest("pygpu disabled")
from theano.sandbox.gpuarray.type import (GpuArrayType, from theano.sandbox.gpuarray.type import (GpuArrayType,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论