7 Represents single output file dumped by Peano
9 This class extracts all the load balancing-related information from
10 an output file, i.e. is basically an abstraction of a file parser.
11 It also holds some very basic runtime data.
29 Parse Peano output file
31 Build up a tuple of (x_data,y_data_local,y_data_remote) internally
32 but also extract some meta data
41 print(
"parse file {}".format( self.
_file_name) )
48 if "build:" in line
and "no mpi" in line:
50 print(
"code does not use MPI" )
52 if "build:" in line
and "threads" in line:
53 self.
_threads = int( line.split(
"threads" )[0].split(
"(" )[-1])
55 print(
"code uses " + str(self.
_threads) +
" threads per rank" )
56 if "manually reset number of threads used to" in line:
57 self.
_threads = int( line.split(
"to" )[1])
59 print(
"code sets number of threads manually to " + str(self.
_threads) )
60 if "build:" in line
and "ranks)" in line:
61 self.
_ranks = int( line.split(
"ranks)" )[0].split(
"(")[1])
63 print(
"code uses " + str(self.
_ranks) +
" ranks" )
65 if "time stepping:" in line:
66 self.
_runtime = float( line.split(
"time stepping:" )[1].split(
"s")[0] )
68 print(
"code runs for " + str(self.
_runtime) +
"s" )
71 if "toolbox::loadbalancing::dumpStatistics" in line:
73 current_rank = int( line.split(
"rank:" )[1].split(
" ")[0] )
79 print(
"create new dataset for rank {}".format(current_rank) )
81 self.
_snapshot_lines[ current_rank ].append( line.split(
"toolbox::loadbalancing::dumpStatistics()")[1] )
104 Read out the total runtime
116 Return a sequence of integers that holds the number of trees per snapshot
125 number_of_trees = int( entry.split(
"tree(s)" )[0] )
126 result.append( number_of_trees )
136 Return local cells per snaphot
138 This is a sequence of sequences. For each snapshot for this
139 rank, we store one sequence with all the local cells in this
140 snapshot. The standard plot_load_distribution.py script feeds
141 this data into a scatter plot. For many cases, we might however
142 be interested in the maximum value:
144 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
145 raw_data = ouput_file.local_cells_per_snapshot(rank)
146 max_data = [max(x) for x in raw_data ]
147 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
157 tree_entries_in_line = snapshot.split(
"(#")
158 for tree_entry
in tree_entries_in_line[1:]:
159 new_count = int( tree_entry.split(
":")[1].split(
"/")[0] )
160 result[-1].append(new_count)
170 Return local cells per snaphot
172 This is a sequence of sequences. For each snapshot for this
173 rank, we store one sequence with all the local cells in this
184 tree_entries_in_line = snapshot.split(
"(#")
185 for tree_entry
in tree_entries_in_line[1:]:
186 new_count = int( tree_entry.split(
"/")[1].split(
")")[0] )
187 result[-1].append(new_count)
197 Return the total number of cells per snapshot for this rank
199 The total number of cells is an interesting quantity, as it allows
200 us to compare the load of different ranks.
206 for snapshot_data
in local_cell_per_snapshot:
207 new_entry = sum( snapshot_data )
208 result.append(new_entry)
217 Return the total number of cells per snapshot for this rank
219 The total number of cells is an interesting quantity, as it allows
220 us to compare the load of different ranks.
226 for snapshot_data
in local_cell_per_snapshot:
227 new_entry = min( snapshot_data )
228 result.append(new_entry)
237 Return the total number of cells per snapshot for this rank
239 The total number of cells is an interesting quantity, as it allows
240 us to compare the load of different ranks.
246 for snapshot_data
in local_cell_per_snapshot:
247 new_entry = max( snapshot_data )
248 result.append(new_entry)
257 Return the total number of cells per snapshot for this rank
259 The total number of cells is an interesting quantity, as it allows
260 us to compare the load of different ranks.
266 for snapshot_data
in virtual_cell_per_snapshot:
267 new_entry = min( snapshot_data )
268 result.append(new_entry)
277 Return the total number of cells per snapshot for this rank
279 The total number of cells is an interesting quantity, as it allows
280 us to compare the load of different ranks.
286 for snapshot_data
in virtual_cell_per_snapshot:
287 new_entry = max( snapshot_data )
288 result.append(new_entry)
293 return hasattr(self,
"_runtime")
Represents single output file dumped by Peano.
min_local_cells_per_snapshot(self, rank)
Return the total number of cells per snapshot for this rank.
total_local_cells_per_snapshot(self, rank)
Return the total number of cells per snapshot for this rank.
min_virtual_cells_per_snapshot(self, rank)
Return the total number of cells per snapshot for this rank.
trees_per_snapshot(self, rank)
Return a sequence of integers that holds the number of trees per snapshot.
virtual_cells_per_snapshot(self, rank)
Return local cells per snaphot.
__init__(self, name, verbose=False)
runtime(self)
Read out the total runtime.
max_local_cells_per_snapshot(self, rank)
Return the total number of cells per snapshot for this rank.
parse(self)
Parse Peano output file.
local_cells_per_snapshot(self, rank)
Return local cells per snaphot.
max_virtual_cells_per_snapshot(self, rank)
Return the total number of cells per snapshot for this rank.