提交 41f87ccc authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Add a theano flag for single stream mode.

Default is True because it's faster for now.
上级 78624afc
...@@ -242,6 +242,14 @@ AddConfigVar('gpuarray.preallocate', ...@@ -242,6 +242,14 @@ AddConfigVar('gpuarray.preallocate',
FloatParam(0), FloatParam(0),
in_c_key=False) in_c_key=False)
AddConfigVar('gpuarray.single_stream',
"""Switch between single stream mode or multi-stream
mode. If your computation can't benefit from multiple
streams, single-stream is usually faster (by about 10%)
""",
BoolParam(True),
in_c_key=False)
def safe_no_dnn_workmem(workmem): def safe_no_dnn_workmem(workmem):
""" """
......
...@@ -62,7 +62,8 @@ def init_dev(dev, name=None): ...@@ -62,7 +62,8 @@ def init_dev(dev, name=None):
global pygpu_activated global pygpu_activated
if dev not in init_dev.devmap: if dev not in init_dev.devmap:
ctx = pygpu.init(dev, ctx = pygpu.init(dev,
disable_alloc_cache=config.gpuarray.preallocate < 0) disable_alloc_cache=config.gpuarray.preallocate < 0,
single_stream=config.gpuarray.single_stream)
init_dev.devmap[dev] = ctx init_dev.devmap[dev] = ctx
if config.gpuarray.preallocate > 0: if config.gpuarray.preallocate > 0:
MB = (1024 * 1024) MB = (1024 * 1024)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论