Skip to content

Commit

Permalink
Improved filtering of restarted values in post processing and more ou…
Browse files Browse the repository at this point in the history
…tput (#344)

* Upper case communication in convergence controllers and better initial
guess for RK methods

* Added new Hot Rod version

* Improved filtering of restarts and more output

---------

Co-authored-by: Thomas Baumann <[email protected]>
  • Loading branch information
brownbaerchen and Thomas Baumann authored Aug 8, 2023
1 parent eba1a0d commit 196ae36
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
11 changes: 7 additions & 4 deletions pySDC/helpers/stats_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,16 @@ def filter_stats(
# delete values that have been recorded and superseded by similar, but not identical keys
times_restarted = np.unique([me.time for me in result.keys() if me.num_restarts > 0])
for t in times_restarted:
restarts = [(me.type, me.num_restarts) for me in filter_stats(result, time=t).keys()]
restarts = {}
for me in filter_stats(result, time=t).keys():
restarts[me.type] = max([restarts.get(me.type, 0), me.num_restarts])

[
[
[result.pop(you, None) for you in filter_stats(result, time=t, type=me[0], num_restarts=i).keys()]
for i in range(me[1])
[result.pop(you, None) for you in filter_stats(result, time=t, type=type_, num_restarts=i).keys()]
for i in range(num_restarts_)
]
for me in restarts
for type_, num_restarts_ in restarts.items()
]

# delete values that were recorded at times that shouldn't be recorded because we performed a different step after the restart
Expand Down
4 changes: 2 additions & 2 deletions pySDC/implementations/controller_classes/controller_nonMPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ def __init__(self, num_procs, controller_params, description):
for _ in range(num_procs - 1):
self.MS.append(dill.copy(self.MS[0]))
# if this fails (e.g. due to un-picklable data in the steps), initialize separately
except (dill.PicklingError, TypeError):
self.logger.warning('Need to initialize steps separately due to pickling error')
except (dill.PicklingError, TypeError) as error:
self.logger.warning(f'Need to initialize steps separately due to pickling error: {error}')
for _ in range(num_procs - 1):
self.MS.append(stepclass.step(description))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,14 @@ def get_step_from_which_to_spread(self, restarts, new_steps, size, S):
else:
# we want to spread the smallest step size out of the steps that want to be restarted
spread_from_step = restart_at + np.argmin(new_steps[restart_at:])
self.debug(f'Detected restart from step {restart_at}. Spreading step size from step {spread_from_step}.', S)
self.debug(
f'Detected restart from step {restart_at}. Spreading step size from step {spread_from_step}: {new_steps[restart_at]:.2e}.',
S,
)
else:
restart_at = size - 1
spread_from_step = restart_at
self.debug('Spreading step size from last step.', S)
self.debug(f'Spreading step size from last step: {new_steps[restart_at]:.2e}.', S)

return spread_from_step, restart_at

Expand Down
1 change: 1 addition & 0 deletions pySDC/implementations/hooks/default_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ def post_run(self, step, level_number):
type='timing_run',
value=self.__t1_run - self.__t0_run,
)
self.logger.info(f'Finished run after {self.__t1_run - self.__t0_run:.2f}s')

def post_setup(self, step, level_number):
"""
Expand Down

0 comments on commit 196ae36

Please sign in to comment.