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

Improve the integration of WalkerLog classes in batched drivers #5039

Merged
merged 10 commits into from
Jun 21, 2024

Conversation

ye-luo
Copy link
Contributor

@ye-luo ye-luo commented Jun 11, 2024

Proposed changes

Made the following changes.

  1. WalkerLogCollector now captures 'state' during construction. No more copy and update. This modification also requires WalkerLogCollector created via WalkerLogManager which provides 'state'.
  2. WalkerLogManager acquires a list of references of WalkerLogCollector from crowds at startRun and releases the reference at stopRun. Not using pointers directly any more
  3. wlog_collector_ are uniuqe_ptr in Crowd. I would like to eventually moving away it way from state.logs_active a deeply hidden state.
  4. wlog_manager is a function scoped object now.

What type(s) of changes does this code introduce?

  • Refactoring (no functional changes, no api changes)

Does this introduce a breaking change?

  • No

What systems has this change been tested on?

epyc-server

Checklist

  • Yes. This PR is up to date with current the current state of 'develop'
  • Yes. Code added or changed in the PR has been clang-formatted

This was referenced Jun 11, 2024
@ye-luo ye-luo changed the title [WIP] Address WalkerLog Improve the integration of WalkerLog classes in batched drivers Jun 13, 2024
Copy link
Contributor

@PDoakORNL PDoakORNL left a comment

Choose a reason for hiding this comment

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

Efficient improvement. The .release() into the legacy drivers is a nice trick. Think this just needs the noted. documentation addition.

src/QMCDrivers/Crowd.h Show resolved Hide resolved
PDoakORNL
PDoakORNL previously approved these changes Jun 14, 2024
@ye-luo
Copy link
Contributor Author

ye-luo commented Jun 18, 2024

@jtkrogel could you review?

Copy link
Contributor

@jtkrogel jtkrogel left a comment

Choose a reason for hiding this comment

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

Just one addition requested below (logic check).

Overall, the change to a "capture" style for collectors makes the WalkerLogManager function API ambiguous due to semi-ownership of the collectors. Functions accepting collectors or not seems like an arbitrary choice, potentially raising questions as to whether the collectors passed in to a member function should ever differ from the captured set (they shouldn't). Despite this, I don't think its a blocking issue.

src/QMCDrivers/VMC/VMCBatched.cpp Show resolved Hide resolved
src/QMCDrivers/WalkerLogManager.cpp Show resolved Hide resolved
@ye-luo
Copy link
Contributor Author

ye-luo commented Jun 21, 2024

writebuffer requires the same set of collectors as startRun. Since the code has be changed to capture the set of references at the startRun, writebuffer doesn't need to take the set again as argument any longer.
startRun stopRun and writeBuffer are the only three public APIs. With PR, only startRun takes a set of references to collectors. So less error-prone.
Regarding private functions, I tried to leave the set of references to collectors as an argument if it helps making the function const. Such functions are more like free functions preferably not pulling member variables directly for exmaple checkCollectors. Regarding the other private member functions openFile openHDFFile, I feel there is some design but the implementation is incomplete and thus leave them as they are.

@ye-luo
Copy link
Contributor Author

ye-luo commented Jun 21, 2024

Test this please

Copy link
Contributor

@jtkrogel jtkrogel left a comment

Choose a reason for hiding this comment

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

Good enough.

@ye-luo ye-luo merged commit 5721c74 into QMCPACK:develop Jun 21, 2024
35 of 38 checks passed
@ye-luo ye-luo deleted the address-WalkerLog branch June 21, 2024 17:34
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.

3 participants