![]() |
QMCPACK
|
Class to handle walker controls with simple global sum. More...
Public Member Functions | |
WalkerControlMPI (Communicate *comm) | |
default constructor More... | |
int | branch (int iter, MCWalkerConfiguration &W, FullPrecRealType trigger) override |
legacy: perform branch and swap walkers as required More... | |
void | swapWalkersSimple (MCWalkerConfiguration &W) |
legacy: swap implementation More... | |
![]() | |
WalkerControlBase (Communicate *c) | |
default constructor More... | |
virtual | ~WalkerControlBase () |
empty destructor to clean up the derived classes More... | |
void | start () |
start a block More... | |
void | setWalkerID (MCWalkerConfiguration &walkers) |
start controller and initialize the IDs of walkers More... | |
void | measureProperties (int iter) |
take averages and writes to a file More... | |
void | setTrialEnergy (FullPrecRealType et) |
set the trial energy More... | |
FullPrecRealType | getValue (int i) |
return a value accumulated during a block More... | |
FullPrecRealType | getCurrentValue (int i) |
return a current value More... | |
int | doNotBranch (int iter, MCWalkerConfiguration &W) |
legacy: return global population update properties without branching More... | |
int | sortWalkers (MCWalkerConfiguration &W) |
legacy: sort Walkers between good and bad and prepare branching More... | |
int | applyNmaxNmin (int current_population) |
legacy: apply per rank limit Nmax and Nmin More... | |
int | copyWalkers (MCWalkerConfiguration &W) |
legacy: copy good walkers to W More... | |
virtual void | reset () |
reset to accumulate data More... | |
bool | put (xmlNodePtr cur) |
void | setMinMax (int nw_in, int nmax_in) |
int | get_n_max () const |
int | get_n_min () const |
FullPrecRealType | get_target_sigma () const |
MCDataType< FullPrecRealType > & | get_ensemble_property () |
void | set_ensemble_property (MCDataType< FullPrecRealType > &ensemble_property) |
IndexType | get_num_contexts () const |
IndexType | get_method () const |
void | set_method (IndexType method) |
![]() | |
MPIObjectBase (Communicate *c) | |
constructor with communicator More... | |
int | rank () const |
return the rank of the communicator More... | |
int | getGroupID () const |
return the group id of the communicator More... | |
Communicate * | getCommunicator () const |
return myComm More... | |
Communicate & | getCommRef () const |
return a TEMPORARY reference to Communicate More... | |
mpi_comm_type | getMPI () const |
return MPI communicator if one wants to use MPI directly More... | |
bool | is_manager () const |
return true if the rank == 0 More... | |
const std::string & | getName () const |
return the name More... | |
void | setName (const std::string &aname) |
Static Public Member Functions | |
static void | determineNewWalkerPopulation (int cur_pop, int num_contexts, int my_context, std::vector< int > &num_per_rank, std::vector< int > &fair_offset, std::vector< int > &minus, std::vector< int > &plus) |
creates the distribution plan More... | |
![]() | |
static std::vector< IndexType > | syncFutureWalkersPerRank (Communicate *comm, IndexType n_walkers) |
Public Attributes | |
int | Cur_pop |
int | Cur_max |
int | Cur_min |
TimerList_t | myTimers |
IndexType | NumWalkersSent |
friend | WalkerControlMPITest |
Additional Inherited Members | |
![]() | |
enum | { ENERGY_INDEX = 0, ENERGY_SQ_INDEX, WALKERSIZE_INDEX, WEIGHT_INDEX, EREF_INDEX, R2ACCEPTED_INDEX, R2PROPOSED_INDEX, FNSIZE_INDEX, RNONESIZE_INDEX, RNSIZE_INDEX, B_ENERGY_INDEX, B_WGT_INDEX, SENTWALKERS_INDEX, LE_MAX } |
An enum to access curData and accumData for reduction. More... | |
using | Walker_t = MCWalkerConfiguration::Walker_t |
typedef of Walker_t More... | |
using | FullPrecRealType = QMCTraits::FullPrecRealType |
typedef of FullPrecRealType More... | |
using | IndexType = QMCTraits::IndexType |
typedef of IndexType More... | |
![]() | |
using | mpi_comm_type = Communicate::mpi_comm_type |
![]() | |
IndexType | method_ |
id for the method More... | |
IndexType | n_min_ |
minimum number of walkers More... | |
IndexType | n_max_ |
maximum number of walkers More... | |
IndexType | MaxCopy |
maximum copy per walker More... | |
IndexType | NumWalkers |
current number of walkers per processor More... | |
FullPrecRealType | trialEnergy |
trial energy energy More... | |
FullPrecRealType | target_sigma_ |
target sigma to limit fluctuations of the trial energy More... | |
std::vector< int > | NumPerRank |
number of particle per rank More... | |
std::vector< int > | OffSet |
offset of the particle index More... | |
std::vector< int > | FairOffSet |
offset of the particle index for a fair distribution More... | |
std::filesystem::path | dmcFname |
filename for dmc.dat More... | |
std::unique_ptr< std::ofstream > | dmcStream |
file to save energy histogram More... | |
IndexType | NumWalkersCreated |
Number of walkers created by this rank. More... | |
IndexType | MyContext |
context id More... | |
IndexType | num_contexts_ |
number of contexts More... | |
IndexType | SwapMode |
0 is default More... | |
std::vector< FullPrecRealType > | accumData |
any accumulated data over a block More... | |
std::vector< FullPrecRealType > | curData |
any temporary data includes many ridiculous conversions of integral types to and from fp More... | |
std::vector< std::unique_ptr< Walker_t > > | good_w |
temporary storage for good and bad walkers More... | |
std::vector< std::unique_ptr< Walker_t > > | bad_w |
std::vector< int > | ncopy_w |
temporary storage for copy counters More... | |
bool | use_nonblocking |
Use non-blocking isend/irecv. More... | |
MCDataType< FullPrecRealType > | ensemble_property_ |
ensemble properties More... | |
![]() | |
Communicate * | myComm |
pointer to Communicate More... | |
std::string | ClassName |
class Name More... | |
std::string | myName |
name of the object More... | |
Class to handle walker controls with simple global sum.
Base class to handle serial mode with branching only
Definition at line 30 of file WalkerControlMPI.h.
WalkerControlMPI | ( | Communicate * | c | ) |
default constructor
[in] | comm | can not be null it is not checked. |
set SwapMode? SwapMode is set to 1 but what does that mean? This object persists inside the SFNB which also persists The zeroing here will not happen in later QMC sections... This seems problematic in that NumWalkersSent will start at a value of no concern to the current section.
In the new drivers SFNB should throw an except if there is attempted reuse of WalkerController
Definition at line 61 of file WalkerControlMPI.cpp.
References WalkerControlMPI::Cur_max, WalkerControlMPI::Cur_min, WalkerControlMPI::NumWalkersSent, and WalkerControlBase::SwapMode.
|
overridevirtual |
legacy: perform branch and swap walkers as required
Perform branch and swap walkers as required.
It takes 5 steps:
Reimplemented from WalkerControlBase.
Definition at line 85 of file WalkerControlMPI.cpp.
References Communicate::allreduce(), WalkerControlBase::applyNmaxNmin(), WalkerControlBase::copyWalkers(), WalkerControlMPI::Cur_pop, WalkerControlBase::curData, qmcplusplus::DMC_MPI_allreduce, qmcplusplus::DMC_MPI_branch, qmcplusplus::DMC_MPI_copyWalkers, qmcplusplus::DMC_MPI_loadbalance, qmcplusplus::DMC_MPI_prebalance, WalkerControlBase::ensemble_property_, WalkerConfigurations::EnsembleProperty, WalkerControlBase::FairOffSet, WalkerControlBase::LE_MAX, WalkerControlBase::measureProperties(), MPIObjectBase::myComm, WalkerControlBase::MyContext, WalkerControlMPI::myTimers, WalkerControlBase::num_contexts_, WalkerControlBase::NumPerRank, WalkerControlBase::NumWalkers, WalkerControlMPI::NumWalkersSent, WalkerControlBase::SENTWALKERS_INDEX, WalkerControlBase::sortWalkers(), WalkerControlMPI::swapWalkersSimple(), and qmcplusplus::walker.
|
static |
creates the distribution plan
populates the minus and plus vectors they contain 1 copy of a partition index for each adjustment in population to the context.
[in] | cur_pop_pop | population taking multiplicity into account |
[in] | num_contexts | number of MPI processes |
[in] | my_context | i.e this processes MPI rank |
[in/out] | num_per_rank as if all walkers were copied out to multiplicity | |
[out] | fair_offset | running population count at each partition boundary |
[out] | minus | list of partition indexes one occurrence for each walker removed |
[out] | plus | list of partition indexes one occurrence for each walker added |
Definition at line 132 of file WalkerControlMPI.cpp.
References qmcplusplus::app_error(), and FairDivideLow().
Referenced by WalkerControlMPI::swapWalkersSimple(), and qmcplusplus::TEST_CASE().
void swapWalkersSimple | ( | MCWalkerConfiguration & | W | ) |
legacy: swap implementation
swap Walkers with Recv/Send or Irecv/Isend
The algorithm ensures that the load per rank can differ only by one walker. Each MPI rank can only send or receive or be silent. The communication is one-dimensional and very local. If multiple copies of a walker need to be sent to the target rank, only send one. The number of copies is communicated ahead via blocking send/recv. Then the walkers are transferred via blocking or non-blocking send/recv. The blocking send/recv may become serialized and worsen load imbalance. Non blocking send/recv algorithm avoids serialization completely.
Definition at line 177 of file WalkerControlMPI.cpp.
References APP_ABORT, qmcplusplus::app_error(), WalkerControlBase::bad_w, WalkerControlMPI::Cur_pop, WalkerControlMPI::determineNewWalkerPopulation(), qmcplusplus::DMC_MPI_recv, qmcplusplus::DMC_MPI_send, WalkerControlBase::FairOffSet, qmcplusplus::for(), WalkerControlBase::good_w, MPIObjectBase::myComm, WalkerControlBase::MyContext, WalkerControlMPI::myTimers, WalkerControlBase::ncopy_w, WalkerControlBase::num_contexts_, WalkerControlBase::NumPerRank, WalkerControlMPI::NumWalkersSent, qmcplusplus::Units::second, and WalkerControlBase::use_nonblocking.
Referenced by WalkerControlMPI::branch().
int Cur_max |
Definition at line 33 of file WalkerControlMPI.h.
Referenced by WalkerControlMPI::WalkerControlMPI().
int Cur_min |
Definition at line 34 of file WalkerControlMPI.h.
Referenced by WalkerControlMPI::WalkerControlMPI().
int Cur_pop |
Definition at line 32 of file WalkerControlMPI.h.
Referenced by WalkerControlMPI::branch(), and WalkerControlMPI::swapWalkersSimple().
TimerList_t myTimers |
Definition at line 35 of file WalkerControlMPI.h.
Referenced by WalkerControlMPI::branch(), and WalkerControlMPI::swapWalkersSimple().
IndexType NumWalkersSent |
Definition at line 39 of file WalkerControlMPI.h.
Referenced by WalkerControlMPI::branch(), WalkerControlMPI::swapWalkersSimple(), and WalkerControlMPI::WalkerControlMPI().
friend WalkerControlMPITest |
Definition at line 77 of file WalkerControlMPI.h.