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

MCPopulation now gives walkers useful walker and parent ids #5063

Merged
merged 6 commits into from
Jun 28, 2024

Conversation

PDoakORNL
Copy link
Contributor

@PDoakORNL PDoakORNL commented Jun 26, 2024

Proposed changes

segment of #5010
Walker

  • Fix bug with Walker constructor that ignored walker_id, parent_id arguments.
  • Add useful documentation to Walker.h

MCPopulation

  • Refactor into MCPopulation the fission of high multiplicity walkers into 2 or more walkers.
  • Generate walker_ids for walkers for each trajectory they start. (i.e. a life)
  • Assign parent id of new walkers in useful way.
  • Expand in code documentation.

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

  • Bugfix
  • New feature
  • Refactoring (no functional changes, no api changes)
  • Testing changes (e.g. new unit/integration/performance tests)
  • Documentation or build script changes

There is should be no user observable change except due to #5019 where walker_id's will be different but still undependable.

Does this introduce a breaking change?

  • No

What systems has this change been tested on?

OSX laptop
linux x86 vm

Checklist

Update the following with a yes where the items apply. If you're unsure about any of them, don't hesitate to ask. This is
simply a reminder of what we are going to look for before merging your code.

  • 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
  • Yes This PR adds tests to cover any new code, or to catch a bug that is being fixed
  • Yes Documentation has been added (if appropriate)

Copy link
Contributor

@ye-luo ye-luo left a comment

Choose a reason for hiding this comment

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

Thank you for breaking up the initial PR.
I leave a few comments and questions but questions needs to be sorted out but should not be blocking.

src/Particle/Walker.h Show resolved Hide resolved
@@ -156,27 +210,27 @@ WalkerElementsRef MCPopulation::spawnWalker()
walkers_.back()->Age = 0;
walkers_.back()->Multiplicity = 1.0;
walkers_.back()->Weight = 1.0;
// this does count as a walker creation so it gets a new walker id
auto walker_id = nextWalkerID();
walkers_.back()->setWalkerID(walker_id);
Copy link
Contributor

Choose a reason for hiding this comment

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

Fuse the above 2 lines in one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems just as clear will do.

@@ -293,8 +347,16 @@ void MCPopulation::saveWalkerConfigurations(WalkerConfigurations& walker_configs
walker_configs.resize(walker_elec_particle_sets_.size(), elec_particle_set_->getTotalNum());
for (int iw = 0; iw < walker_elec_particle_sets_.size(); iw++)
{
// The semantics of this call are not what would I would expecte.
Copy link
Contributor

Choose a reason for hiding this comment

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

typo expect

src/QMCDrivers/MCPopulation.cpp Show resolved Hide resolved
for (size_t iw = 0; iw < num_walkers_plus_reserve; iw++)
{
walkers_[iw] = std::make_unique<MCPWalker>(elec_particle_set_->getTotalNum());
int parent_id = 0;
walkers_[iw] = std::make_unique<MCPWalker>(walker_ids[iw], parent_id, elec_particle_set_->getTotalNum() );
Copy link
Contributor

Choose a reason for hiding this comment

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

could you do "0 /* parent_id */"?
Comment: shocked to find out Walker class has 4 constructors.

src/QMCDrivers/MCPopulation.cpp Outdated Show resolved Hide resolved
src/QMCDrivers/MCPopulation.cpp Show resolved Hide resolved
auto walker_id = nextWalkerID();
app_warning() << "Spawning walker ID " << walker_id << " this is living walker number " << walkers_.size()
<< "which is beyond the allocated walker reserves, ideally this should never happen." << '\n';
walkers_.push_back(std::make_unique<MCPWalker>(*(walkers_.back()), walker_id, 0));
Copy link
Contributor

Choose a reason for hiding this comment

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

put "0 /* parent_id */"

@ye-luo
Copy link
Contributor

ye-luo commented Jun 28, 2024

Please address the remaining minor issues and this PR will be ready to go.

@ye-luo
Copy link
Contributor

ye-luo commented Jun 28, 2024

Test this please

@ye-luo ye-luo enabled auto-merge June 28, 2024 15:58
@PDoakORNL
Copy link
Contributor Author

I have no ideas on the osx CI failure and can't reproduce it, I can't build with gcc-12 at all on my mac, there are problems just compiling with GCC-12 and the osx headers for me. Homebrew is onto gcc-14 at this point. gcc-14 has some sort of issue with catch. current llvm is fine.

@jptowns already reported this bus error but resolved it by going to gcc-14 but with M1/2 mac and not sure the OSX rev. But I have compile issues with that gcc in osx 14.5 on my x86 mac...

@ye-luo ye-luo merged commit c2d2665 into QMCPACK:develop Jun 28, 2024
37 of 38 checks passed
@ye-luo ye-luo mentioned this pull request Jul 25, 2024
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