Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to have evaluator not evaluate on first iteration #261

Open
bpbrown opened this issue Aug 3, 2023 · 1 comment
Open

Add option to have evaluator not evaluate on first iteration #261

bpbrown opened this issue Aug 3, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@bpbrown
Copy link
Contributor

bpbrown commented Aug 3, 2023

There are use cases (e.g., checkpointing) where it might be useful to have a particular handler in the evaluator system not evaluate on the first iteration. As a positive, this change would reduce startup time and disk usage. As a negative, this change would lose the automatic recording of the initial conditions (but would be user controlled and default to false)

Usage might go something like this:

checkpoints = solver.evaluator.add_file_handler('checkpoints', wall_dt=checkpoint_wall_dt, max_writes=1, skip_first_evaluation=True)

with a rough sketch of the implementation looking something like this:

class Handler:
<...>
    def __init__(self, dist, vars, group=None, wall_dt=None, sim_dt=None, iter=None, custom_schedule=None, skip_first_evaluation=None):
         <...>
         if skip_first_evaluation:
            self.last_wall_div = np.inf
            self.last_sim_div = np.inf
            self.last_iter_div = np.inf
        else:
            # Set initial divisors to be -1 to trigger output on first iteration
            self.last_wall_div = -1
            self.last_sim_div = -1
            self.last_iter_div = -1
@kburns
Copy link
Member

kburns commented Aug 4, 2023

I think the initial divisors should be 0 to skip the first evaluation?

@kburns kburns added the enhancement New feature or request label Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants