void DMCOMP::benchMark() { //set the collection mode for the estimator Estimators->setCollectionMode(branchEngine->SwapMode); IndexType PopIndex = Estimators->addColumn("Population"); IndexType EtrialIndex = Estimators->addColumn("Etrial"); //Estimators->reportHeader(AppendRun); //Estimators->reset(); IndexType block = 0; RealType Eest = branchEngine->E_T; //resetRun(); for(int ip=0; ip<NumThreads; ip++) { char fname[16]; sprintf(fname,"test.%i",ip); ofstream fout(fname); } for(int istep=0; istep<nSteps; istep++) { FairDivideLow(W.getActiveWalkers(),NumThreads,wPerNode); #pragma omp parallel { int ip = omp_get_thread_num(); Movers[ip]->benchMark(W.begin()+wPerNode[ip],W.begin()+wPerNode[ip+1],ip); } } }
bool RNDMCOMP::run() { resetUpdateEngines(); //estimator does not need to collect data Estimators->setCollectionMode(true); Estimators->start(nBlocks); for(int ip=0; ip<NumThreads; ip++) Movers[ip]->startRun(nBlocks,false); Timer myclock; IndexType block = 0; IndexType updatePeriod=(QMCDriverMode[QMC_UPDATE_MODE])?Period4CheckProperties:(nBlocks+1)*nSteps; do // block { Estimators->startBlock(nSteps); for(int ip=0; ip<NumThreads; ip++) Movers[ip]->startBlock(nSteps); IndexType step = 0; for(IndexType step=0; step< nSteps; ++step, CurrentStep+=BranchInterval) { #pragma omp parallel for for(int ip=0; ip<NumThreads; ++ip) { int now=CurrentStep; MCWalkerConfiguration::iterator wit(W.begin()+wPerNode[ip]), wit_end(W.begin()+wPerNode[ip+1]); for(int interval = 0; interval<BranchInterval-1; ++interval,++now) Movers[ip]->advanceWalkers(wit,wit_end,false); wClones[ip]->resetCollectables(); Movers[ip]->advanceWalkers(wit,wit_end,false); Movers[ip]->setReleasedNodeMultiplicity(wit,wit_end); if(QMCDriverMode[QMC_UPDATE_MODE] && now%updatePeriod == 0) Movers[ip]->updateWalkers(wit, wit_end); }//#pragma omp parallel for(int ip=1; ip<NumThreads; ++ip) { for(int j=0; j<W.Collectables.size(); ++j) W.Collectables[j]+=wClones[ip]->Collectables[j]; } branchEngine->branch(CurrentStep,W, branchClones); FairDivideLow(W.getActiveWalkers(),NumThreads,wPerNode); } // #pragma omp parallel for // for(int ip=0; ip<NumThreads; ++ip) // { // MCWalkerConfiguration::iterator wit(W.begin()+wPerNode[ip]), wit_end(W.begin()+wPerNode[ip+1]); // Movers[ip]->resetbuffers(wit, wit_end); // } Estimators->stopBlock(acceptRatio()); block++; recordBlock(block); } while(block<nBlocks && myclock.elapsed()<MaxCPUSecs); //for(int ip=0; ip<NumThreads; ip++) Movers[ip]->stopRun(); for(int ip=0; ip<NumThreads; ip++) *(RandomNumberControl::Children[ip])=*(Rng[ip]); Estimators->stop(); return finalize(block); }
bool DMCOMP::run() { bool variablePop = (Reconfiguration == "no"); resetUpdateEngines(); //set the collection mode for the estimator Estimators->setCollectionMode(branchEngine->SwapMode); Estimators->reportHeader(AppendRun); Estimators->reset(); IndexType block = 0; do // block { Estimators->startBlock(); for(int ip=0; ip<NumThreads; ip++) Movers[ip]->startBlock(); IndexType step = 0; do //step { #pragma omp parallel { int ip = omp_get_thread_num(); IndexType interval = 0; do // interval { Movers[ip]->advanceWalkers(W.begin()+wPerNode[ip],W.begin()+wPerNode[ip+1]); ++interval; } while(interval<BranchInterval); }//#pragma omp parallel Movers[0]->setMultiplicity(W.begin(),W.end()); Estimators->accumulate(W); branchEngine->branch(CurrentStep,W, branchClones); if(variablePop) FairDivideLow(W.getActiveWalkers(),NumThreads,wPerNode); ++step; CurrentStep+=BranchInterval; } while(step<nSteps); Estimators->stopBlock(acceptRatio()); block++; recordBlock(block); if(QMCDriverMode[QMC_UPDATE_MODE] && CurrentStep%100 == 0) { #pragma omp parallel { int ip = omp_get_thread_num(); Movers[ip]->updateWalkers(W.begin()+wPerNode[ip], W.begin()+wPerNode[ip+1]); } } } while(block<nBlocks); return finalize(block); }
void DMCOMP::resetUpdateEngines() { bool fixW = (Reconfiguration == "yes"); makeClones(W,Psi,H); if(Movers.empty()) { branchEngine->initWalkerController(Tau,fixW); //if(QMCDriverMode[QMC_UPDATE_MODE]) W.clearAuxDataSet(); Movers.resize(NumThreads,0); branchClones.resize(NumThreads,0); estimatorClones.resize(NumThreads,0); Rng.resize(NumThreads,0); FairDivideLow(W.getActiveWalkers(),NumThreads,wPerNode); app_log() << " Initial partition of walkers "; std::copy(wPerNode.begin(),wPerNode.end(),ostream_iterator<int>(app_log()," ")); app_log() << endl; #pragma omp parallel { int ip = omp_get_thread_num(); if(ip) hClones[ip]->add2WalkerProperty(*wClones[ip]); estimatorClones[ip]= new ScalarEstimatorManager(*Estimators,*hClones[ip]); Rng[ip]=new RandomGenerator_t(); Rng[ip]->init(ip,NumThreads,-1); hClones[ip]->setRandomGenerator(Rng[ip]); branchClones[ip] = new BranchEngineType(*branchEngine); if(QMCDriverMode[QMC_UPDATE_MODE]) { if(NonLocalMove == "yes") { DMCNonLocalUpdatePbyP* nlocMover= new DMCNonLocalUpdatePbyP(*wClones[ip],*psiClones[ip],*hClones[ip],*Rng[ip]); nlocMover->put(qmcNode); Movers[ip]=nlocMover; } else { Movers[ip]= new DMCUpdatePbyPWithRejection(*wClones[ip],*psiClones[ip],*hClones[ip],*Rng[ip]); } Movers[ip]->resetRun(branchClones[ip],estimatorClones[ip]); //Movers[ip]->initWalkersForPbyP(W.begin()+wPerNode[ip],W.begin()+wPerNode[ip+1]); } else { if(NonLocalMove == "yes") { app_log() << " Non-local update is used." << endl; DMCNonLocalUpdate* nlocMover= new DMCNonLocalUpdate(W,Psi,H,Random); nlocMover->put(qmcNode); Movers[ip]=nlocMover; } else { if(KillNodeCrossing) { Movers[ip] = new DMCUpdateAllWithKill(W,Psi,H,Random); } else { Movers[ip] = new DMCUpdateAllWithRejection(W,Psi,H,Random); } } Movers[ip]->resetRun(branchClones[ip],estimatorClones[ip]); //Movers[ip]->initWalkers(W.begin()+wPerNode[ip],W.begin()+wPerNode[ip+1]); } } } if(fixW) { if(QMCDriverMode[QMC_UPDATE_MODE]) app_log() << " DMCOMP PbyP Update with reconfigurations" << endl; else app_log() << " DMCOMP walker Update with reconfigurations" << endl; for(int ip=0; ip<Movers.size(); ip++) Movers[ip]->MaxAge=0; if(BranchInterval<0) { BranchInterval=nSteps; } } else { if(QMCDriverMode[QMC_UPDATE_MODE]) { app_log() << " DMCOMP PbyP Update with a fluctuating population" << endl; for(int ip=0; ip<Movers.size(); ip++) Movers[ip]->MaxAge=1; } else { app_log() << " DMCOMP walker Update with a fluctuating population" << endl; for(int ip=0; ip<Movers.size(); ip++) Movers[ip]->MaxAge=3; } if(BranchInterval<0) BranchInterval=1; } app_log() << " BranchInterval = " << BranchInterval << endl; app_log() << " Steps per block = " << nSteps << endl; app_log() << " Number of blocks = " << nBlocks << endl; }
bool DMCOMP::run() { bool variablePop = (Reconfiguration == "no"); resetUpdateEngines(); Estimators->start(nBlocks); #pragma omp parallel { int ip = omp_get_thread_num(); int np = omp_get_num_threads(); vector<int> wpart(np+1); FairDivideLow(W.getActiveWalkers(),np,wpart); int firstW=wpart[ip]; int lastW=wpart[ip+1]; //char fname[16]; //sprintf(fname,"debug.%d",ip); //ofstream fout(fname); if(QMCDriverMode[QMC_UPDATE_MODE]) Movers[ip]->initWalkersForPbyP(W.begin()+firstW,W.begin()+lastW); else Movers[ip]->initWalkers(W.begin()+firstW,W.begin()+lastW); Movers[ip]->startRun(nBlocks,false); IndexType block = 0; do // block { Movers[ip]->startBlock(nSteps); IndexType step = 0; do //step { IndexType interval = 0; IndexType bi=BranchInterval; do // interval { ++interval; Movers[ip]->advanceWalkers(W.begin()+firstW,W.begin()+lastW); } while(interval<bi); Movers[ip]->setMultiplicity(W.begin()+firstW,W.begin()+lastW); #pragma omp barrier #pragma omp master { //branchEngine->branch(CurrentStep,W, branchClones); branchEngine->branch(CurrentStep,W); if(storeConfigs && (CurrentStep%storeConfigs == 0)) { branchEngine->storeConfigsForForwardWalking(W); W.resetWalkerParents(); } } #pragma omp barrier branchClones[ip]->E_T=branchEngine->E_T; if(variablePop) { FairDivideLow(W.getActiveWalkers(),np,wpart); firstW=wpart[ip]; lastW=wpart[ip+1]; } ++step; //fout << step << " " << firstW << " " << lastW << " " << W.getActiveWalkers() << " " << branchClones[ip]->E_T << endl; CurrentStep+=BranchInterval; } while(step<nSteps); block++; #pragma omp master { Estimators->stopBlock(Movers[0]->acceptRatio()); recordBlock(block); } if(QMCDriverMode[QMC_UPDATE_MODE] && CurrentStep%100 == 0) { Movers[ip]->updateWalkers(W.begin()+firstW, W.begin()+lastW); } } while(block<nBlocks); Movers[ip]->stopRun(); } Estimators->stop(); return finalize(nBlocks); }
void RNDMCOMP::resetUpdateEngines() { ReportEngine PRE("RNDMCOMP","resetUpdateEngines"); Timer init_timer; makeClones(W,Psi,H); if(Movers.empty()) { //load walkers W.loadEnsemble(); for(int ip=1;ip<NumThreads;++ip) wClones[ip]->loadEnsemble(W); if (useAlternate=="yes") branchEngine->initWalkerController(W,false,false); //branchEngine->initWalkerController(W,Tau,false,false); else branchEngine->initWalkerController(W,false,true); //branchEngine->initWalkerController(W,Tau,false,true); branchEngine->setRN(true); //if(QMCDriverMode[QMC_UPDATE_MODE]) W.clearAuxDataSet(); Movers.resize(NumThreads,0); branchClones.resize(NumThreads,0); Rng.resize(NumThreads,0); estimatorClones.resize(NumThreads,0); FairDivideLow(W.getActiveWalkers(),NumThreads,wPerNode); bool klw=(KillWalker=="yes"); {//log file ostringstream o; o << " Initial partition of walkers on a node: "; std::copy(wPerNode.begin(),wPerNode.end(),ostream_iterator<int>(o," ")); o << "\n"; o << "Killing Walkers at nodes " << (useAlternate!="yes") <<endl; o << "Running the released node driver."<<endl; app_log() << o.str(); } #pragma omp parallel for for(int ip=0; ip<NumThreads; ++ip) { estimatorClones[ip]= new EstimatorManager(*Estimators); estimatorClones[ip]->setCollectionMode(false); Rng[ip]=new RandomGenerator_t(*RandomNumberControl::Children[ip]); hClones[ip]->setRandomGenerator(Rng[ip]); branchClones[ip] = new BranchEngineType(*branchEngine); // Movers[ip] = new RNDMCUpdatePbyPWithRejectionFast(*wClones[ip],*psiClones[ip],*hClones[ip],*Rng[ip]); if (useAlternate=="yes") Movers[ip] = new RNDMCUpdatePbyPAlternate(*wClones[ip],*psiClones[ip],*hClones[ip],*Rng[ip]); else Movers[ip] = new RNDMCUpdatePbyPCeperley(*wClones[ip],*psiClones[ip],*hClones[ip],*Rng[ip]); Movers[ip]->put(qmcNode); Movers[ip]->resetRun(branchClones[ip],estimatorClones[ip]); MCWalkerConfiguration::iterator wit(W.begin()+wPerNode[ip]), wit_end(W.begin()+wPerNode[ip+1]); Movers[ip]->initWalkersForPbyP(wit, wit_end); } } // branchEngine->checkParameters(W); if(BranchInterval<0) BranchInterval=1; { ostringstream o; if (useAlternate=="yes") o << " Using Alternate Mover"<<endl; else o << " Using Ceperley Mover"<<endl; o << " BranchInterval = " << BranchInterval << "\n"; o << " Steps per block = " << nSteps << "\n"; o << " Number of blocks = " << nBlocks << "\n"; app_log() << endl << o.str() << endl; } app_log() << " RNDMC Engine Initialization = " << init_timer.elapsed() << " secs " << endl; }
bool DMCOMPOPT::run() { bool variablePop = (Reconfiguration == "no"); resetUpdateEngines(); //estimator does not need to collect data Estimators->setCollectionMode(true); Estimators->start(nBlocks); for(int ip=0; ip<NumThreads; ip++) Movers[ip]->startRun(nBlocks,false); Timer myclock; IndexType block = 0; IndexType updatePeriod=(QMCDriverMode[QMC_UPDATE_MODE])?Period4CheckProperties:(nBlocks+1)*nSteps; int nsampls(0); int g_nsampls(0); do // block { Estimators->startBlock(nSteps); for(int ip=0; ip<NumThreads; ip++) Movers[ip]->startBlock(nSteps); IndexType step = 0; for(IndexType step=0; step< nSteps; ++step, CurrentStep+=BranchInterval) { #pragma omp parallel { int ip=omp_get_thread_num(); int now=CurrentStep; MCWalkerConfiguration::iterator wit(W.begin()+wPerNode[ip]), wit_first(W.begin()+wPerNode[ip]), wit2(W.begin()+wPerNode[ip]), wit_end(W.begin()+wPerNode[ip+1]); for(int interval = 0; interval<BranchInterval-1; ++interval,++now) { Movers[ip]->advanceWalkers(wit,wit_end,false); while(wit2!=wit_end) { (**wit2).addPropertyHistoryPoint(Eindx,(**wit2).getPropertyBase()[LOCALENERGY]); wit2++; } wit2=wit_first; if (Period4WalkerDump&&((now+1)%myPeriod4WalkerDump==0)) { wClones[ip]->saveEnsemble(wit2,wit_end); #pragma omp master nsampls+=W.getActiveWalkers(); } } wClones[ip]->resetCollectables(); Movers[ip]->advanceWalkers(wit,wit_end,false); wit2=wit_first; while(wit2!=wit_end) { (**wit2).addPropertyHistoryPoint(Eindx,(**wit2).getPropertyBase()[LOCALENERGY]); wit2++; } wit2=wit_first; if (myPeriod4WalkerDump&&((now+1)%myPeriod4WalkerDump==0)) { wClones[ip]->saveEnsemble(wit2,wit_end); #pragma omp master nsampls+=W.getActiveWalkers(); } Movers[ip]->setMultiplicity(wit,wit_end); if(QMCDriverMode[QMC_UPDATE_MODE] && now%updatePeriod == 0) Movers[ip]->updateWalkers(wit, wit_end); }//#pragma omp parallel } // branchEngine->debugFWconfig(); #pragma omp parallel for for (int ip=0; ip<NumThreads; ++ip) { MCWalkerConfiguration::iterator wit(W.begin()+wPerNode[ip]), wit_end(W.begin()+wPerNode[ip+1]); while (wit!=wit_end) { Walker_t& thisWalker(**wit); Walker_t::Buffer_t& w_buffer(thisWalker.DataSet); wClones[ip]->loadWalker(thisWalker,true); psiClones[ip]->copyFromBuffer(*wClones[ip],w_buffer); vector<RealType> Dsaved(NumOptimizables,0); vector<RealType> HDsaved(NumOptimizables,0); psiClones[ip]->evaluateDerivatives(*wClones[ip],dummyOptVars[ip],Dsaved,HDsaved,true);//SH like deriv style #pragma omp critical fillComponentMatrices(Dsaved,HDsaved,thisWalker); wit++; } } branchEngine->branch(CurrentStep,W, branchClones); if(variablePop) FairDivideLow(W.getActiveWalkers(),NumThreads,wPerNode); Estimators->stopBlock(acceptRatio()); block++; recordBlock(block); g_nsampls=nsampls; myComm->allreduce(g_nsampls); } while(((block<nBlocks) || (g_nsampls<nTargetSamples)) && myclock.elapsed()<MaxCPUSecs); //for(int ip=0; ip<NumThreads; ip++) Movers[ip]->stopRun(); for(int ip=0; ip<NumThreads; ip++) *(RandomNumberControl::Children[ip])=*(Rng[ip]); // adding weight index MCWalkerConfiguration::iterator wit(W.begin()), wit_end(W.end()); while(wit!=wit_end) { (**wit).deletePropertyHistory(); wit++; } Estimators->stop(); return finalize(block); }
void DMCOMPOPT::resetUpdateEngines() { ReportEngine PRE("DMCOMPOPT","resetUpdateEngines"); resetComponents(qmcNode); bool fixW = (Reconfiguration == "yes"); Timer init_timer; // HACK HACK HACK // This is so ugly it's probably a crime. It must be fixed. if(firsttime) { // for(int ip=1; ip<NumThreads; ++ip) // { // delete wClones[ip]; // delete psiClones[ip]; // delete hClones[ip]; // } // wClones.resize(0); wClones.clear(); psiClones.clear(); hClones.clear(); firsttime=false; } for (int ip=0; ip<NumThreads; ++ip) { opt_variables_type dummy; psiClones[ip]->checkInVariables(dummy); dummy.resetIndex(); psiClones[ip]->checkOutVariables(dummy); dummyOptVars.push_back(dummy); } NumOptimizables=dummyOptVars[0].size(); resizeForOpt(NumOptimizables); makeClones(W,Psi,H); if(Movers.empty()) { // //load walkers Eindx = W.addPropertyHistory(wlen); W.loadEnsemble(wClones); for(int ip=1; ip<NumThreads; ++ip) wClones[ip]->addPropertyHistory(wlen); // m_param.put(qmcNode); // put(qmcNode); // //app_log()<<"DMCOMPOPT::resetComponents"<<endl; // Estimators->reset(); // branchEngine->resetRun(qmcNode); // branchEngine->checkParameters(W); branchEngine->initWalkerController(W,fixW,false); //if(QMCDriverMode[QMC_UPDATE_MODE]) W.clearAuxDataSet(); Movers.resize(NumThreads,0); branchClones.resize(NumThreads,0); Rng.resize(NumThreads,0); estimatorClones.resize(NumThreads,0); FairDivideLow(W.getActiveWalkers(),NumThreads,wPerNode); { //log file ostringstream o; o << " Initial partition of walkers on a node: "; std::copy(wPerNode.begin(),wPerNode.end(),ostream_iterator<int>(o," ")); o << "\n"; if(QMCDriverMode[QMC_UPDATE_MODE]) o << " Updates by particle-by-particle moves"; else o << " Updates by walker moves"; if(UseFastGrad == "yes") o << " using fast gradient version "; else o << " using full-ratio version "; if(KillNodeCrossing) o << "\n Walkers are killed when a node crossing is detected"; else o << "\n DMC moves are rejected when a node crossing is detected"; app_log() << o.str() << endl; } #pragma omp parallel for for(int ip=0; ip<NumThreads; ++ip) { estimatorClones[ip]= new EstimatorManager(*Estimators); estimatorClones[ip]->setCollectionMode(false); Rng[ip]=new RandomGenerator_t(*RandomNumberControl::Children[ip]); hClones[ip]->setRandomGenerator(Rng[ip]); branchClones[ip] = new BranchEngineType(*branchEngine); if(QMCDriverMode[QMC_UPDATE_MODE]) { if(UseFastGrad == "yes") Movers[ip] = new DMCUpdatePbyPWithRejectionFast(*wClones[ip],*psiClones[ip],*hClones[ip],*Rng[ip]); else Movers[ip] = new DMCUpdatePbyPWithRejection(*wClones[ip],*psiClones[ip],*hClones[ip],*Rng[ip]); // Movers[ip]->put(qmcNode); // Movers[ip]->resetRun(branchClones[ip],estimatorClones[ip]); // Movers[ip]->initWalkersForPbyP(W.begin()+wPerNode[ip],W.begin()+wPerNode[ip+1]); } else { if(KillNodeCrossing) Movers[ip] = new DMCUpdateAllWithKill(*wClones[ip],*psiClones[ip],*hClones[ip],*Rng[ip]); else Movers[ip] = new DMCUpdateAllWithRejection(*wClones[ip],*psiClones[ip],*hClones[ip],*Rng[ip]); // Movers[ip]->put(qmcNode); // Movers[ip]->resetRun(branchClones[ip],estimatorClones[ip]); // Movers[ip]->initWalkers(W.begin()+wPerNode[ip],W.begin()+wPerNode[ip+1]); } } // #pragma omp parallel for // for (int ip=0; ip<NumThreads; ++ip) // { // MCWalkerConfiguration::iterator wit(W.begin()+wPerNode[ip]), wit_end(W.begin()+wPerNode[ip+1]); // while (wit!=wit_end) // { // Walker_t& thisWalker(**wit); // Walker_t::Buffer_t& w_buffer(thisWalker.DataSet); // wClones[ip]->loadWalker(thisWalker,true); // psiClones[ip]->copyFromBuffer(*wClones[ip],w_buffer); // psiClones[ip]->updateBuffer(*wClones[ip],w_buffer,true); // wit++; // } // } } #pragma omp parallel for for(int ip=0; ip<NumThreads; ++ip) { if(QMCDriverMode[QMC_UPDATE_MODE]) { Movers[ip]->put(qmcNode); Movers[ip]->resetRun(branchClones[ip],estimatorClones[ip]); Movers[ip]->initWalkersForPbyP(W.begin()+wPerNode[ip],W.begin()+wPerNode[ip+1]); } else { Movers[ip]->put(qmcNode); Movers[ip]->resetRun(branchClones[ip],estimatorClones[ip]); Movers[ip]->initWalkers(W.begin()+wPerNode[ip],W.begin()+wPerNode[ip+1]); } } // adding weight index MCWalkerConfiguration::iterator wit(W.begin()), wit_end(W.end()); (**wit).addPropertyHistory(wlen); wit++; while(wit!=wit_end) { (**wit).addPropertyHistory(wlen); wit++; } std::vector<IndexType> samples_th(omp_get_max_threads(),0); myPeriod4WalkerDump=(Period4WalkerDump>0)?Period4WalkerDump:(nBlocks+1)*nSteps; samples_this_node = nTargetSamples/myComm->size(); if (nTargetSamples%myComm->size() > myComm->rank()) samples_this_node+=1; int samples_each_thread = samples_this_node/omp_get_max_threads(); for (int ip=0; ip<omp_get_max_threads(); ++ip) samples_th[ip]=samples_each_thread; if(samples_this_node%omp_get_max_threads()) for (int ip=0; ip < samples_this_node%omp_get_max_threads(); ++ip) samples_th[ip] +=1; int ndumps = std::max(samples_this_node/W.getActiveWalkers() + 1,2); myPeriod4WalkerDump = nBlocks*nSteps/ndumps; app_log() << " Samples are dumped every " << myPeriod4WalkerDump << " steps " << endl; app_log() << " Total Sample Size =" << nTargetSamples << endl; app_log() << " Nodes Sample Size =" << samples_this_node << endl; for (int ip=0; ip<NumThreads; ++ip) app_log() << " Sample size for thread " <<ip<<" = " << samples_th[ip] << endl; #pragma omp critical for(int ip=0; ip<NumThreads; ++ip) { wClones[ip]->clearEnsemble(); wClones[ip]->setNumSamples(samples_th[ip]); } t= Movers[0]->getTau(); clearComponentMatrices(); branchEngine->checkParameters(W); int mxage=mover_MaxAge; if(fixW) { if(BranchInterval<0) BranchInterval=nSteps; mxage=(mover_MaxAge<0)?0:mover_MaxAge; for(int ip=0; ip<Movers.size(); ++ip) Movers[ip]->MaxAge=mxage; } else { if(BranchInterval<0) BranchInterval=1; int miage=(QMCDriverMode[QMC_UPDATE_MODE])?1:5; mxage=(mover_MaxAge<0)?miage:mover_MaxAge; for(int ip=0; ip<Movers.size(); ++ip) Movers[ip]->MaxAge=mxage; } { ostringstream o; if(fixW) o << " Fixed population using reconfiguration method\n"; else o << " Fluctuating population\n"; o << " Persisent walkers are killed after " << mxage << " MC sweeps\n"; o << " BranchInterval = " << BranchInterval << "\n"; o << " Steps per block = " << nSteps << "\n"; o << " Number of blocks = " << nBlocks << "\n"; app_log() << o.str() << endl; } app_log() << " DMC Engine Initialization = " << init_timer.elapsed() << " secs " << endl; }
void DMCOMP::resetUpdateEngines() { ReportEngine PRE("DMCOMP","resetUpdateEngines"); bool fixW = (Reconfiguration == "yes"); Timer init_timer; makeClones(W,Psi,H); if(Movers.empty()) { //load walkers W.loadEnsemble(); for(int ip=1;ip<NumThreads;++ip) wClones[ip]->loadEnsemble(W); branchEngine->initWalkerController(W,fixW,false); //if(QMCDriverMode[QMC_UPDATE_MODE]) W.clearAuxDataSet(); Movers.resize(NumThreads,0); branchClones.resize(NumThreads,0); Rng.resize(NumThreads,0); estimatorClones.resize(NumThreads,0); FairDivideLow(W.getActiveWalkers(),NumThreads,wPerNode); {//log file ostringstream o; o << " Initial partition of walkers on a node: "; std::copy(wPerNode.begin(),wPerNode.end(),ostream_iterator<int>(o," ")); o << "\n"; if(QMCDriverMode[QMC_UPDATE_MODE]) o << " Updates by particle-by-particle moves"; else o << " Updates by walker moves"; if(UseFastGrad == "yes") o << " using fast gradient version "; else o << " using full-ratio version "; if(KillNodeCrossing) o << "\n Walkers are killed when a node crossing is detected"; else o << "\n DMC moves are rejected when a node crossing is detected"; app_log() << o.str() << endl; } #pragma omp parallel for for(int ip=0; ip<NumThreads; ++ip) { estimatorClones[ip]= new EstimatorManager(*Estimators); estimatorClones[ip]->setCollectionMode(false); Rng[ip]=new RandomGenerator_t(*RandomNumberControl::Children[ip]); hClones[ip]->setRandomGenerator(Rng[ip]); branchClones[ip] = new BranchEngineType(*branchEngine); if(QMCDriverMode[QMC_UPDATE_MODE]) { if(UseFastGrad == "yes") Movers[ip] = new DMCUpdatePbyPWithRejectionFast(*wClones[ip],*psiClones[ip],*hClones[ip],*Rng[ip]); else Movers[ip] = new DMCUpdatePbyPWithRejection(*wClones[ip],*psiClones[ip],*hClones[ip],*Rng[ip]); Movers[ip]->put(qmcNode); Movers[ip]->resetRun(branchClones[ip],estimatorClones[ip]); Movers[ip]->initWalkersForPbyP(W.begin()+wPerNode[ip],W.begin()+wPerNode[ip+1]); } else { if(KillNodeCrossing) Movers[ip] = new DMCUpdateAllWithKill(*wClones[ip],*psiClones[ip],*hClones[ip],*Rng[ip]); else Movers[ip] = new DMCUpdateAllWithRejection(*wClones[ip],*psiClones[ip],*hClones[ip],*Rng[ip]); Movers[ip]->put(qmcNode); Movers[ip]->resetRun(branchClones[ip],estimatorClones[ip]); Movers[ip]->initWalkers(W.begin()+wPerNode[ip],W.begin()+wPerNode[ip+1]); } } } branchEngine->checkParameters(W); int mxage=mover_MaxAge; if(fixW) { if(BranchInterval<0) BranchInterval=nSteps; mxage=(mover_MaxAge<0)?0:mover_MaxAge; for(int ip=0; ip<Movers.size(); ++ip) Movers[ip]->MaxAge=mxage; } else { if(BranchInterval<0) BranchInterval=1; int miage=(QMCDriverMode[QMC_UPDATE_MODE])?1:5; mxage=(mover_MaxAge<0)?miage:mover_MaxAge; for(int ip=0; ip<Movers.size(); ++ip) Movers[ip]->MaxAge=mxage; } { ostringstream o; if(fixW) o << " Fixed population using reconfiguration method\n"; else o << " Fluctuating population\n"; o << " Persisent walkers are killed after " << mxage << " MC sweeps\n"; o << " BranchInterval = " << BranchInterval << "\n"; o << " Steps per block = " << nSteps << "\n"; o << " Number of blocks = " << nBlocks << "\n"; app_log() << o.str() << endl; } app_log() << " DMC Engine Initialization = " << init_timer.elapsed() << " secs " << endl; }
bool DMCOMP::run() { bool variablePop = (Reconfiguration == "no"); resetUpdateEngines(); //estimator does not need to collect data Estimators->setCollectionMode(true); Estimators->start(nBlocks); for(int ip=0; ip<NumThreads; ip++) Movers[ip]->startRun(nBlocks,false); Timer myclock; IndexType block = 0; IndexType updatePeriod=(QMCDriverMode[QMC_UPDATE_MODE])?Period4CheckProperties:(nBlocks+1)*nSteps; do // block { Estimators->startBlock(nSteps); for(int ip=0; ip<NumThreads; ip++) Movers[ip]->startBlock(nSteps); IndexType step = 0; for(IndexType step=0; step< nSteps; ++step, CurrentStep+=BranchInterval) { if(storeConfigs && (CurrentStep%storeConfigs == 0)) { ForwardWalkingHistory.storeConfigsForForwardWalking(W); W.resetWalkerParents(); } #pragma omp parallel for for(int ip=0; ip<NumThreads; ++ip) { int now=CurrentStep; MCWalkerConfiguration::iterator wit(W.begin()+wPerNode[ip]), wit_end(W.begin()+wPerNode[ip+1]); for(int interval = 0;interval<BranchInterval-1; ++interval,++now) Movers[ip]->advanceWalkers(wit,wit_end,false); wClones[ip]->resetCollectables(); Movers[ip]->advanceWalkers(wit,wit_end,false); Movers[ip]->setMultiplicity(wit,wit_end); if(QMCDriverMode[QMC_UPDATE_MODE] && now%updatePeriod == 0) Movers[ip]->updateWalkers(wit, wit_end); }//#pragma omp parallel Estimators->accumulateCollectables(wClones,1.0); branchEngine->branch(CurrentStep,W, branchClones); // if(storeConfigs && (CurrentStep%storeConfigs == 0)) { // ForwardWalkingHistory.storeConfigsForForwardWalking(W); // W.resetWalkerParents(); // } if(variablePop) FairDivideLow(W.getActiveWalkers(),NumThreads,wPerNode); } // branchEngine->debugFWconfig(); Estimators->stopBlock(acceptRatio()); block++; recordBlock(block); } while(block<nBlocks && myclock.elapsed()<MaxCPUSecs); //for(int ip=0; ip<NumThreads; ip++) Movers[ip]->stopRun(); for(int ip=0; ip<NumThreads; ip++) *(RandomNumberControl::Children[ip])=*(Rng[ip]); Estimators->stop(); return finalize(block); }
void VMCSingleOMP::resetRun() { makeClones(W,Psi,H); //determine dump period for walkers int samples_tot=W.getActiveWalkers()*nBlocks*nSteps*myComm->size(); myPeriod4WalkerDump=(nTargetSamples>0)?samples_tot/nTargetSamples:Period4WalkerDump; //fall back to the default if(myPeriod4WalkerDump==0) myPeriod4WalkerDump=Period4WalkerDump; if(QMCDriverMode[QMC_WARMUP]) myPeriod4WalkerDump=nBlocks*nSteps; int samples_th=nTargetSamples/myComm->size()/NumThreads; for(int ip=0; ip<NumThreads;++ip) { wClones[ip]->clearEnsemble(); wClones[ip]->setNumSamples(samples_th); } app_log() << " Samples are dumped at every " << myPeriod4WalkerDump << " step " << endl; app_log() << " Total Sample Size =" << nTargetSamples << "\n Sample size per node per thread = " << samples_th << endl; app_log() << " Warmup Steps " << myWarmupSteps << endl; if(Movers.empty()) { Movers.resize(NumThreads,0); branchClones.resize(NumThreads,0); estimatorClones.resize(NumThreads,0); Rng.resize(NumThreads,0); int nwtot=(W.getActiveWalkers()/NumThreads)*NumThreads; FairDivideLow(nwtot,NumThreads,wPerNode); app_log() << " Initial partition of walkers "; std::copy(wPerNode.begin(),wPerNode.end(),ostream_iterator<int>(app_log()," ")); app_log() << endl; //#pragma omp parallel for for(int ip=0; ip<NumThreads; ++ip) { estimatorClones[ip]= new EstimatorManager(*Estimators);//,*hClones[ip]); estimatorClones[ip]->resetTargetParticleSet(*wClones[ip]); estimatorClones[ip]->setCollectionMode(false); Rng[ip]=new RandomGenerator_t(*(RandomNumberControl::Children[ip])); hClones[ip]->setRandomGenerator(Rng[ip]); branchClones[ip] = new BranchEngineType(*branchEngine); if(QMCDriverMode[QMC_UPDATE_MODE]) { if(UseDrift == "yes") Movers[ip]=new VMCUpdatePbyPWithDrift(*wClones[ip],*psiClones[ip],*hClones[ip],*Rng[ip]); else Movers[ip]=new VMCUpdatePbyP(*wClones[ip],*psiClones[ip],*hClones[ip],*Rng[ip]); Movers[ip]->resetRun(branchClones[ip],estimatorClones[ip]); } else { if(UseDrift == "yes") Movers[ip]=new VMCUpdateAllWithDrift(*wClones[ip],*psiClones[ip],*hClones[ip],*Rng[ip]); else Movers[ip]=new VMCUpdateAll(*wClones[ip],*psiClones[ip],*hClones[ip],*Rng[ip]); Movers[ip]->resetRun(branchClones[ip],estimatorClones[ip]); } } } //#pragma omp parallel for for(int ip=0; ip<NumThreads; ++ip) { if(QMCDriverMode[QMC_UPDATE_MODE]) Movers[ip]->initWalkersForPbyP(W.begin()+wPerNode[ip],W.begin()+wPerNode[ip+1]); else Movers[ip]->initWalkers(W.begin()+wPerNode[ip],W.begin()+wPerNode[ip+1]); for(int prestep=0; prestep<myWarmupSteps; ++prestep) Movers[ip]->advanceWalkers(W.begin()+wPerNode[ip],W.begin()+wPerNode[ip+1],true); if(myWarmupSteps && QMCDriverMode[QMC_UPDATE_MODE]) Movers[ip]->updateWalkers(W.begin()+wPerNode[ip],W.begin()+wPerNode[ip+1]); } myWarmupSteps=0; //Used to debug and benchmark opnemp //#pragma omp parallel for // for(int ip=0; ip<NumThreads; ip++) // { // Movers[ip]->benchMark(W.begin()+wPerNode[ip],W.begin()+wPerNode[ip+1],ip); // } }
void RNDMCOMP::resetUpdateEngines() { ReportEngine PRE("RNDMCOMP","resetUpdateEngines"); Timer init_timer; makeClones(W,Psi,H); makeClones(W,Guide); if(Movers.empty()) { W.loadEnsemble(wClones); branchEngine->initWalkerController(W,false,true); branchEngine->setRN(true); //if(QMCDriverMode[QMC_UPDATE_MODE]) W.clearAuxDataSet(); Movers.resize(NumThreads,0); branchClones.resize(NumThreads,0); Rng.resize(NumThreads,0); estimatorClones.resize(NumThreads,0); FairDivideLow(W.getActiveWalkers(),NumThreads,wPerNode); bool klw=(KillWalker=="yes"); { //log file ostringstream o; o << " Initial partition of walkers on a node: "; std::copy(wPerNode.begin(),wPerNode.end(),ostream_iterator<int>(o," ")); o << "\n"; o << "Killing Walkers at nodes " << (useAlternate!="yes") <<endl; o << "Running the released node driver."<<endl; app_log() << o.str(); } #pragma omp parallel for for(int ip=0; ip<NumThreads; ++ip) { estimatorClones[ip]= new EstimatorManager(*Estimators); estimatorClones[ip]->setCollectionMode(false); Rng[ip]=new RandomGenerator_t(*RandomNumberControl::Children[ip]); hClones[ip]->setRandomGenerator(Rng[ip]); branchClones[ip] = new BranchEngineType(*branchEngine); // Movers[ip] = new RNDMCUpdatePbyPWithRejectionFast(*wClones[ip],*psiClones[ip],*hClones[ip],*Rng[ip]); Movers[ip] = new RNDMCUpdatePbyPFast(*wClones[ip],*wgClones[ip],*psiClones[ip],*guideClones[ip],*hClones[ip],*Rng[ip]); Movers[ip]->put(qmcNode); Movers[ip]->resetRun(branchClones[ip],estimatorClones[ip]); MCWalkerConfiguration::iterator wit(W.begin()+wPerNode[ip]), wit_end(W.begin()+wPerNode[ip+1]); Movers[ip]->initWalkersForPbyP(wit, wit_end); } } // branchEngine->checkParameters(W); if(BranchInterval<0) BranchInterval=1; { ostringstream o; // if (useAlternate=="yes") o << " Using Alternate Mover"<<endl; // else o << " Using Ceperley Mover"<<endl; o << " BranchInterval = " << BranchInterval << "\n"; o << " Steps per block = " << nSteps << "\n"; o << " Number of blocks = " << nBlocks << "\n"; app_log() << endl << o.str() << endl; } // RealType avg_w(0); // RealType n_w(0); // RealType logepsilon(0); // #pragma omp parallel // { // int ip=omp_get_thread_num(); // // for (int step=0; step<nWarmupSteps; ++step) // { // avg_w=0; // n_w=0; // for (int prestep=0; prestep<myRNWarmupSteps; ++prestep) // { // Movers[ip]->advanceWalkers(W.begin()+wPerNode[ip],W.begin()+wPerNode[ip+1],true); // #pragma omp single // { // MCWalkerConfiguration::iterator wit(W.begin()), wit_end(W.end()); // while (wit!=wit_end) // { // avg_w += (*wit)->Weight; // n_w +=1; // wit++; // } // } // #pragma omp barrier // } // #pragma omp single // { // avg_w *= 1.0/n_w; // RealType w_m = avg_w/(1.0-avg_w); // w_m = std::log(0.5+0.5*w_m); // if (std::abs(w_m)>0.01) // logepsilon += w_m; // } // #pragma omp barrier // Movers[ip]->setLogEpsilon(logepsilon); // } // // } app_log() << " RNDMC Engine Initialization = " << init_timer.elapsed() << " secs " << endl; }
void VMCSingleOMP::resetRun() { ////only VMC can overwrite this if(nTargetPopulation>0) branchEngine->iParam[SimpleFixedNodeBranch::B_TARGETWALKERS]=static_cast<int>(std::ceil(nTargetPopulation)); makeClones(W,Psi,H); FairDivideLow(W.getActiveWalkers(),NumThreads,wPerNode); app_log() << " Initial partition of walkers "; std::copy(wPerNode.begin(),wPerNode.end(),ostream_iterator<int>(app_log()," ")); app_log() << endl; if (Movers.empty()) { Movers.resize(NumThreads,0); branchClones.resize(NumThreads,0); estimatorClones.resize(NumThreads,0); traceClones.resize(NumThreads,0); Rng.resize(NumThreads,0); #if !defined(BGP_BUG) #pragma omp parallel for #endif for(int ip=0; ip<NumThreads; ++ip) { ostringstream os; estimatorClones[ip]= new EstimatorManager(*Estimators);//,*hClones[ip]); estimatorClones[ip]->resetTargetParticleSet(*wClones[ip]); estimatorClones[ip]->setCollectionMode(false); traceClones[ip] = Traces->makeClone(); Rng[ip]=new RandomGenerator_t(*(RandomNumberControl::Children[ip])); hClones[ip]->setRandomGenerator(Rng[ip]); branchClones[ip] = new BranchEngineType(*branchEngine); // if(reweight=="yes") // { // if (ip== 0) app_log() << " WFMCUpdateAllWithReweight"<<endl; // Movers[ip]=new WFMCUpdateAllWithReweight(*wClones[ip],*psiClones[ip],*hClones[ip],*Rng[ip],weightLength,Eindex); // } // else // if (reweight=="psi") // { // os << " Sampling Psi to increase number of walkers near nodes"<<endl; // if (QMCDriverMode[QMC_UPDATE_MODE]) Movers[ip]=new VMCUpdatePbyPSamplePsi(*wClones[ip],*psiClones[ip],*hClones[ip],*Rng[ip]); // else Movers[ip]=new VMCUpdateAllSamplePsi(*wClones[ip],*psiClones[ip],*hClones[ip],*Rng[ip]); // } // else if (QMCDriverMode[QMC_UPDATE_MODE]) { // if (UseDrift == "rn") // { // os <<" PbyP moves with RN, using VMCUpdatePbyPSampleRN"<<endl; // Movers[ip]=new VMCUpdatePbyPSampleRN(*wClones[ip],*psiClones[ip],*guideClones[ip],*hClones[ip],*Rng[ip]); // Movers[ip]->setLogEpsilon(logepsilon); // // Movers[ip]=new VMCUpdatePbyPWithDrift(*wClones[ip],*psiClones[ip],*hClones[ip],*Rng[ip]); // } // else if (UseDrift == "yes") { os <<" PbyP moves with drift, using VMCUpdatePbyPWithDriftFast"<<endl; Movers[ip]=new VMCUpdatePbyPWithDriftFast(*wClones[ip],*psiClones[ip],*hClones[ip],*Rng[ip]); // Movers[ip]=new VMCUpdatePbyPWithDrift(*wClones[ip],*psiClones[ip],*hClones[ip],*Rng[ip]); } else { os <<" PbyP moves with |psi^2|, using VMCUpdatePbyP"<<endl; Movers[ip]=new VMCUpdatePbyP(*wClones[ip],*psiClones[ip],*hClones[ip],*Rng[ip]); } //Movers[ip]->resetRun(branchClones[ip],estimatorClones[ip]); } else { // if (UseDrift == "rn") // { // os <<" walker moves with RN, using VMCUpdateAllSampleRN"<<endl; // Movers[ip]=new VMCUpdateAllSampleRN(*wClones[ip],*psiClones[ip],*guideClones[ip],*hClones[ip],*Rng[ip]); // Movers[ip]->setLogEpsilon(logepsilon); // } // else if (UseDrift == "yes") { os <<" walker moves with drift, using VMCUpdateAllWithDriftFast"<<endl; Movers[ip]=new VMCUpdateAllWithDrift(*wClones[ip],*psiClones[ip],*hClones[ip],*Rng[ip]); } else { os <<" walker moves with |psi|^2, using VMCUpdateAll"<<endl; Movers[ip]=new VMCUpdateAll(*wClones[ip],*psiClones[ip],*hClones[ip],*Rng[ip]); } //Movers[ip]->resetRun(branchClones[ip],estimatorClones[ip]); } Movers[ip]->nSubSteps=nSubSteps; if(ip==0) app_log() << os.str() << endl; } } else { #if !defined(BGP_BUG) #pragma omp parallel for #endif for(int ip=0; ip<NumThreads; ++ip) { traceClones[ip]->transfer_state_from(*Traces); } } app_log() << " Total Sample Size =" << nTargetSamples << endl; app_log() << " Walker distribution on root = "; std::copy(wPerNode.begin(),wPerNode.end(),ostream_iterator<int>(app_log()," ")); app_log() << endl; //app_log() << " Sample Size per node=" << samples_this_node << endl; //for (int ip=0; ip<NumThreads; ++ip) // app_log() << " Sample size for thread " <<ip<<" = " << samples_th[ip] << endl; app_log().flush(); #if !defined(BGP_BUG) #pragma omp parallel for #endif for(int ip=0; ip<NumThreads; ++ip) { //int ip=omp_get_thread_num(); Movers[ip]->put(qmcNode); Movers[ip]->resetRun(branchClones[ip],estimatorClones[ip],traceClones[ip]); if (QMCDriverMode[QMC_UPDATE_MODE]) Movers[ip]->initWalkersForPbyP(W.begin()+wPerNode[ip],W.begin()+wPerNode[ip+1]); else Movers[ip]->initWalkers(W.begin()+wPerNode[ip],W.begin()+wPerNode[ip+1]); // if (UseDrift != "rn") // { for (int prestep=0; prestep<nWarmupSteps; ++prestep) Movers[ip]->advanceWalkers(W.begin()+wPerNode[ip],W.begin()+wPerNode[ip+1],true); if (nWarmupSteps && QMCDriverMode[QMC_UPDATE_MODE]) Movers[ip]->updateWalkers(W.begin()+wPerNode[ip],W.begin()+wPerNode[ip+1]); // } } // //JNKIM: THIS IS BAD AND WRONG // if (UseDrift == "rn") // { // RealType avg_w(0); // RealType n_w(0); // #pragma omp parallel // { // int ip=omp_get_thread_num(); // for (int step=0; step<nWarmupSteps; ++step) // { // avg_w=0; // n_w=0; // for (int prestep=0; prestep<myRNWarmupSteps; ++prestep) // { // Movers[ip]->advanceWalkers(W.begin()+wPerNode[ip],W.begin()+wPerNode[ip+1],true); // #pragma omp single // { // MCWalkerConfiguration::iterator wit(W.begin()), wit_end(W.end()); // while (wit!=wit_end) // { // avg_w += (*wit)->Weight; // n_w +=1; // wit++; // } // } // #pragma omp barrier // } // #pragma omp single // { // avg_w *= 1.0/n_w; // RealType w_m = avg_w/(1.0-avg_w); // w_m = std::log(0.5+0.5*w_m); // if (std::abs(w_m)>0.01) // logepsilon += w_m; // } // #pragma omp barrier // Movers[ip]->setLogEpsilon(logepsilon); // } // // for (int prestep=0; prestep<nWarmupSteps; ++prestep) // Movers[ip]->advanceWalkers(W.begin()+wPerNode[ip],W.begin()+wPerNode[ip+1],true); // // if (nWarmupSteps && QMCDriverMode[QMC_UPDATE_MODE]) // Movers[ip]->updateWalkers(W.begin()+wPerNode[ip],W.begin()+wPerNode[ip+1]); // } // } for(int ip=0; ip<NumThreads; ++ip) wClones[ip]->clearEnsemble(); if(nSamplesPerThread) for(int ip=0; ip<NumThreads; ++ip) wClones[ip]->setNumSamples(nSamplesPerThread); nWarmupSteps=0; //Used to debug and benchmark opnemp //#pragma omp parallel for // for(int ip=0; ip<NumThreads; ip++) // { // Movers[ip]->benchMark(W.begin()+wPerNode[ip],W.begin()+wPerNode[ip+1],ip); // } }
void HDFWalkerIOEngine::readAll(hid_t grp, const char* name, Communicate* comm) { int mynode=comm->rank(); int nprocs=comm->size(); vector<int> woffset(nprocs+1,0); const int RANK = 3; hsize_t offset[]={1,1,1}; hsize_t gcount[RANK],count[RANK]; hsize_t stride[]={1,1,1}; hid_t dataset = H5Dopen(grp,name); hid_t dataspace = H5Dget_space(dataset); int rank_n = H5Sget_simple_extent_ndims(dataspace); int status_n = H5Sget_simple_extent_dims(dataspace, gcount, NULL); //assign offsets and size FairDivideLow(gcount[0],nprocs,woffset); offset[0]=woffset[mynode]; offset[1] = 0; offset[2] = 0; count[0]=woffset[mynode+1]-woffset[mynode]; count[1]=gcount[1]; count[2]=gcount[2]; app_log() << " Initial walker distribution: "; std::copy(woffset.begin(),woffset.end(),ostream_iterator<int>(app_log()," ")); app_log() << endl; vector<MCWalkerConfiguration::PosType> posIn(count[0]*count[1]); hid_t memspace = H5Screate_simple(RANK, count, NULL); herr_t status = H5Sselect_hyperslab(dataspace,H5S_SELECT_SET, offset,NULL,count,NULL); #if defined(H5_HAVE_PARALLEL) xfer_plist = H5Pcreate(H5P_DATASET_XFER); H5Pset_dxpl_mpio(xfer_plist,H5FD_MPIO_COLLECTIVE); #else xfer_plist = H5P_DEFAULT; #endif hid_t type_id=get_h5_datatype(posIn[0][0]); status = H5Dread(dataset, type_id, memspace, dataspace, xfer_plist, &(posIn[0][0])); H5Sclose(dataspace); H5Sclose(memspace); H5Dclose(dataset); #if defined(H5_HAVE_PARALLEL) H5Pclose(xfer_plist); #endif int curWalker = W.getActiveWalkers(); if(curWalker) { W.createWalkers(count[0]); } else { W.resize(count[0],count[1]); } MCWalkerConfiguration::iterator it = W.begin()+curWalker; int ii=0; for(int iw=0; iw<count[0]; iw++) { //std::copy(Post_temp[iw],Post_temp[iw+1], (*it)->R.begin()); for(int iat=0; iat < count[1]; iat++,ii++){ (*it)->R(iat) = posIn[ii]; } ++it; } }