QMCPACK
test_DMCBatched.cpp
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2020 QMCPACK developers.
6 //
7 // File developed by: Peter Doak, doakpw@ornl.gov, Oak Ridge National Laboratory
8 //
9 // File created by: Peter Doak, doakpw@ornl.gov, Oak Ridge National Laboratory
10 //////////////////////////////////////////////////////////////////////////////////////
11 
12 #include <catch.hpp>
13 
14 #include "Message/Communicate.h"
20 #include "Concurrency/Info.hpp"
23 
24 namespace qmcplusplus
25 {
26 namespace testing
27 {
29 {
30 public:
31  DMCBatchedTest() { up_dtest_ = std::make_unique<SetupDMCTest>(1); }
32 
34  {
35  using namespace testing;
36  SetupDMCTest& dtest = get_dtest();
37  }
38 
40 
41 private:
43 };
44 } // namespace testing
45 
46 /** Since we check the DMC only feature of reserve walkers perhaps this should be
47  * a DMC integration test.
48  */
49 #ifdef _OPENMP
50 TEST_CASE("DMCDriver+QMCDriverNew integration", "[drivers]")
51 {
52  using namespace testing;
58 
61  REQUIRE(okay);
62  xmlNodePtr node = doc.getRoot();
63  QMCDriverInput qmcdriver_input;
64  qmcdriver_input.readXML(node);
65  DMCDriverInput dmcdriver_input;
66  dmcdriver_input.readXML(node);
68  auto wavefunction_pool =
70 
72  SampleStack samples;
73  WalkerConfigurations walker_confs;
74 
75  DMCBatched dmcdriver(test_project, std::move(qmcdriver_input), std::nullopt, std::move(dmcdriver_input), walker_confs,
76  MCPopulation(comm->size(), comm->rank(), particle_pool.getParticleSet("e"),
77  wavefunction_pool.getPrimary(), hamiltonian_pool.getPrimary()),
78  comm);
79 
80  // setStatus must be called before process
81  std::string root_name{"Test"};
82  //For later sections this appears to contain important state.
83  std::string prev_config_file{""};
84 
85  dmcdriver.setStatus(root_name, prev_config_file, false);
86  // We want to express out expectations of the QMCDriver state machine so we catch
87  // changes to it over time.
89 
90  dmcdriver.process(node);
91  CHECK(dmcdriver.get_num_living_walkers() == 8);
92  const QMCTraits::IndexType reserved_walkers = dmcdriver.get_num_living_walkers() + dmcdriver.get_num_dead_walkers();
93  CHECK(reserved_walkers == 10);
94  // What else should we expect after process
95 }
96 #endif
97 
98 } // namespace qmcplusplus
class that handles xmlDoc
Definition: Libxml2Doc.h:76
TEST_CASE("ListenerVector", "[hamiltonian]")
void pause()
Pause the summary and log streams.
Abstraction of information on executor environments.
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
int rank() const
return the rank
Definition: Communicate.h:116
Declaration of OutputManager class.
if(!okay) throw std xmlNodePtr node
class ProjectData
Definition: ProjectData.h:36
static ParticleSetPool make_diamondC_1x1x1(Communicate *c)
Implements a DMC using particle-by-particle threaded and batched moves.
Definition: DMCBatched.h:35
A set of light weight walkers that are carried between driver sections and restart.
static WaveFunctionPool make_diamondC_1x1x1(const RuntimeOptions &runtime_options, Communicate *comm, ParticleSetPool &particle_pool)
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
IndexType get_num_dead_walkers() const
Definition: QMCDriverNew.h:221
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
int size() const
return the number of tasks
Definition: Communicate.h:118
const RuntimeOptions & getRuntimeOptions() const noexcept
OutputManagerClass outputManager(Verbosity::HIGH)
Input representation for DMC driver class runtime parameters.
Wrapping information on parallelism.
Definition: Communicate.h:68
void resume()
Resume the summary and log streams.
REQUIRE(std::filesystem::exists(filename))
Compilation units that construct QMCDriverInput need visibility to the actual input classes types in ...
A service class to override active avaiable threads upon construction.
void setStatus(const std::string &aname, const std::string &h5name, bool append) override
Set the status of the QMCDriver.
std::unique_ptr< T > UPtr
IndexType get_num_living_walkers() const
Definition: QMCDriverNew.h:220
OHMMS_INDEXTYPE IndexType
define other types
Definition: Configuration.h:65
static HamiltonianPool make_hamWithEE(Communicate *comm, ParticleSetPool &particle_pool, WaveFunctionPool &wavefunction_pool)
constexpr int valid_dmc_input_dmc_batch_index
void readXML(xmlNodePtr cur)
Reads qmc section xml node parameters.
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
constexpr std::array< const char *, 3 > valid_dmc_input_sections
utility functions for executors
void process(xmlNodePtr cur) override
DMCBatched driver will eventually ignore cur.
Definition: DMCBatched.cpp:375
avoids many repeated xml heredoc sections
Input representation for Driver base class runtime parameters.
void readXML(xmlNodePtr xml_input)