![]() |
QMCPACK
|
class RandomNumberControl More...
Public Types | |
using | FullPrecRealType = QMCTraits::FullPrecRealType |
using | uint_type = RandomBase< FullPrecRealType >::uint_type |
![]() | |
enum | { useLIBXML = 0, useLIBXMLPP, usePLAIN } |
enumeration to choose the xml parser More... | |
Public Member Functions | |
RandomNumberControl (const char *aname="random") | |
constructors and destructors More... | |
bool | get (std::ostream &os) const override |
generic output More... | |
bool | put (std::istream &is) override |
generic input More... | |
bool | put (xmlNodePtr cur) override |
read from an xmlNode More... | |
void | reset () override |
reset the generator More... | |
xmlNodePtr | initialize (xmlXPathContextPtr) |
![]() | |
OhmmsElementBase (const char *aname="none") | |
constructor with a name More... | |
virtual | ~OhmmsElementBase () |
destructor More... | |
const std::string & | getName () const |
return the name More... | |
void | setName (const std::string &aname) |
set name More... | |
void | setIOMode (int imode) |
set iomode More... | |
virtual bool | add (xmlNodePtr parent) |
add a xmlNode to the children list of parent More... | |
void | put (const std::string &s) |
read from string More... | |
virtual void | begin_node (std::ostream &os) const |
write the start of a node More... | |
virtual void | end_node (std::ostream &os) const |
write the end of a node More... | |
Static Public Member Functions | |
static void | test () |
static void | make_seeds () |
reset the generator More... | |
static void | make_children () |
static void | read (const std::string &fname, Communicate *comm) |
read in parallel or serial More... | |
static void | write (const std::string &fname, Communicate *comm) |
write in parallel or serial More... | |
static void | write (const RefVector< RandomBase< FullPrecRealType >> &rng, const std::string &fname, Communicate *comm) |
write in parallel or serial More... | |
static void | read_parallel (hdf_archive &hin, Communicate *comm) |
read random state from a hdf file in parallel More... | |
static void | write_parallel (const RefVector< RandomBase< FullPrecRealType >> &rng, hdf_archive &hout, Communicate *comm) |
write random state to a hdf file in parallel More... | |
static void | read_rank_0 (hdf_archive &hin, Communicate *comm) |
rank 0 reads random states from a hdf file and distributes them to all the other ranks More... | |
static void | write_rank_0 (const RefVector< RandomBase< FullPrecRealType >> &rng, hdf_archive &hout, Communicate *comm) |
rank 0 gathers the random states from all the other ranks and write them to a hdf file More... | |
Static Public Attributes | |
static PrimeNumberSet< uint_type > | PrimeNumbers |
initialize the static data members More... | |
static UPtrVector< RandomBase< FullPrecRealType > > | Children |
Private Attributes | |
bool | NeverBeenInitialized |
xmlNodePtr | myCur |
Static Private Attributes | |
static uint_type | Offset = 11u |
Additional Inherited Members | |
![]() | |
int | myIOMode |
the type of IO mode: default is useLIBXML More... | |
std::string | myName |
the name of the node, corresponds to the xml tag More... | |
class RandomNumberControl
Encapsulate data to initialize and save the status of the random number generator
Default: myName = "random" 2007-12-01 Use PrimeNumbers to generate random seeds.
Definition at line 39 of file RandomNumberControl.h.
Definition at line 42 of file RandomNumberControl.h.
using uint_type = RandomBase<FullPrecRealType>::uint_type |
Definition at line 43 of file RandomNumberControl.h.
RandomNumberControl | ( | const char * | aname = "random" | ) |
constructors and destructors
Definition at line 36 of file RandomNumberControl.cpp.
|
overridevirtual |
generic output
Implements OhmmsElementBase.
Definition at line 41 of file RandomNumberControl.cpp.
References RandomNumberControl::Children, omp_get_max_threads(), and Random.
xmlNodePtr initialize | ( | xmlXPathContextPtr | acontext | ) |
Definition at line 98 of file RandomNumberControl.cpp.
References RandomNumberControl::myCur, and RandomNumberControl::put().
Referenced by QMCMain::execute(), qmcplusplus::TEST_CASE(), and QMCMain::validateXML().
|
static |
Definition at line 80 of file RandomNumberControl.cpp.
References RandomNumberControl::Children, OHMMS::Controller, PrimeNumberSet< UIntType >::get(), qmcplusplus::n, RandomNumberControl::Offset, omp_get_max_threads(), RandomNumberControl::PrimeNumbers, qmcplusplus::rank, Communicate::rank(), and Communicate::size().
Referenced by RandomNumberControl::make_seeds(), and RandomNumberControl::put().
|
static |
reset the generator
Definition at line 65 of file RandomNumberControl.cpp.
References qmcplusplus::bcast(), OHMMS::Controller, PrimeNumberSet< UIntType >::get(), RandomNumberControl::make_children(), RandomNumberControl::Offset, omp_get_max_threads(), RandomNumberControl::PrimeNumbers, Random, Communicate::rank(), and Communicate::size().
Referenced by QMCDriverNew::createRngsStepContexts(), QMCDriver::process(), RandomNumberControl::reset(), and qmcplusplus::TEST_CASE().
|
overridevirtual |
generic input
Implements OhmmsElementBase.
Definition at line 59 of file RandomNumberControl.cpp.
Referenced by RandomNumberControl::initialize().
|
overridevirtual |
read from an xmlNode
Implements OhmmsElementBase.
Definition at line 148 of file RandomNumberControl.cpp.
References OhmmsAttributeSet::add(), qmcplusplus::app_log(), qmcplusplus::app_summary(), qmcplusplus::bcast(), OHMMS::Controller, PrimeNumberSet< UIntType >::get(), RandomNumberControl::make_children(), RandomNumberControl::NeverBeenInitialized, RandomNumberControl::Offset, omp_get_max_threads(), RandomNumberControl::PrimeNumbers, OhmmsAttributeSet::put(), Random, Communicate::rank(), RandomNumberControl::reset(), and Communicate::size().
|
static |
read in parallel or serial
fname | file name |
comm | communicator |
Definition at line 206 of file RandomNumberControl.cpp.
References qmcplusplus::comm, hdf_archive::is_parallel(), hdf_archive::open(), RandomNumberControl::read_parallel(), and RandomNumberControl::read_rank_0().
Referenced by QMCMain::setMCWalkers(), and qmcplusplus::TEST_CASE().
|
static |
read random state from a hdf file in parallel
hin | hdf_archive set to parallel |
comm | communicator |
Definition at line 237 of file RandomNumberControl.cpp.
References qmcplusplus::app_log(), RandomNumberControl::Children, hdf_archive::close(), qmcplusplus::comm, qmcplusplus::hdf::main_state, omp_get_max_threads(), hdf_archive::pop(), hdf_archive::push(), Random, Communicate::rank(), hdf_archive::read(), and Communicate::size().
Referenced by RandomNumberControl::read().
|
static |
rank 0 reads random states from a hdf file and distributes them to all the other ranks
hin | hdf_archive set to serial |
comm | communicator |
Definition at line 338 of file RandomNumberControl.cpp.
References qmcplusplus::app_log(), qmcplusplus::bcast(), RandomNumberControl::Children, hdf_archive::close(), qmcplusplus::comm, copy(), qmcplusplus::hdf::main_state, omp_get_max_threads(), hdf_archive::pop(), hdf_archive::push(), Random, Communicate::rank(), hdf_archive::read(), hdf_archive::readSlabReshaped(), and Communicate::size().
Referenced by RandomNumberControl::read().
|
overridevirtual |
reset the generator
Implements OhmmsElementBase.
Definition at line 62 of file RandomNumberControl.cpp.
References RandomNumberControl::make_seeds().
Referenced by RandomNumberControl::put().
|
static |
Definition at line 105 of file RandomNumberControl.cpp.
References qmcplusplus::app_log(), RandomNumberControl::Children, OHMMS::Controller, qmcplusplus::n, omp_get_max_threads(), and Communicate::size().
Referenced by QMCMain::executeQMCSection().
|
static |
write in parallel or serial
fname | file name |
comm | communicator |
Definition at line 217 of file RandomNumberControl.cpp.
References RandomNumberControl::Children, qmcplusplus::comm, and qmcplusplus::convertUPtrToRefVector().
Referenced by QMCDriverNew::finalize(), QMCDriver::finalize(), QMCDriverNew::recordBlock(), QMCDriver::recordBlock(), and qmcplusplus::TEST_CASE().
|
static |
write in parallel or serial
rng | random number generators |
fname | file name |
comm | communicator |
Definition at line 223 of file RandomNumberControl.cpp.
References qmcplusplus::comm, hdf_archive::create(), hdf_archive::is_parallel(), RandomNumberControl::write_parallel(), and RandomNumberControl::write_rank_0().
|
static |
write random state to a hdf file in parallel
hdf_archive | set to parallel |
comm | communicator |
Definition at line 294 of file RandomNumberControl.cpp.
References hdf_archive::close(), qmcplusplus::comm, qmcplusplus::hdf::main_state, omp_get_max_threads(), hdf_archive::pop(), hdf_archive::push(), Random, Communicate::rank(), Communicate::size(), and hdf_archive::write().
Referenced by RandomNumberControl::write().
|
static |
rank 0 gathers the random states from all the other ranks and write them to a hdf file
hin | hdf_archive object set to serial |
comm | communicator |
Definition at line 409 of file RandomNumberControl.cpp.
References hdf_archive::close(), qmcplusplus::comm, qmcplusplus::hdf::main_state, omp_get_max_threads(), hdf_archive::pop(), hdf_archive::push(), Random, Communicate::rank(), Communicate::size(), hdf_archive::write(), and hdf_archive::writeSlabReshaped().
Referenced by RandomNumberControl::write().
|
static |
Definition at line 46 of file RandomNumberControl.h.
Referenced by DMCFactory::create(), VMCFactory::create(), QMCDriverNew::createRngsStepContexts(), RandomNumberControl::get(), RandomNumberControl::make_children(), QMCFixedSampleLinearOptimize::processOptXML(), RandomNumberControl::read_parallel(), RandomNumberControl::read_rank_0(), CSVMC::resetRun(), RMC::resetRun(), RMC::run(), CSVMC::run(), RandomNumberControl::test(), qmcplusplus::TEST_CASE(), RandomNumberControl::write(), and QMCDriverNew::~QMCDriverNew().
|
private |
Definition at line 103 of file RandomNumberControl.h.
Referenced by RandomNumberControl::initialize().
|
private |
Definition at line 102 of file RandomNumberControl.h.
Referenced by RandomNumberControl::put().
|
staticprivate |
Definition at line 104 of file RandomNumberControl.h.
Referenced by RandomNumberControl::make_children(), RandomNumberControl::make_seeds(), and RandomNumberControl::put().
|
static |
initialize the static data members
Definition at line 44 of file RandomNumberControl.h.
Referenced by RandomNumberControl::make_children(), RandomNumberControl::make_seeds(), and RandomNumberControl::put().