提交 19c61d44 authored 作者: lamblin's avatar lamblin

Merge pull request #671 from nouiz/cuda_init_error

Catch more gpu init error.
...@@ -162,7 +162,7 @@ if cuda_available: ...@@ -162,7 +162,7 @@ if cuda_available:
# symlink simultaneously. # symlink simultaneously.
# If that happens, we verify that the existing symlink is # If that happens, we verify that the existing symlink is
# indeed working. # indeed working.
if e.errno != errno.EEXIST or not ok(): if getattr(e, 'errno', None) != errno.EEXIST or not ok():
raise raise
try: try:
# This only test if the cuda driver is available and if there # This only test if the cuda driver is available and if there
...@@ -333,10 +333,10 @@ def use(device, ...@@ -333,10 +333,10 @@ def use(device,
cuda_enabled = True cuda_enabled = True
print >> sys.stderr, "Using gpu device %d: %s" % ( print >> sys.stderr, "Using gpu device %d: %s" % (
active_device_number(), active_device_name()) active_device_number(), active_device_name())
except (EnvironmentError, ValueError), e: except (EnvironmentError, ValueError, RuntimeError), e:
_logger.error(("ERROR: Not using GPU." _logger.error(("ERROR: Not using GPU."
" Initialisation of device %i failed:\n%s"), " Initialisation of device %s failed:\n%s"),
device, e) str(device), e)
cuda_enabled = False cuda_enabled = False
if force: if force:
e.args += (("You asked to force this device and it failed." e.args += (("You asked to force this device and it failed."
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论