@@ -29,6 +29,7 @@ def main():
2929 else :
3030 color = int (world_rank / 1 )
3131 space_comm = comm .Split (color = color )
32+ space_rank = space_comm .Get_rank ()
3233
3334 # split world communicator to create time-communicators
3435 if len (sys .argv ) == 2 :
@@ -70,8 +71,8 @@ def main():
7071
7172 # initialize controller parameters
7273 controller_params = dict ()
73- controller_params ['logger_level' ] = 20
74- # controller_params['predict '] = False
74+ controller_params ['logger_level' ] = 20 if space_rank == 0 else 99 # set level depending on rank
75+ controller_params ['dump_setup ' ] = False
7576
7677 # fill description dictionary for easy step instantiation
7778 description = dict ()
@@ -111,39 +112,41 @@ def main():
111112 # convert filtered statistics to list of iterations count, sorted by process
112113 iter_counts = sort_stats (filtered_stats , sortby = 'time' )
113114
114- f = open ('step_7_C_out.txt' , 'w' )
115+ niters = np .array ([item [1 ] for item in iter_counts ])
116+
117+ if space_rank == 0 :
118+ f = open ('step_7_C_out.txt' , 'w' )
119+
120+ # compute and print statistics
121+ for item in iter_counts :
122+ out = 'Number of iterations for time %4.2f: %2i' % item
123+ f .write (out + '\n ' )
124+ print (out )
115125
116- # compute and print statistics
117- for item in iter_counts :
118- out = 'Number of iterations for time %4.2f: %2i' % item
126+ out = ' Mean number of iterations: %4.2f' % np .mean (niters )
127+ f .write (out + '\n ' )
128+ print (out )
129+ out = ' Range of values for number of iterations: %2i ' % np .ptp (niters )
130+ f .write (out + '\n ' )
131+ print (out )
132+ out = ' Position of max/min number of iterations: %2i -- %2i' % \
133+ (int (np .argmax (niters )), int (np .argmin (niters )))
134+ f .write (out + '\n ' )
135+ print (out )
136+ out = ' Std and var for number of iterations: %4.2f -- %4.2f' % (float (np .std (niters )), float (np .var (niters )))
119137 f .write (out + '\n ' )
120138 print (out )
121139
122- niters = np .array ([item [1 ] for item in iter_counts ])
123- out = ' Mean number of iterations: %4.2f' % np .mean (niters )
124- f .write (out + '\n ' )
125- print (out )
126- out = ' Range of values for number of iterations: %2i ' % np .ptp (niters )
127- f .write (out + '\n ' )
128- print (out )
129- out = ' Position of max/min number of iterations: %2i -- %2i' % \
130- (int (np .argmax (niters )), int (np .argmin (niters )))
131- f .write (out + '\n ' )
132- print (out )
133- out = ' Std and var for number of iterations: %4.2f -- %4.2f' % (float (np .std (niters )), float (np .var (niters )))
134- f .write (out + '\n ' )
135- print (out )
136-
137- timing = sort_stats (filter_stats (stats , type = 'timing_run' ), sortby = 'time' )
138-
139- out = 'Time to solution: %6.4f sec.' % timing [0 ][1 ]
140- f .write (out + '\n ' )
141- print (out )
142- out = 'Error vs. PDE solution: %6.4e' % err
143- f .write (out + '\n ' )
144- print (out )
145-
146- f .close ()
140+ timing = sort_stats (filter_stats (stats , type = 'timing_run' ), sortby = 'time' )
141+
142+ out = 'Time to solution: %6.4f sec.' % timing [0 ][1 ]
143+ f .write (out + '\n ' )
144+ print (out )
145+ out = 'Error vs. PDE solution: %6.4e' % err
146+ f .write (out + '\n ' )
147+ print (out )
148+
149+ f .close ()
147150
148151 assert err < 2E-04 , 'ERROR: did not match error tolerance, got %s' % err
149152 assert np .mean (niters ) <= 12 , 'ERROR: number of iterations is too high, got %s' % np .mean (niters )
0 commit comments