25 XMLReader xml_tmp(xml_in,
"./GaugeAction");
26 std::ostringstream os;
28 p.gauge_act = os.str();
31 QDPIO::cerr <<
"Caught Exception while reading gauge action: " <<
s <<std::endl;
35 QDPIO::cout <<
"Gauge action: read \n" <<
p.gauge_act << std::endl;
50 XMLReader paramtop(xml, path);
51 read(paramtop,
"NmaxHB",
p.NmaxHB);
52 read(paramtop,
"nOver",
p.nOver);
55 QDPIO::cerr <<
"Caught Exception reading HBParams: " << e << std::endl;
65 write(xml,
"NmaxHB",
p.NmaxHB);
66 write(xml,
"nOver",
p.nOver);
88 XMLReader paramtop(xml, path);
89 read(paramtop,
"./RNG",
p.rng_seed);
90 read(paramtop,
"./StartUpdateNum",
p.start_update_num);
91 read(paramtop,
"./NWarmUpUpdates",
p.n_warm_up_updates);
92 read(paramtop,
"./NProductionUpdates",
p.n_production_updates);
93 read(paramtop,
"./NUpdatesThisRun",
p.n_updates_this_run);
94 read(paramtop,
"./SaveInterval",
p.save_interval);
95 read(paramtop,
"./SavePrefix",
p.save_prefix);
96 read(paramtop,
"./SaveVolfmt",
p.save_volfmt);
98 if (
p.n_updates_this_run %
p.save_interval != 0)
99 throw std::string(
"UpdateThisRun not a multiple of SaveInterval");
102 QDPIO::cerr <<
"Caught Exception reading MCControl: " << e << std::endl;
111 write(xml,
"RNG",
p.rng_seed);
112 write(xml,
"StartUpdateNum",
p.start_update_num);
113 write(xml,
"NWarmUpUpdates",
p.n_warm_up_updates);
114 write(xml,
"NProductionUpdates",
p.n_production_updates);
115 write(xml,
"NUpdatesThisRun",
p.n_updates_this_run);
116 write(xml,
"SaveInterval",
p.save_interval);
117 write(xml,
"SavePrefix",
p.save_prefix);
118 write(xml,
"SaveVolfmt",
p.save_volfmt);
136 write(xml,
"nrow",
p.nrow);
137 write(xml,
"GaugeAction",
p.hb_gaugeact);
138 write(xml,
"HBParams",
p.hb_params);
146 XMLReader paramtop(xml, path);
148 read(paramtop,
"nrow",
p.nrow);
149 read(paramtop,
"GaugeAction",
p.hb_gaugeact);
150 read(paramtop,
"HBParams",
p.hb_params);
153 QDPIO::cerr <<
"Error reading HBItrParams XML : " << e << std::endl;
172 XMLReader paramtop(xml_in, path);
174 read(paramtop,
"HBItr",
p.hbitr_params);
175 read(paramtop,
"MCControl",
p.mc_control);
176 read(paramtop,
"Cfg",
p.cfg);
178 if( paramtop.count(
"./InlineMeasurements") == 0 ) {
179 XMLBufferWriter
dummy;
182 p.inline_measurement_xml =
dummy.printCurrentContext();
186 XMLReader measurements_xml(paramtop,
"./InlineMeasurements");
187 std::ostringstream inline_os;
188 measurements_xml.print(inline_os);
189 p.inline_measurement_xml = inline_os.str();
190 QDPIO::cout <<
"InlineMeasurements are: " << std::endl;
191 QDPIO::cout <<
p.inline_measurement_xml << std::endl;
195 QDPIO::cerr <<
"Caught Exception reading HBControl: " << e << std::endl;
207 write(xml,
"MCControl",
p.mc_control);
208 xml <<
p.inline_measurement_xml;
209 write(xml,
"HBItr",
p.hbitr_params);
220 unsigned long update_no)
253 unsigned long update_no,
255 const multi1d<LatticeColorMatrix>&
u)
262 std::ostringstream restart_data_filename;
263 std::ostringstream restart_config_filename;
265 unsigned long save_num = update_no / mc_control.
save_interval;
266 restart_data_filename << mc_control.
save_prefix <<
".ini.xml" << save_num;
267 restart_config_filename << mc_control.
save_prefix <<
".lime" << save_num;
282 XMLFileWriter restart_xml(restart_data_filename.str().c_str());
283 write(restart_xml,
"purgaug", hb);
291 XMLBufferWriter file_xml;
292 push(file_xml,
"HB");
296 XMLBufferWriter config_xml;
297 push(config_xml,
"ChromaHB");
298 write(config_xml,
"MCControl", mc_new);
299 write(config_xml,
"HBItr", update_params);
306 restart_config_filename.str(),
317 multi1d<LatticeColorMatrix>&
u,
320 unsigned long cur_update,
334 XMLBufferWriter gauge_xml;
335 push(gauge_xml,
"ChromaHB");
336 write(gauge_xml,
"MCControl", mc_new);
345 push(xml_out,
"InlineObservables");
348 for(
int m=0;
m < default_measurements.size();
m++)
352 push(xml_out,
"elem");
353 the_meas(cur_update, xml_out);
360 QDPIO::cout <<
"Doing " << user_measurements.size()
361 <<
" user measurements" << std::endl;
362 for(
int m=0;
m < user_measurements.size();
m++)
368 push(xml_out,
"elem");
369 the_meas(cur_update, xml_out );
386 multi1d<LatticeColorMatrix>&
u,
395 unsigned long cur_update = 0;
400 QDPIO::cout <<
"WarmUp Control: About to do " << to_do <<
" updates" << std::endl;
403 push(xml_out,
"WarmUpdates");
405 for(
int i=0;
i < to_do;
i++)
407 push(xml_out,
"elem");
409 push(xml_out,
"Update");
414 write(xml_out,
"update_no", cur_update);
415 write(xml_out,
"WarmUpP",
true);
421 doMeas(xml_out,
u, hb_control,
true, cur_update,
422 default_measurements, user_measurements);
436 multi1d<LatticeColorMatrix>&
u,
450 unsigned long to_do = 0;
455 to_do = total_updates - cur_update ;
458 QDPIO::cout <<
"MC Control: About to do " << to_do <<
" updates" << std::endl;
461 push(xml_out,
"MCUpdates");
463 for(
int i=0;
i < to_do;
i++)
465 push(xml_out,
"elem");
467 push(xml_out,
"Update");
472 QDPIO::cout <<
"Doing Update: " << cur_update <<
" warm_up_p = " <<
false << std::endl;
475 write(xml_out,
"update_no", cur_update);
476 write(xml_out,
"WarmUpP",
false);
482 doMeas(xml_out,
u, hb_control,
false, cur_update,
483 default_measurements, user_measurements);
504 void doHB(multi1d<LatticeColorMatrix>&
u,
512 push(xml_out,
"doHB");
514 multi1d< Handle< AbsInlineMeasurement > > default_measurements(1);
528 doWarmUp(xml_out,
u, S_g, hb_control, default_measurements, user_measurements);
533 doProd(xml_out,
u, S_g, hb_control, default_measurements, user_measurements);
536 QDPIO::cerr <<
"Caught Exception: " << e << std::endl;
569 int main(
int argc,
char *argv[])
579 push(xml_out,
"purgaug");
587 read(xml_in,
"/purgaug", hb_control);
590 write(xml_out,
"Input", xml_in);
593 QDPIO::cerr <<
"Caught Exception reading input XML: " << e << std::endl;
596 catch( std::exception& e ) {
597 QDPIO::cerr <<
"Caught standard library exception: " << e.what() << std::endl;
601 QDPIO::cerr <<
"Caught unknown exception " << std::endl;
611 multi1d<LatticeColorMatrix>
u(
Nd);
614 XMLReader config_xml;
619 push(xml_out,
"Config_info");
620 write(xml_out,
"file_xml", file_xml);
621 write(xml_out,
"config_xml", config_xml);
635 XMLReader gaugeact_reader(is);
640 read(gaugeact_reader,
"/GaugeAction/Name", gaugeact_string);
644 QDPIO::cerr <<
"Error grepping the gaugeact name: " << e<< std::endl;
649 typedef multi1d<LatticeColorMatrix>
P;
650 typedef multi1d<LatticeColorMatrix>
Q;
660 QDPIO::cerr <<
"PURGAUG: caught cast error" << std::endl;
663 catch(std::bad_alloc)
666 std::cerr <<
"PURGAUG: caught bad memory allocation" << std::endl;
671 QDPIO::cerr <<
"PURGAUG: Caught Exception: " << e << std::endl;
674 catch(std::exception& e)
676 QDPIO::cerr <<
"PURGAUG: Caught standard library exception: " << e.what() << std::endl;
682 std::cerr <<
"PURGAUG: caught generic exception during measurement" << std::endl;
688 multi1d < Handle< AbsInlineMeasurement > > the_measurements;
693 XMLReader MeasXML(Measurements_is);
695 std::ostringstream os;
697 QDPIO::cout << os.str() << std::endl << std::flush;
699 read(MeasXML,
"/InlineMeasurements", the_measurements);
702 QDPIO::cerr <<
"Caugth exception while reading measurements: " << e << std::endl
708 QDPIO::cout <<
"There are " << the_measurements.size() <<
" user measurements " << std::endl;
714 doHB(
u, *S_g, hb_control, the_measurements);
718 QDPIO::cerr <<
"PURGAUG: caught cast error" << std::endl;
721 catch(std::bad_alloc)
723 QDPIO::cerr <<
"PURGAUG: caught bad memory allocation" << std::endl;
728 QDPIO::cerr <<
"PURGAUG: Caught std::string exception: " << e << std::endl;
731 catch(std::exception& e)
733 QDPIO::cerr <<
"PURGAUG: Caught standard library exception: " << e.what() << std::endl;
738 QDPIO::cerr <<
"PURGAUG: Caught generic/unknown exception" << std::endl;
Primary include file for CHROMA in application codes.
virtual unsigned long getFrequency(void) const =0
Tell me how often I should measure this beastie.
Abstract base class for gauge actions.
Class for counted reference semantics.
Base class for gauge actions with links appearing linearly in the action.
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams ¶m)
Read parameters.
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams ¶m)
Writer parameters.
void gaugeStartup(XMLReader &gauge_file_xml, XMLReader &gauge_xml, multi1d< LatticeColorMatrix > &u, Cfg_t &cfg)
Initialize the gauge fields.
void mciter(multi1d< LatticeColorMatrix > &u, const LinearGaugeAction &S_g, const HBParams &hbp)
One heatbath interation of updating the gauge field configuration.
void proginfo(XMLWriter &xml)
Print out basic information about this program.
void reset()
Reset the default gauge field state.
void set(const multi1d< LatticeColorMatrix > &u, XMLBufferWriter &record_xml)
Set the default gauge field.
void writeGauge(XMLBufferWriter &file_xml, XMLBufferWriter &record_xml, const multi1d< LatticeColorMatrix > &u, const std::string &file, QDP_volfmt_t volfmt, QDP_serialparallel_t serpar)
Write a gauge config in QIO format.
void savern(int iseed[4])
bool registerAll()
Register all the factories.
bool registerAll()
Register all the factories.
multi1d< LatticeColorMatrix > P
Asqtad Staggered-Dirac operator.
static multi1d< LatticeColorMatrix > u
void doHB(multi1d< LatticeColorMatrix > &u, const LinearGaugeAction &S_g, HBControl &hb_control, multi1d< Handle< AbsInlineMeasurement > > &user_measurements)
void doProd(XMLWriter &xml_out, multi1d< LatticeColorMatrix > &u, const LinearGaugeAction &S_g, HBControl &hb_control, const multi1d< Handle< AbsInlineMeasurement > > &default_measurements, const multi1d< Handle< AbsInlineMeasurement > > &user_measurements)
LinOpSysSolverMGProtoClover::Q Q
push(xml_out,"Condensates")
MCControl newMCHeader(const HBItrParams &update_params, const MCControl &mc_control, unsigned long update_no)
void saveState(const UpdateParams &update_params, MCControl &mc_control, unsigned long update_no, const multi1d< LatticeColorMatrix > &u)
void initialize(int *argc, char ***argv)
Chroma initialisation routine.
void doWarmUp(XMLWriter &xml_out, multi1d< LatticeColorMatrix > &u, const LinearGaugeAction &S_g, HBControl &hb_control, const multi1d< Handle< AbsInlineMeasurement > > &default_measurements, const multi1d< Handle< AbsInlineMeasurement > > &user_measurements)
void finalize(void)
Chroma finalization routine.
std::string getXMLInputFileName()
Get input file name.
void doMeas(XMLWriter &xml_out, multi1d< LatticeColorMatrix > &u, HBControl &hb_control, bool warm_up_p, unsigned long cur_update, const multi1d< Handle< AbsInlineMeasurement > > &default_measurements, const multi1d< Handle< AbsInlineMeasurement > > &user_measurements)
XMLFileWriter & getXMLOutputInstance()
Get xml output instance.
multi1d< LatticeFermion > s(Ncb)
int main(int argc, char *argv[])
Gauge configuration structure.
Main struct from input params and output restarts.
std::string inline_measurement_xml
Holds params for Heat-bath.
Params controlling running of monte carlo.
unsigned long n_warm_up_updates
unsigned long n_production_updates
unsigned int save_interval
unsigned int n_updates_this_run
unsigned long start_update_num