提交 67e55088 authored 作者: Frederic's avatar Frederic

Allow loop of call to cuda.use() and cuda.unuse().

上级 9f7a57fa
...@@ -383,11 +383,6 @@ def use(device, ...@@ -383,11 +383,6 @@ def use(device,
" the Theano mailing list to tell us about" " the Theano mailing list to tell us about"
" this new GPU as we don't know any with" " this new GPU as we don't know any with"
" this property") " this property")
if move_shared_float32_to_gpu:
handle_shared_float32(True)
if enable_cuda:
cuda_enabled = True
if config.print_active_device: if config.print_active_device:
print >> sys.stderr, "Using gpu device %d: %s" % ( print >> sys.stderr, "Using gpu device %d: %s" % (
...@@ -412,11 +407,17 @@ def use(device, ...@@ -412,11 +407,17 @@ def use(device,
" No fallback to the cpu or other gpu device."),) " No fallback to the cpu or other gpu device."),)
raise raise
elif use.device_number != device: elif use.device_number != device and device != 'gpu':
_logger.warning(("Ignoring call to use(%s), GPU number %i " _logger.warning(("Ignoring call to use(%s), GPU number %i "
"is already in use."), "is already in use."),
str(device), use.device_number) str(device), use.device_number)
if move_shared_float32_to_gpu:
handle_shared_float32(True)
if enable_cuda:
cuda_enabled = True
if default_to_move_computation_to_gpu: if default_to_move_computation_to_gpu:
optdb.add_tags('gpu_opt', optdb.add_tags('gpu_opt',
'fast_run', 'fast_run',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论