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

Flush only when necessary #21

Closed
wants to merge 2 commits into from
Closed

Flush only when necessary #21

wants to merge 2 commits into from

Conversation

hwijeen
Copy link
Collaborator

@hwijeen hwijeen commented Nov 24, 2023

#20

Comment on lines +248 to +249
if self.save:
self.storage_handler.flush()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One qq, if we do not flush on the exit, when will it be flushed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will never be flushed if self.save is set to False. (e.g. we don't need to save anything when logging Hessian)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh okay, gotcha.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In such case, why don'y we just change the flush() function?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh you mean flush being a no-op when self.save is False. That would also do!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! In that way, we don't have to write an if statement every time 'flush' is called, rather leave the code as it is and just make the flush to do dry run or perhaps just clear the memory!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sg! I'll close this PR then.

@hwijeen hwijeen closed this Nov 28, 2023
@hwijeen hwijeen deleted the flushOnlyWhenNecessary branch December 3, 2023 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants