提交 470d02f8 authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Add a map of previously initialized device so we don't use more than

one context per device.
上级 a9aa2fe2
......@@ -33,13 +33,17 @@ def init_dev(dev, name=None):
"Make sure Theano and libgpuarray/pygpu "
"are in sync.")
global pygpu_activated
context = pygpu.init(dev)
if dev not in init_dev.devmap:
init_dev.devmap[dev] = pygpu.init(dev)
context = init_dev.devmap[dev]
reg_context(name, context)
pygpu_activated = True
if config.print_active_device:
print("Mapped name %s to device %s: %s" % (name, dev, context.devname),
file=sys.stderr)
init_dev.devmap = {}
if pygpu:
try:
if (config.device.startswith('cuda') or
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论