提交 34b55c59 authored 作者: notoraptor's avatar notoraptor

Handling exceptions when trying

to get PCI Bus ID.
上级 f4e48a80
...@@ -85,8 +85,16 @@ def init_dev(dev, name=None): ...@@ -85,8 +85,16 @@ def init_dev(dev, name=None):
# This will map the context name to the real context object. # This will map the context name to the real context object.
reg_context(name, context) reg_context(name, context)
if config.print_active_device: if config.print_active_device:
try:
pcibusid = context.pcibusid
except pygpu.gpuarray.UnsupportedException:
pcibusid = '(unsupported for device %s)' % dev
except:
warnings.warn('Unable to get PCI Bus ID. Please consider updating libgpuarray and pygpu.')
pcibusid = 'unknown'
print("Mapped name %s to device %s: %s; PCI Bus ID: %s" % print("Mapped name %s to device %s: %s; PCI Bus ID: %s" %
(name, dev, context.devname, context.pcibusid), (name, dev, context.devname, pcibusid),
file=sys.stderr) file=sys.stderr)
pygpu_activated = True pygpu_activated = True
ctx_props = _get_props(name) ctx_props = _get_props(name)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论