QMCPACK
UnifiedDriverWalkerControlMPITest Class Reference

Once there is only one driver type rename. More...

+ Collaboration diagram for UnifiedDriverWalkerControlMPITest:

Public Member Functions

 UnifiedDriverWalkerControlMPITest ()
 
void testMultiplicity (std::vector< int > &rank_counts_expanded, std::vector< int > &rank_counts_after)
 
void testPopulationDiff (std::vector< int > &rank_counts_before, std::vector< int > &rank_counts_after)
 
void makeValidWalkers ()
 Getting the "fat" walker valid enough to be MPI swapable. More...
 

Static Public Member Functions

static void testNewDistribution (std::vector< int > &minus, std::vector< int > &plus)
 

Private Member Functions

void reportWalkersPerRank (Communicate *c, MCPopulation &pop)
 

Private Attributes

SetupPools dpools_
 
WalkerConfigurations walker_confs
 
UPtr< MCPopulationpop_
 
WalkerControl wc_
 

Detailed Description

Once there is only one driver type rename.

Definition at line 24 of file test_WalkerControl.h.

Constructor & Destructor Documentation

◆ UnifiedDriverWalkerControlMPITest()

Definition at line 33 of file test_WalkerControl.cpp.

References SetupPools::comm, UnifiedDriverWalkerControlMPITest::dpools_, SetupPools::hamiltonian_pool, qmcplusplus::num_ranks, SetupPools::particle_pool, UnifiedDriverWalkerControlMPITest::pop_, Communicate::rank(), Communicate::size(), UnifiedDriverWalkerControlMPITest::walker_confs, and SetupPools::wavefunction_pool.

34 {
35  int num_ranks = dpools_.comm->size();
36  if (num_ranks != 3)
37  throw std::runtime_error("Bad Rank Count, WalkerControlMPI tests can only be run with 3 MPI ranks.");
38  pop_ =
39  std::make_unique<MCPopulation>(num_ranks, dpools_.comm->rank(), dpools_.particle_pool->getParticleSet("e"),
40  dpools_.wavefunction_pool->getPrimary(), dpools_.hamiltonian_pool->getPrimary());
41 
42  pop_->createWalkers(1, walker_confs);
43 }
int rank() const
return the rank
Definition: Communicate.h:116
UPtr< ParticleSetPool > particle_pool
Definition: SetupPools.h:33
#define Random
UPtr< HamiltonianPool > hamiltonian_pool
Definition: SetupPools.h:35
int size() const
return the number of tasks
Definition: Communicate.h:118
UPtr< WaveFunctionPool > wavefunction_pool
Definition: SetupPools.h:34

Member Function Documentation

◆ makeValidWalkers()

void makeValidWalkers ( )

Getting the "fat" walker valid enough to be MPI swapable.

By no means is this "valid" from the perspective of running QMC See QMCDriverNew::initialLogEvaluation A fat walker does not seem to be "valid" until all that is done.

Definition at line 51 of file test_WalkerControl.cpp.

References UnifiedDriverWalkerControlMPITest::pop_.

52 {
53  auto walker_elements = pop_->get_walker_elements();
54 
55  for (auto we : walker_elements)
56  {
57  we.pset.update();
58  if (we.walker.DataSet.size() <= 0)
59  {
60  we.walker.registerData();
61  we.twf.registerData(we.pset, we.walker.DataSet);
62  we.walker.DataSet.allocate();
63  }
64  we.twf.copyFromBuffer(we.pset, we.walker.DataSet);
65  we.twf.evaluateLog(we.pset);
66  we.twf.updateBuffer(we.pset, we.walker.DataSet);
67  }
68 }

◆ reportWalkersPerRank()

void reportWalkersPerRank ( Communicate c,
MCPopulation pop 
)
private

Definition at line 70 of file test_WalkerControl.cpp.

References Communicate::allreduce(), MCPopulation::get_num_local_walkers(), Communicate::rank(), and Communicate::size().

71 {
72 #if !defined(NDEBUG)
73  std::vector<int> rank_walker_count(c->size(), 0);
74  rank_walker_count[c->rank()] = pop.get_num_local_walkers();
75  c->allreduce(rank_walker_count);
76 
77  const int current_population = std::accumulate(rank_walker_count.begin(), rank_walker_count.end(), 0);
78 
79  if (c->rank() == 0)
80  {
81  std::cout << "Walkers Per Rank (Total: " << current_population << ")\n";
82  for (int i = 0; i < rank_walker_count.size(); ++i)
83  {
84  std::cout << " " << i << " " << rank_walker_count[i] << '\n';
85  }
86  }
87 #endif
88 }
int rank() const
return the rank
Definition: Communicate.h:116
int size() const
return the number of tasks
Definition: Communicate.h:118
void allreduce(T &)

◆ testMultiplicity()

void testMultiplicity ( std::vector< int > &  rank_counts_expanded,
std::vector< int > &  rank_counts_after 
)

◆ testNewDistribution()

void testNewDistribution ( std::vector< int > &  minus,
std::vector< int > &  plus 
)
static

Definition at line 90 of file test_WalkerControl.cpp.

References WalkerControl::determineNewWalkerPopulation().

Referenced by qmcplusplus::TEST_CASE().

91 {
92  std::vector<int> num_per_rank = {3, 1, 1};
93  std::vector<int> fair_offset;
94  WalkerControl::determineNewWalkerPopulation(num_per_rank, fair_offset, minus, plus);
95 }
static void determineNewWalkerPopulation(const std::vector< int > &num_per_rank, std::vector< int > &fair_offset, std::vector< int > &minus, std::vector< int > &plus)
creates the distribution plan

◆ testPopulationDiff()

void testPopulationDiff ( std::vector< int > &  rank_counts_before,
std::vector< int > &  rank_counts_after 
)

Member Data Documentation

◆ dpools_

◆ pop_

◆ walker_confs

◆ wc_

WalkerControl wc_
private

Definition at line 39 of file test_WalkerControl.h.


The documentation for this class was generated from the following files: