Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify DMC branch cutoff and population control #242

Merged
merged 11 commits into from
Jun 5, 2017
103 changes: 2 additions & 101 deletions src/QMCDrivers/DMC/WalkerControlFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ WalkerControlBase* createWalkerController(int nwtot, Communicate* comm, xmlNodeP
app_log() << " Creating WalkerController: target number of walkers = " << nwtot << std::endl;
///set of parameters
int nmax=0;
int nmin=0;
std::string reconfigopt("no");
ParameterSet m_param;
m_param.add(nwtot,"targetWalkers","int");
Expand All @@ -50,14 +49,6 @@ WalkerControlBase* createWalkerController(int nwtot, Communicate* comm, xmlNodeP
{
int nwloc=std::max(omp_get_max_threads(),nwtot/ncontexts);
nwtot=nwloc*ncontexts;
nmax=nwtot/ncontexts;
nmin=nwtot/ncontexts;
}
else
{
int npernode=nwtot/ncontexts;
nmin=npernode/5+1;
if (nmax==0) nmax=2*npernode+1;
}
#if defined(HAVE_MPI)
if(ncontexts>1)
Expand Down Expand Up @@ -87,101 +78,11 @@ WalkerControlBase* createWalkerController(int nwtot, Communicate* comm, xmlNodeP
wc = new WalkerControlBase(comm);
}
}
wc->Nmin=nmin;
wc->Nmax=nmax;
wc->MyMethod=fixw;
wc->setMinMax(nwtot,nmax);
return wc;
}

WalkerControlBase* CreateWalkerController(
bool reconfig, int& swapmode, int nideal,
int nmax, int nmin, WalkerControlBase* wc,
Communicate* comm)
{
int ncontexts = comm->size();
//overwrite the SwapMode for a single-node run
if(ncontexts == 1)
{
swapmode=0;
}
if(reconfig)
{
nmax=nideal/ncontexts;
nmin=nideal/ncontexts;
}
else
{
if(swapmode)
{
if (nmax==0)
{
int npernode=nideal/ncontexts;
nmax=2*npernode+1;
nmin=npernode/5+1;
}
else
{
int nmaxpernode = nmax/ncontexts;
int npernode=nideal/ncontexts;
nmax=nmaxpernode;
nmin=npernode/5+1;
}
}
else
{
if (nmax==0)
{
nmax=2*nideal;
nmin=nideal/2;
}
else
{
nmin=nideal/2;
}
}
}
if(wc)
{
if(swapmode != wc->SwapMode)
{
delete wc;
wc=0;
}
}
if(wc == 0)
{
#if defined(HAVE_MPI)
if(swapmode)
{
if(reconfig)
{
app_log() << " Using WalkerReconfigurationMPI for population control." << std::endl;
wc = new WalkerReconfigurationMPI(comm);
}
else
{
app_log() << " Using WalkerControlMPI for dynamic population control." << std::endl;
wc = new WalkerControlMPI(comm);
}
}
else
#endif
{
if(reconfig)
{
app_log() << " Using WalkerReconfiguration for population control." << std::endl;
wc = new WalkerReconfiguration(comm);
}
else
{
app_log() << " Using WalkerControlBase for dynamic population control." << std::endl;
wc = new WalkerControlBase(comm);
}
}
}
wc->Nmin=nmin;
wc->Nmax=nmax;
return wc;
}

}

16 changes: 0 additions & 16 deletions src/QMCDrivers/DMC/WalkerControlFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,6 @@ namespace qmcplusplus
{

/** function to create WalkerControlBase or its derived class
* @param swapmode in/out indicator to determine which controller will be created
* @param nideal ideal number of walkers
* @param nmax maximum number of walkers
* @param nmin minimum number of walkers
* @param wc pointer to current WalkerControlBase object
* @return WalkerControlBase*
*
* When wc is the same as the requested controller object, only reset the
* internal values and return wc itself.
*/
WalkerControlBase* CreateWalkerController(bool reconfig,
int& swapmode, int nideal, int nmax, int nmin,
WalkerControlBase* wc,
Communicate* comm);

/** function to create WalkerControlBase
* @param current number of walkers
*/
WalkerControlBase* createWalkerController(int nwtot,
Expand Down
Loading