diff --git a/hysop/core/graph/computational_graph.py b/hysop/core/graph/computational_graph.py index 0770fd5aa51f451bfffc4a5113ccc59d8dd08937..2d724544ef6f39bf083f6ab33c2c6ed670c54774 100644 --- a/hysop/core/graph/computational_graph.py +++ b/hysop/core/graph/computational_graph.py @@ -529,17 +529,24 @@ class ComputationalGraph(ComputationalGraphNode, metaclass=ABCMeta): for (i, op) in enumerate(n): yield (iprefix+str(i), pnprefix+op.pretty_name, nprefix+op.name, op) if isinstance(op, Problem): - for _ in __recurse_nodes(op.nodes, iprefix+str(i)+":", pnprefix+op.pretty_name+".", nprefix+op.name+"."): - yield _ + yield from __recurse_nodes(op.nodes, + iprefix+str(i)+":", + pnprefix+op.pretty_name+".", + nprefix+op.name+".") + + def __line(_i, _pn, _op, _k): + strdata = (_i, str(_op.mpi_params.task_id), _pn, type(_op).__name__, _k.split('.')[-1]) + values = tuple(ff.format(self._profiler.all_data[_k][_]) + for ff, _ in zip(("{:.5g}", "{}", "{:.5g}", "{:.5g}", "{:.5g}", "{}"), + (2, 1, 3, 4, 5, 0))) + return multiline_split(strdata + values, maxlen, split_sep, replace, newline_prefix) ops, already_printed = [], [] + ops += __line('', "MAIN", self, self.name+'.apply') for (i, pn, n, op) in __recurse_nodes(self.nodes, nprefix=self.name+"."): for k in self._profiler.all_data.keys(): if n == '.'.join(k.split('.')[:-1]) and not k in already_printed: - strdata = (i, str(op.mpi_params.task_id), pn, type(op).__name__, k.split('.')[-1]) - values = tuple(ff.format(self._profiler.all_data[k][_]) - for ff, _ in zip(("{:.5g}", "{}", "{:.5g}", "{:.5g}", "{:.5g}", "{}"), (2, 1, 3, 4, 5, 0))) - ops += multiline_split(strdata + values, maxlen, split_sep, replace, newline_prefix) + ops += __line(i, pn, op, k) already_printed.append(k) isize = max(strlen(s[0]) for s in ops) diff --git a/hysop/tools/profiler.py b/hysop/tools/profiler.py index f665c4fc084126a4e2120c485540c1a3f93af1a2..374922fd6758f46a4460871322c0a262254a4899 100644 --- a/hysop/tools/profiler.py +++ b/hysop/tools/profiler.py @@ -229,7 +229,7 @@ class Profiler(object): nb = comm.allgather(len(self.table)) all_names = comm.allgather([_[0] for _ in self.table]) all_times = comm.allgather([_[1] for _ in self.table]) - all_calls = comm.allgather([_[2] for _ in self.table]) + all_calls = comm.allgather([int(_[2]) for _ in self.table]) all_data = {} # all_data structure : task_size, calls nb, self total, task mean, task min, task max nelem = 6 @@ -243,7 +243,7 @@ class Profiler(object): all_data[n][2] = t all_data[n][nelem].append(t) for n in all_data.keys(): - all_data[n][1] /= all_data[n][0] + all_data[n][1] //= all_data[n][0] all_data[n][3] = npw.average(all_data[n][nelem]) all_data[n][4] = npw.min(all_data[n][nelem]) all_data[n][5] = npw.max(all_data[n][nelem])