提交 adf10f7d authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Attempt to prevent re-initialization of the GPU in a child process

上级 8aa7567a
......@@ -58,6 +58,8 @@ def pygpu_parse_version(version_string):
def init_dev(dev, name=None, preallocate=None):
global pygpu_activated
if os.environ.get('THEANO_GPU_IS_ALREADY_ACTIVE', '') == 'Yes':
raise RuntimeError("You can't initialize the GPU in a subprocess if the parent process already did it")
if not config.cxx:
raise RuntimeError("The new gpu-backend need a c++ compiler.")
pygpu_version = pygpu_parse_version(pygpu.__version__)
......@@ -92,6 +94,7 @@ def init_dev(dev, name=None, preallocate=None):
sched=config.gpuarray.sched,
single_stream=config.gpuarray.single_stream,
**args)
os.environ['THEANO_GPU_IS_ALREADY_ACTIVE'] = 'Yes'
context.dev = dev
init_dev.devmap[dev] = context
reg_context(name, context)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论