提交 501ccde5 authored 作者: Frédéric Bastien's avatar Frédéric Bastien

Merge pull request #1975 from rahul003/profiling

fix crash of profiling atexit when it clashes with pycuda atexit handler
...@@ -31,6 +31,7 @@ config = theano.config ...@@ -31,6 +31,7 @@ config = theano.config
_atexit_print_list = [] _atexit_print_list = []
_atexit_print_file = sys.stderr _atexit_print_file = sys.stderr
_atexit_registered = False
AddConfigVar('profiling.time_thunks', AddConfigVar('profiling.time_thunks',
"""Time individual thunks when profiling""", """Time individual thunks when profiling""",
...@@ -99,7 +100,7 @@ def _atexit_print_fn(): ...@@ -99,7 +100,7 @@ def _atexit_print_fn():
n_apply_to_print=config.profiling.n_apply) n_apply_to_print=config.profiling.n_apply)
atexit.register(_atexit_print_fn)
class ProfileStats(object): class ProfileStats(object):
...@@ -208,6 +209,10 @@ class ProfileStats(object): ...@@ -208,6 +209,10 @@ class ProfileStats(object):
if atexit_print: if atexit_print:
global _atexit_print_list global _atexit_print_list
_atexit_print_list.append(self) _atexit_print_list.append(self)
global _atexit_registered
if not _atexit_registered:
atexit.register(_atexit_print_fn)
_atexit_registered = True
def class_time(self): def class_time(self):
"""dict op -> total time on thunks""" """dict op -> total time on thunks"""
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论