Skip to content

Commit

Permalink
Merge branch 'develop' into origin/update_multi_for_clang11_second_try
Browse files Browse the repository at this point in the history
  • Loading branch information
ye-luo authored Mar 3, 2021
2 parents 276773f + f51d115 commit d2c607f
Show file tree
Hide file tree
Showing 59 changed files with 73 additions and 154 deletions.
29 changes: 20 additions & 9 deletions src/QMCDrivers/DMC/DMCDriverInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,9 @@ void DMCDriverInput::readXML(xmlNodePtr node)
{
ParameterSet parameter_set_;
std::string reconfig_str;
parameter_set_.add(reconfig_str, "reconfiguration");
if (!reconfig_str.empty() && reconfig_str != "no" && reconfig_str != "runwhileincorrect")
throw std::runtime_error(
"Reconfiguration is currently broken and gives incorrect results. Set reconfiguration=\"no\" or remove the "
"reconfiguration option from the DMC input section. To run performance tests, please set reconfiguration to "
"\"runwhileincorrect\" instead of \"yes\" to restore consistent behaviour.");
reconfiguration_ = (reconfig_str == "runwhileincorrect");
parameter_set_.add(NonLocalMove, "nonlocalmove");
parameter_set_.add(NonLocalMove, "nonlocalmoves");
parameter_set_.add(reconfig_str, "reconfiguration", {"no", "yes", "runwhileincorrect"});
parameter_set_.add(NonLocalMove, "nonlocalmove", {"no", "yes", "v0", "v1", "v3"});
parameter_set_.add(NonLocalMove, "nonlocalmoves", {"no", "yes", "v0", "v1", "v3"});
parameter_set_.add(max_age_, "MaxAge");

// from DMC.cpp put(xmlNodePtr)
Expand All @@ -45,6 +39,23 @@ void DMCDriverInput::readXML(xmlNodePtr node)

parameter_set_.put(node);

if (reconfig_str == "yes")
throw std::runtime_error(
"Reconfiguration is currently broken and gives incorrect results. Set reconfiguration=\"no\" or remove the "
"reconfiguration option from the DMC input section. To run performance tests, please set reconfiguration to "
"\"runwhileincorrect\" instead of \"yes\" to restore consistent behaviour.");
reconfiguration_ = (reconfig_str == "yes");

if (NonLocalMove == "yes" || NonLocalMove == "v0")
app_summary() << " Using Non-local T-moves v0, M. Casula, PRB 74, 161102(R) (2006)";
else if (NonLocalMove == "v1")
app_summary() << " Using Non-local T-moves v1, M. Casula et al., JCP 132, 154113 (2010)";
else if (NonLocalMove == "v3")
app_summary() << " Using Non-local T-moves v3, an approximation to v1";
else
app_summary() << " Using Locality Approximation";
app_summary() << std::endl;

// TODO: similar check for alpha and gamma
if (max_age_ < 0)
throw std::runtime_error("Illegal input for MaxAge in DMC input section");
Expand Down
5 changes: 5 additions & 0 deletions src/QMCDrivers/DMC/DMCFactoryNew.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ QMCDriverInterface* DMCFactoryNew::create(const ProjectData& project_data, MCPop
comm->barrier_and_abort("DMC batched driver is not supported by legacy CUDA builds.");
#endif

app_summary() << "\n========================================"
"\n Reading DMC driver XML input section"
"\n========================================"
<< std::endl;

QMCDriverInput qmcdriver_input;
qmcdriver_input.readXML(input_node_);
DMCDriverInput dmcdriver_input;
Expand Down
10 changes: 8 additions & 2 deletions src/QMCDrivers/QMCDriverInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ void QMCDriverInput::readXML(xmlNodePtr cur)
parameter_set.add(num_crowds_, "crowds");
parameter_set.add(serialize_walkers, "crowd_serialize_walkers", {"no", "yes"});
parameter_set.add(walkers_per_rank_, "walkers_per_rank");
parameter_set.add(walkers_per_rank_, "walkers", {}, TagStatus::UNSUPPORTED);
parameter_set.add(total_walkers_, "total_walkers");
parameter_set.add(steps_between_samples_, "stepsbetweensamples");
parameter_set.add(samples_per_thread_, "samplesperthread");
parameter_set.add(steps_between_samples_, "stepsbetweensamples", {}, TagStatus::UNSUPPORTED);
parameter_set.add(samples_per_thread_, "samplesperthread", {}, TagStatus::UNSUPPORTED);
parameter_set.add(requested_samples_, "samples");
parameter_set.add(tau_, "timestep");
parameter_set.add(tau_, "time_step");
Expand Down Expand Up @@ -119,6 +120,11 @@ void QMCDriverInput::readXML(xmlNodePtr cur)
}

crowd_serialize_walkers_ = serialize_walkers == "yes";
if (crowd_serialize_walkers_)
app_summary() << " Batched operations are serialized over walkers." << std::endl;
if (scoped_profiling_)
app_summary() << " Profiler data collection is enabled in this driver scope." << std::endl;


if (check_point_period_.period < 1)
check_point_period_.period = max_blocks_;
Expand Down
5 changes: 0 additions & 5 deletions src/QMCDrivers/QMCDriverNew.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,6 @@ void QMCDriverNew::checkNumCrowdsLTNumThreads(const int num_crowds)
*/
void QMCDriverNew::startup(xmlNodePtr cur, QMCDriverNew::AdjustedWalkerCounts awc)
{
if (driver_scope_profiler_.isActive())
app_summary() << " Profiler data collection is enabled in this driver scope." << std::endl;
if (!dispatchers_.are_walkers_batched())
app_summary() << " Batched operations are serialized over walkers." << std::endl;

app_summary() << this->QMCType << " Driver running with target_walkers = " << awc.global_walkers << std::endl
<< " walkers_per_rank = " << awc.walkers_per_rank << std::endl
<< " num_crowds = " << awc.walkers_per_crowd.size() << std::endl
Expand Down
5 changes: 0 additions & 5 deletions src/QMCDrivers/VMC/VMCBatched.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,6 @@ void VMCBatched::process(xmlNodePtr node)
adjustGlobalWalkerCount(myComm->size(), myComm->rank(), qmcdriver_input_.get_total_walkers(),
qmcdriver_input_.get_walkers_per_rank(), 1.0, qmcdriver_input_.get_num_crowds());

if (vmcdriver_input_.get_use_drift())
app_log() << " Random walking with drift" << std::endl;
else
app_log() << " Random walking without drift" << std::endl;

Base::startup(node, awc);
}
catch (const UniformCommunicateError& ue)
Expand Down
16 changes: 9 additions & 7 deletions src/QMCDrivers/VMC/VMCDriverInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@ VMCDriverInput::VMCDriverInput(bool use_drift) : use_drift_(use_drift) {}
void VMCDriverInput::readXML(xmlNodePtr node)
{
ParameterSet parameter_set_;
std::string use_drift("yes");
parameter_set_.add(use_drift, "usedrift");
parameter_set_.add(use_drift, "use_drift");
std::string use_drift;
parameter_set_.add(use_drift, "usedrift", {"yes", "no"});
parameter_set_.add(use_drift, "use_drift", {"yes", "no"});
parameter_set_.add(samples_, "samples");
parameter_set_.add(samples_per_thread_, "samplesperthread");
parameter_set_.add(steps_between_samples_, "stepsbetweensamples");
parameter_set_.put(node);
if (use_drift == "no")
use_drift_ = false;

use_drift_ = use_drift == "yes";
if (use_drift_)
app_log() << " Random walking with drift" << std::endl;
else
app_log() << " Random walking without drift" << std::endl;
}

std::ostream& operator<<(std::ostream& o_stream, const VMCDriverInput& vmci) { return o_stream; }
Expand Down
8 changes: 2 additions & 6 deletions src/QMCDrivers/VMC/VMCDriverInput.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,13 @@ class VMCDriverInput
* Do not write out blocks of gets for variables like this
* there is are code_generation tools in QMCPACK_ROOT/utils/code_tools
*/
bool use_drift_ = true;
IndexType samples_per_thread_ = -1;
IndexType samples_ = -1;
IndexType steps_between_samples_ = -1;
bool use_drift_ = true;
IndexType samples_ = -1;
/** @} */

public:
bool get_use_drift() const { return use_drift_; }
IndexType get_samples_per_thread() const { return samples_per_thread_; }
IndexType get_samples() const { return samples_; }
IndexType get_steps_between_samples() const { return steps_between_samples_; }

friend std::ostream& operator<<(std::ostream& o_stream, const VMCDriverInput& vmci);
};
Expand Down
5 changes: 5 additions & 0 deletions src/QMCDrivers/VMC/VMCFactoryNew.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ QMCDriverInterface* VMCFactoryNew::create(const ProjectData& project_data,
comm->barrier_and_abort("VMC batched driver is not supported by legacy CUDA builds.");
#endif

app_summary() << "\n========================================"
"\n Reading VMC driver XML input section"
"\n========================================"
<< std::endl;

QMCDriverInput qmcdriver_input;
qmcdriver_input.readXML(input_node_);
VMCDriverInput vmcdriver_input;
Expand Down
10 changes: 10 additions & 0 deletions src/QMCDrivers/WFOpt/QMCWFOptFactoryNew.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ QMCOptimizeBatched* QMCWFOptFactoryNew(xmlNodePtr cur,
SampleStack& samples,
Communicate* comm)
{
app_summary() << "\n========================================"
"\n Reading WFOpt driver XML input section"
"\n========================================"
<< std::endl;

QMCDriverInput qmcdriver_input;
qmcdriver_input.readXML(cur);
VMCDriverInput vmcdriver_input;
Expand All @@ -32,6 +37,11 @@ QMCFixedSampleLinearOptimizeBatched* QMCWFOptLinearFactoryNew(xmlNodePtr cur,
SampleStack& samples,
Communicate* comm)
{
app_summary() << "\n========================================"
"\n Reading WFOpt driver XML input section"
"\n========================================"
<< std::endl;

QMCDriverInput qmcdriver_input;
qmcdriver_input.readXML(cur);
VMCDriverInput vmcdriver_input;
Expand Down
2 changes: 0 additions & 2 deletions src/QMCDrivers/tests/ValidQMCInputSections.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ constexpr std::array<const char*, 3> valid_vmc_input_sections{
<parameter name="crowds"> 8 </parameter>
<estimator name="LocalEnergy" hdf5="no" />
<parameter name="total_walkers"> 32 </parameter>
<parameter name="stepsbetweensamples"> 1 </parameter>
<parameter name="warmupSteps"> 5 </parameter>
<parameter name="substeps"> 5 </parameter>
<parameter name="steps"> 1 </parameter>
Expand All @@ -57,7 +56,6 @@ constexpr std::array<const char*, 3> valid_vmc_input_sections{
<parameter name="crowds"> 1 </parameter>
<estimator name="LocalEnergy" hdf5="no" />
<parameter name="total_walkers"> 1 </parameter>
<parameter name="stepsbetweensamples"> 1 </parameter>
<parameter name="warmupSteps"> 5 </parameter>
<parameter name="substeps"> 5 </parameter>
<parameter name="steps"> 1 </parameter>
Expand Down
6 changes: 4 additions & 2 deletions src/QMCDrivers/tests/test_QMCDriverInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ TEST_CASE("QMCDriverInput readXML", "[drivers]")
REQUIRE(qmcdriver_input.get_qmc_method().size() > 0);
};

std::for_each(testing::valid_vmc_input_sections.begin(), testing::valid_vmc_input_sections.end(), xml_test);
std::for_each(testing::valid_vmc_input_sections.begin() + testing::valid_vmc_input_vmc_batch_index,
testing::valid_vmc_input_sections.end(), xml_test);

std::for_each(testing::valid_dmc_input_sections.begin(), testing::valid_dmc_input_sections.end(), xml_test);
std::for_each(testing::valid_dmc_input_sections.begin() + testing::valid_dmc_input_dmc_batch_index,
testing::valid_dmc_input_sections.end(), xml_test);
}
} // namespace qmcplusplus
4 changes: 2 additions & 2 deletions src/QMCDrivers/tests/test_VMCDriverInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

namespace qmcplusplus
{

TEST_CASE("VMCDriverInput readXML", "[drivers]")
{
auto xml_test = [](const char* driver_xml) {
Expand All @@ -31,7 +30,8 @@ TEST_CASE("VMCDriverInput readXML", "[drivers]")
REQUIRE(vmcdriver_input.get_use_drift() == false);
};

std::for_each(testing::valid_vmc_input_sections.begin(), testing::valid_vmc_input_sections.end(), xml_test);
std::for_each(testing::valid_vmc_input_sections.begin() + testing::valid_vmc_input_vmc_batch_index,
testing::valid_vmc_input_sections.end(), xml_test);
}


Expand Down
24 changes: 4 additions & 20 deletions src/QMCHamiltonians/NonLocalTOperator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ int NonLocalTOperator::put(xmlNodePtr cur)
o << " Using Non-local T-moves v3, an approximation to v1";
}
else
{
APP_ABORT("NonLocalTOperator::put unknown nonlocalmove option " + use_tmove);
}
throw std::runtime_error("NonLocalTOperator::put unknown nonlocalmove option " + use_tmove);

#pragma omp master
app_log() << o.str() << std::endl;

return v_tmove;
}

Expand All @@ -84,33 +84,17 @@ int NonLocalTOperator::thingsThatShouldBeInMyConstructor(const std::string& non_
plusFactor = Tau * Gamma;
minusFactor = -Tau * (1.0 - Alpha * (1.0 + Gamma));
int v_tmove = TMOVE_OFF;
std::ostringstream o;

if (non_local_move_option == "no")
{
v_tmove = TMOVE_OFF;
o << " Using Locality Approximation";
}
else if (non_local_move_option == "yes" || non_local_move_option == "v0")
{
v_tmove = TMOVE_V0;
o << " Using Non-local T-moves v0, M. Casula, PRB 74, 161102(R) (2006)";
}
else if (non_local_move_option == "v1")
{
v_tmove = TMOVE_V1;
o << " Using Non-local T-moves v1, M. Casula et al., JCP 132, 154113 (2010)";
}
else if (non_local_move_option == "v3")
{
v_tmove = TMOVE_V3;
o << " Using Non-local T-moves v3, an approximation to v1";
}
else
{
APP_ABORT("NonLocalTOperator::put unknown nonlocalmove option " + non_local_move_option);
}
app_log() << o.str() << std::endl;
throw std::runtime_error("NonLocalTOperator::put unknown nonlocalmove option " + non_local_move_option);
return v_tmove;
}
void NonLocalTOperator::reset() { Txy.clear(); }
Expand Down
3 changes: 1 addition & 2 deletions tests/molecules/He_ae/det_He_opt_batch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,9 @@
<qmc method="linear_batch" move="pbyp" checkpoint="-1" gpu="yes">
<parameter name="blocks"> 5 </parameter>
<parameter name="warmupsteps"> 1 </parameter>
<parameter name="stepsbetweensamples"> 1 </parameter>
<parameter name="substeps"> 2 </parameter>
<parameter name="timestep"> 1.0 </parameter>
<parameter name="walkers"> 1 </parameter>
<parameter name="walkers_per_rank"> 1 </parameter>
<parameter name="samples"> 5 </parameter>
<parameter name="minwalkers"> 1e-3 </parameter>
<parameter name="useDrift"> no </parameter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
<qmc method="vmc" move="pbyp" gpu="yes">
<estimator name="LocalEnergy" hdf5="no" />
<parameter name="walkers"> 1 </parameter>
<parameter name="stepsbetweensamples"> 1 </parameter>
<parameter name="warmupSteps"> 5 </parameter>
<parameter name="substeps"> 5 </parameter>
<parameter name="steps"> 16 </parameter>
Expand All @@ -53,7 +52,6 @@
<qmc method="vmc" move="pbyp" gpu="yes">
<estimator name="LocalEnergy" hdf5="no" />
<parameter name="walkers"> 1 </parameter>
<parameter name="stepsbetweensamples"> 1 </parameter>
<parameter name="warmupSteps"> 5 </parameter>
<parameter name="substeps"> 5 </parameter>
<parameter name="steps"> 16 </parameter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
<qmc method="vmc" move="pbyp" gpu="yes">
<estimator name="LocalEnergy" hdf5="no" />
<parameter name="walkers"> 256 </parameter>
<parameter name="stepsbetweensamples"> 1 </parameter>
<parameter name="warmupSteps"> 5 </parameter>
<parameter name="substeps"> 5 </parameter>
<parameter name="steps"> 16 </parameter>
Expand All @@ -53,7 +52,6 @@
<qmc method="vmc" move="pbyp" gpu="yes">
<estimator name="LocalEnergy" hdf5="no" />
<parameter name="walkers"> 256 </parameter>
<parameter name="stepsbetweensamples"> 1 </parameter>
<parameter name="warmupSteps"> 5 </parameter>
<parameter name="substeps"> 5 </parameter>
<parameter name="steps"> 16 </parameter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
<qmc method="vmc" move="pbyp" gpu="yes">
<estimator name="LocalEnergy" hdf5="no" />
<parameter name="walkers"> 1 </parameter>
<parameter name="stepsbetweensamples"> 1 </parameter>
<parameter name="warmupSteps"> 5 </parameter>
<parameter name="substeps"> 5 </parameter>
<parameter name="steps"> 1 </parameter>
Expand All @@ -83,7 +82,6 @@
<qmc method="vmc" move="pbyp" gpu="yes">
<estimator name="LocalEnergy" hdf5="no" />
<parameter name="walkers"> 1 </parameter>
<parameter name="stepsbetweensamples"> 1 </parameter>
<parameter name="warmupSteps"> 5 </parameter>
<parameter name="substeps"> 5 </parameter>
<parameter name="steps"> 1 </parameter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
<qmc method="vmc" move="pbyp" gpu="yes">
<estimator name="LocalEnergy" hdf5="no" />
<parameter name="walkers"> 1 </parameter>
<parameter name="stepsbetweensamples"> 1 </parameter>
<parameter name="warmupSteps"> 5 </parameter>
<parameter name="substeps"> 5 </parameter>
<parameter name="steps"> 1 </parameter>
Expand All @@ -81,7 +80,6 @@
<qmc method="vmc" move="pbyp" gpu="yes">
<estimator name="LocalEnergy" hdf5="no" />
<parameter name="walkers"> 1 </parameter>
<parameter name="stepsbetweensamples"> 1 </parameter>
<parameter name="warmupSteps"> 5 </parameter>
<parameter name="substeps"> 5 </parameter>
<parameter name="steps"> 1 </parameter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
<qmc method="vmc" move="pbyp" gpu="yes">
<estimator name="LocalEnergy" hdf5="no" />
<parameter name="walkers"> 1 </parameter>
<parameter name="stepsbetweensamples"> 1 </parameter>
<parameter name="warmupSteps"> 5 </parameter>
<parameter name="substeps"> 5 </parameter>
<parameter name="steps"> 1 </parameter>
Expand All @@ -87,7 +86,6 @@
<qmc method="vmc" move="pbyp" gpu="yes">
<estimator name="LocalEnergy" hdf5="no" />
<parameter name="walkers"> 1 </parameter>
<parameter name="stepsbetweensamples"> 1 </parameter>
<parameter name="warmupSteps"> 5 </parameter>
<parameter name="substeps"> 5 </parameter>
<parameter name="steps"> 1 </parameter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
<qmc method="vmc" move="pbyp" gpu="yes">
<estimator name="LocalEnergy" hdf5="no" />
<parameter name="walkers"> 1 </parameter>
<parameter name="stepsbetweensamples"> 1 </parameter>
<parameter name="warmupSteps"> 5 </parameter>
<parameter name="substeps"> 5 </parameter>
<parameter name="steps"> 1 </parameter>
Expand All @@ -89,7 +88,6 @@
<qmc method="vmc" move="pbyp" gpu="yes">
<estimator name="LocalEnergy" hdf5="no" />
<parameter name="walkers"> 1 </parameter>
<parameter name="stepsbetweensamples"> 1 </parameter>
<parameter name="warmupSteps"> 5 </parameter>
<parameter name="substeps"> 5 </parameter>
<parameter name="steps"> 1 </parameter>
Expand Down
Loading

0 comments on commit d2c607f

Please sign in to comment.