提交 350af57b authored 作者: Frederic Bastien's avatar Frederic Bastien

Add dnn.enabled=no_check to speed up import

上级 fbf28a02
...@@ -693,6 +693,8 @@ import theano and print the config variable, as in: ...@@ -693,6 +693,8 @@ import theano and print the config variable, as in:
If ``'False'``, do not use cuDNN or check if it is available. If ``'False'``, do not use cuDNN or check if it is available.
If ``'no_check'``, assume present and the version between heasers and linked match (so less compilation at context init)",
.. attribute:: config.conv.assert_shape .. attribute:: config.conv.assert_shape
If True, AbstractConv* ops will verify that user-provided If True, AbstractConv* ops will verify that user-provided
......
...@@ -414,8 +414,9 @@ AddConfigVar('dnn.enabled', ...@@ -414,8 +414,9 @@ AddConfigVar('dnn.enabled',
"'auto', use cuDNN if available, but silently fall back" "'auto', use cuDNN if available, but silently fall back"
" to not using it if not present." " to not using it if not present."
" If True and cuDNN can not be used, raise an error." " If True and cuDNN can not be used, raise an error."
" If False, disable cudnn", " If False, disable cudnn even if present."
EnumStr("auto", "True", "False"), " If no_check, assume present and the version between heasers and linked match (so less compilation at context init)",
EnumStr("auto", "True", "False", "no_check"),
in_c_key=False) in_c_key=False)
# This flag determines whether or not to raise error/warning message if # This flag determines whether or not to raise error/warning message if
......
...@@ -152,6 +152,9 @@ def dnn_present(): ...@@ -152,6 +152,9 @@ def dnn_present():
dnn_present.avail = False dnn_present.avail = False
return False return False
if config.dnn.enabled == "no_check":
dnn_present.avail, dnn_present.msg = True, "presence check disabled by dnn.enabled flag"
else:
dnn_present.avail, dnn_present.msg = _dnn_check_compile() dnn_present.avail, dnn_present.msg = _dnn_check_compile()
if dnn_present.avail: if dnn_present.avail:
dnn_present.avail, dnn_present.msg = _dnn_check_version() dnn_present.avail, dnn_present.msg = _dnn_check_version()
......
...@@ -282,6 +282,8 @@ def dnn_available(): ...@@ -282,6 +282,8 @@ def dnn_available():
if dnn_available.avail is None and not cuda_available: if dnn_available.avail is None and not cuda_available:
dnn_available.msg = "CUDA not available" dnn_available.msg = "CUDA not available"
dnn_available.avail = False dnn_available.avail = False
elif config.dnn.enabled == "no_check":
raise RuntimeException("The old gpu back-end do not support the flag dnn.enabled=no_check")
elif dnn_available.avail is None: elif dnn_available.avail is None:
dev = active_device_number() dev = active_device_number()
if device_properties(dev)['major'] < 3: if device_properties(dev)['major'] < 3:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论