提交 abe6574c authored 作者: Frédéric Bastien's avatar Frédéric Bastien 提交者: GitHub

Merge pull request #5599 from lamblin/print_scan_profile

Print scan profile again
...@@ -9,30 +9,29 @@ ProfileStats object for runtime and memory profiling. ...@@ -9,30 +9,29 @@ ProfileStats object for runtime and memory profiling.
# #
from __future__ import absolute_import, print_function, division from __future__ import absolute_import, print_function, division
import logging
__authors__ = "James Bergstra"
__reviewer__ = "Razvan Pascanu"
__copyright__ = "(c) 2011, Universite de Montreal"
__license__ = "3-clause BSD License"
__contact__ = "theano-dev <theano-dev@googlegroups.com>"
__docformat__ = "restructuredtext en"
import atexit import atexit
import copy import copy
import logging
import operator import operator
import os import os
import sys import sys
import time import time
from collections import defaultdict from collections import defaultdict
from six import iteritems
import numpy as np import numpy as np
import theano import theano
from six import iteritems
from theano.gof import graph from theano.gof import graph
__authors__ = "James Bergstra"
__reviewer__ = "Razvan Pascanu"
__copyright__ = "(c) 2011, Universite de Montreal"
__license__ = "3-clause BSD License"
__contact__ = "theano-dev <theano-dev@googlegroups.com>"
__docformat__ = "restructuredtext en"
logger = logging.getLogger('theano.compile.profiling') logger = logging.getLogger('theano.compile.profiling')
theano_imported_time = time.time() theano_imported_time = time.time()
...@@ -62,8 +61,9 @@ def _atexit_print_fn(): ...@@ -62,8 +61,9 @@ def _atexit_print_fn():
# Reverse sort in the order of compile+exec time # Reverse sort in the order of compile+exec time
for ps in sorted(_atexit_print_list, for ps in sorted(_atexit_print_list,
key=lambda a:a.compile_time + a.fct_call_time)[::-1]: key=lambda a: a.compile_time + a.fct_call_time)[::-1]:
if ps.fct_callcount >= 1 or ps.compile_time > 1: if (ps.fct_callcount >= 1 or ps.compile_time > 1 or
getattr(ps, 'callcount', 0) > 1):
ps.summary(file=destination_file, ps.summary(file=destination_file,
n_ops_to_print=config.profiling.n_ops, n_ops_to_print=config.profiling.n_ops,
n_apply_to_print=config.profiling.n_apply) n_apply_to_print=config.profiling.n_apply)
...@@ -115,6 +115,7 @@ def _atexit_print_fn(): ...@@ -115,6 +115,7 @@ def _atexit_print_fn():
if config.print_global_stats: if config.print_global_stats:
print_global_stats() print_global_stats()
def print_global_stats(): def print_global_stats():
""" """
Print the following stats: Print the following stats:
...@@ -132,7 +133,7 @@ def print_global_stats(): ...@@ -132,7 +133,7 @@ def print_global_stats():
else: else:
destination_file = open(config.profiling.destination, 'w') destination_file = open(config.profiling.destination, 'w')
print('='*50, file=destination_file) print('=' * 50, file=destination_file)
print('Global stats: ', print('Global stats: ',
'Time elasped since Theano import = %6.3fs, ' 'Time elasped since Theano import = %6.3fs, '
'Time spent in Theano functions = %6.3fs, ' 'Time spent in Theano functions = %6.3fs, '
...@@ -143,7 +144,7 @@ def print_global_stats(): ...@@ -143,7 +144,7 @@ def print_global_stats():
total_graph_opt_time, total_graph_opt_time,
total_time_linker), total_time_linker),
file=destination_file) file=destination_file)
print('='*50, file=destination_file) print('=' * 50, file=destination_file)
class ProfileStats(object): class ProfileStats(object):
......
...@@ -37,7 +37,6 @@ whitelist_flake8 = [ ...@@ -37,7 +37,6 @@ whitelist_flake8 = [
"__init__.py", "__init__.py",
"tests/__init__.py", "tests/__init__.py",
"compile/__init__.py", "compile/__init__.py",
"compile/profiling.py",
"compile/sandbox/__init__.py", "compile/sandbox/__init__.py",
"compile/tests/__init__.py", "compile/tests/__init__.py",
"gpuarray/__init__.py", "gpuarray/__init__.py",
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论