提交 445264c7 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Using the flag init_gpu_device does not set cuda_enabled to True anymore.

上级 f11f8f36
...@@ -154,8 +154,11 @@ outdated!""") ...@@ -154,8 +154,11 @@ outdated!""")
import cuda_ndarray import cuda_ndarray
def use(device, force=False, default_to_move_computation_to_gpu = True, def use(device,
move_shared_float32_to_gpu = True): force=False,
default_to_move_computation_to_gpu=True,
move_shared_float32_to_gpu=True,
enable_cuda=True):
global cuda_enabled, cuda_initialization_error_message global cuda_enabled, cuda_initialization_error_message
if force and not cuda_available and device.startswith('gpu'): if force and not cuda_available and device.startswith('gpu'):
raise EnvironmentError("You forced use of device %s, but CUDA initialization failed " raise EnvironmentError("You forced use of device %s, but CUDA initialization failed "
...@@ -191,7 +194,9 @@ def use(device, force=False, default_to_move_computation_to_gpu = True, ...@@ -191,7 +194,9 @@ def use(device, force=False, default_to_move_computation_to_gpu = True,
if move_shared_float32_to_gpu: if move_shared_float32_to_gpu:
handle_shared_float32(True) handle_shared_float32(True)
use.device_number = device use.device_number = device
cuda_enabled = True
if enable_cuda:
cuda_enabled = True
print >> sys.stderr, "Using gpu device %d: %s" % (active_device_number(), active_device_name()) print >> sys.stderr, "Using gpu device %d: %s" % (active_device_number(), active_device_name())
except (EnvironmentError, ValueError), e: except (EnvironmentError, ValueError), e:
_logger.error(("ERROR: Not using GPU." _logger.error(("ERROR: Not using GPU."
...@@ -251,4 +256,5 @@ elif config.init_gpu_device: ...@@ -251,4 +256,5 @@ elif config.init_gpu_device:
use(device=config.init_gpu_device, use(device=config.init_gpu_device,
force=config.force_device, force=config.force_device,
default_to_move_computation_to_gpu=False, default_to_move_computation_to_gpu=False,
move_shared_float32_to_gpu=False) move_shared_float32_to_gpu=False,
enable_cuda=False)
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论