![]() |
QMCPACK
|
Public Types | |
using | Real = QMCTraits::RealType |
using | CrowdLogValues = std::unordered_map< std::string, std::vector< Vector< Real > >> |
![]() | |
using | QMCT = QMCTraits |
using | FullPrecRealType = QMCT::FullPrecRealType |
using | MCPWalker = Walker< QMCTraits, PtclOnLatticeTraits > |
using | Data = std::vector< QMCT::RealType > |
Public Member Functions | |
PerParticleHamiltonianLogger (PerParticleHamiltonianLoggerInput &&input, int rank) | |
PerParticleHamiltonianLogger (const PerParticleHamiltonianLogger &other, DataLocality data_locality) | |
void | accumulate (const RefVector< MCPWalker > &walkers, const RefVector< ParticleSet > &psets, const RefVector< TrialWaveFunction > &wfns, const RefVector< QMCHamiltonian > &hams, RandomBase< FullPrecRealType > &rng) override |
Accumulate whatever it is you are accumulating with respect to walkers. More... | |
UPtr< OperatorEstBase > | spawnCrowdClone () const override |
void | startBlock (int steps) override |
void | registerListeners (QMCHamiltonian &ham_leader) override |
Register 0-many listeners with a leading QMCHamiltonian instance i.e. More... | |
ListenerVector< Real >::ReportingFunction | getLogger () |
return lambda function to register as listener the purpose of this function is to factor out the production of the lambda for unit testing More... | |
void | collect (const RefVector< OperatorEstBase > &type_erased_operator_estimators) override |
Reduce estimator result data from crowds to rank. More... | |
void | write (CrowdLogValues &values, const std::vector< long > &walkers_ids) |
int | get_block () |
![]() | |
OperatorEstBase (DataLocality dl) | |
constructor More... | |
OperatorEstBase (const OperatorEstBase &oth) | |
Shallow copy constructor! This alows us to keep the default copy constructors for derived classes which is quite useful to the spawnCrowdClone design. More... | |
virtual | ~OperatorEstBase ()=default |
virtual destructor More... | |
virtual void | normalize (QMCT::RealType invToWgt) |
std::vector< QMCT::RealType > & | get_data () |
virtual void | registerOperatorEstimator (hdf_archive &file) |
void | write (hdf_archive &file) |
Write to previously registered observable_helper hdf5 wrapper. More... | |
void | zero () |
zero data appropriately for the DataLocality More... | |
QMCT::FullPrecRealType | get_walkers_weight () const |
Return the total walker weight for this block. More... | |
const std::string & | get_my_name () const |
bool | isListenerRequired () |
DataLocality | get_data_locality () const |
Private Attributes | |
bool | crowd_clone = false |
PerParticleHamiltonianLogger *const | rank_estimator_ |
PerParticleHamiltonianLoggerInput | input_ |
int | rank_ |
CrowdLogValues | values_ |
std::vector< long > | walker_ids_ |
const std::string | name_ {"PerParticleHamiltonianLogger"} |
std::fstream | rank_fstream_ |
std::mutex | write_lock |
int | block_ = 0 |
Additional Inherited Members | |
![]() | |
DataLocality | data_locality_ |
locality for accumulation of estimator data. More... | |
std::string | my_name_ |
name of this object – only used for debugging and h5 output More... | |
QMCT::FullPrecRealType | walkers_weight_ |
std::vector< ObservableHelper > | h5desc_ |
Data | data_ |
bool | requires_listener_ = false |
Definition at line 28 of file PerParticleHamiltonianLogger.h.
using CrowdLogValues = std::unordered_map<std::string, std::vector<Vector<Real> >> |
Definition at line 32 of file PerParticleHamiltonianLogger.h.
using Real = QMCTraits::RealType |
Definition at line 31 of file PerParticleHamiltonianLogger.h.
PerParticleHamiltonianLogger | ( | PerParticleHamiltonianLoggerInput && | input, |
int | rank | ||
) |
Definition at line 19 of file PerParticleHamiltonianLogger.cpp.
References qmcplusplus::crowd, PerParticleHamiltonianLoggerInput::get_name(), PerParticleHamiltonianLogger::input_, OperatorEstBase::my_name_, qmcplusplus::rank, PerParticleHamiltonianLogger::rank_, PerParticleHamiltonianLogger::rank_fstream_, and OperatorEstBase::requires_listener_.
PerParticleHamiltonianLogger | ( | const PerParticleHamiltonianLogger & | other, |
DataLocality | data_locality | ||
) |
Definition at line 29 of file PerParticleHamiltonianLogger.cpp.
References OperatorEstBase::data_locality_, OperatorEstBase::my_name_, PerParticleHamiltonianLogger::name_, and OperatorEstBase::requires_listener_.
|
overridevirtual |
Accumulate whatever it is you are accumulating with respect to walkers.
This method is assumed to be called from the crowd context It provides parallelism with respect to computational effort of the estimator without causing a global sync. Depending on data locality the accumlation of the result may be different from the single thread write directly into the OperatorEstimator data.
[in] | walkers | |
[in,out] | pset_target | crowd scope target pset (should be returned to starting state after call) |
[in] | psets | per walker psets |
[in] | wnfs | per walker TrialWaveFunction |
[in,out] | rng | crowd scope RandomGenerator |
Implements OperatorEstBase.
Definition at line 59 of file PerParticleHamiltonianLogger.cpp.
References PerParticleHamiltonianLogger::rank_estimator_, PerParticleHamiltonianLogger::values_, qmcplusplus::walker, PerParticleHamiltonianLogger::walker_ids_, qmcplusplus::hdf::walkers, and PerParticleHamiltonianLogger::write().
|
overridevirtual |
Reduce estimator result data from crowds to rank.
This is assumed to be called from only from one thread per crowds->rank reduction. Implied is this is during a global sync or there is a guarantee that the crowd operator estimators accumulation data is not being written to.
There could be concurrent operations inside the scope of the collect call.
Reimplemented from OperatorEstBase.
Definition at line 98 of file PerParticleHamiltonianLogger.cpp.
Referenced by qmcplusplus::TEST_CASE().
|
inline |
Definition at line 58 of file PerParticleHamiltonianLogger.h.
References PerParticleHamiltonianLogger::block_.
Referenced by qmcplusplus::TEST_CASE().
ListenerVector< QMCTraits::RealType >::ReportingFunction getLogger | ( | ) |
return lambda function to register as listener the purpose of this function is to factor out the production of the lambda for unit testing
[out] | values |
Definition at line 88 of file PerParticleHamiltonianLogger.cpp.
References PerParticleHamiltonianLogger::values_.
Referenced by PerParticleHamiltonianLogger::registerListeners().
|
overridevirtual |
Register 0-many listeners with a leading QMCHamiltonian instance i.e.
a QMCHamiltonian that has acquired the crowd scope QMCHamiltonianMultiWalkerResource. This must be called for each crowd scope estimator that listens to register listeners into the crowd scope QMCHamiltonianMultiWalkerResource.
Many estimators don't need per particle values so the default implementation is no op.
Reimplemented from OperatorEstBase.
Definition at line 103 of file PerParticleHamiltonianLogger.cpp.
References PerParticleHamiltonianLogger::getLogger(), QMCHamiltonian::mw_registerLocalEnergyListener(), and PerParticleHamiltonianLogger::name_.
|
overridevirtual |
Implements OperatorEstBase.
Definition at line 78 of file PerParticleHamiltonianLogger.cpp.
References OperatorEstBase::data_, and OperatorEstBase::data_locality_.
Referenced by qmcplusplus::TEST_CASE().
|
overridevirtual |
Implements OperatorEstBase.
Definition at line 109 of file PerParticleHamiltonianLogger.cpp.
References PerParticleHamiltonianLogger::block_, and PerParticleHamiltonianLogger::rank_fstream_.
Referenced by qmcplusplus::TEST_CASE().
void write | ( | CrowdLogValues & | values, |
const std::vector< long > & | walkers_ids | ||
) |
Definition at line 37 of file PerParticleHamiltonianLogger.cpp.
References PerParticleHamiltonianLoggerInput::get_to_stdout(), PerParticleHamiltonianLogger::input_, PerParticleHamiltonianLogger::rank_fstream_, and PerParticleHamiltonianLogger::write_lock.
Referenced by PerParticleHamiltonianLogger::accumulate().
|
private |
Definition at line 69 of file PerParticleHamiltonianLogger.h.
Referenced by PerParticleHamiltonianLogger::get_block(), and PerParticleHamiltonianLogger::startBlock().
|
private |
Definition at line 60 of file PerParticleHamiltonianLogger.h.
|
private |
Definition at line 62 of file PerParticleHamiltonianLogger.h.
Referenced by PerParticleHamiltonianLogger::PerParticleHamiltonianLogger(), and PerParticleHamiltonianLogger::write().
|
private |
Definition at line 66 of file PerParticleHamiltonianLogger.h.
Referenced by PerParticleHamiltonianLogger::PerParticleHamiltonianLogger(), and PerParticleHamiltonianLogger::registerListeners().
|
private |
Definition at line 63 of file PerParticleHamiltonianLogger.h.
Referenced by PerParticleHamiltonianLogger::PerParticleHamiltonianLogger().
|
private |
Definition at line 61 of file PerParticleHamiltonianLogger.h.
Referenced by PerParticleHamiltonianLogger::accumulate().
|
private |
Definition at line 67 of file PerParticleHamiltonianLogger.h.
Referenced by PerParticleHamiltonianLogger::PerParticleHamiltonianLogger(), PerParticleHamiltonianLogger::startBlock(), and PerParticleHamiltonianLogger::write().
|
private |
Definition at line 64 of file PerParticleHamiltonianLogger.h.
Referenced by PerParticleHamiltonianLogger::accumulate(), and PerParticleHamiltonianLogger::getLogger().
|
private |
Definition at line 65 of file PerParticleHamiltonianLogger.h.
Referenced by PerParticleHamiltonianLogger::accumulate().
|
private |
Definition at line 68 of file PerParticleHamiltonianLogger.h.
Referenced by PerParticleHamiltonianLogger::write().