22 namespace InlineUSQCDReadDDPairsPropEnv
45 success &= TheInlineMeasurementFactory::Instance().registerObject(
name, createMeasurement);
58 write(xml,
"Frequency",
p.frequency);
60 write(xml,
"InputFile",
p.input_file_name);
62 bool parallel_io_choice =
false;
63 if(
p.parallel_io == QDPIO_PARALLEL) {
64 parallel_io_choice =
true;
66 write(xml,
"parallel_io", parallel_io_choice);
67 write(xml,
"PropXML",
p.prop_xml);
70 push(xml,
"NamedObject");
71 write(xml,
"source_id",
p.source_id);
72 write(xml,
"prop_id",
p.prop_id);
75 if (
p.xml_file !=
"") {
76 write(xml,
"xml_file",
p.xml_file);
82 InlineUSQCDReadDDPairsPropParams::InlineUSQCDReadDDPairsPropParams() { frequency = 0; xml_file=
""; }
84 InlineUSQCDReadDDPairsPropParams::InlineUSQCDReadDDPairsPropParams(XMLReader& xml_in,
const std::string& path)
88 XMLReader paramtop(xml_in, path);
90 if (paramtop.count(
"Frequency") == 1)
91 read(paramtop,
"Frequency", frequency);
96 read(paramtop,
"Param/InputFile", input_file_name);
102 bool parallel_io_choice = Layout::isIOGridDefined() && ( Layout::numIONodeGrid() > 1);
104 if( paramtop.count(
"Param/parallel_io") == 1) {
105 read(paramtop,
"Param/parallel_io", parallel_io_choice);
108 if( parallel_io_choice ) {
109 parallel_io = QDPIO_PARALLEL;
112 parallel_io = QDPIO_SERIAL;
115 if ( paramtop.count(
"Param/PropXML") == 1 ) {
118 std::ostringstream
dummy;
120 prop_xml =
dummy.str();
123 QDPIO::cout <<
"NO source XML in Parameter file. Will look in Prop Info" << std::endl;
128 read(paramtop,
"./NamedObject/source_id", source_id);
129 read(paramtop,
"./NamedObject/prop_id", prop_id);
131 if( paramtop.count(
"xml_file") == 1 ) {
132 read(paramtop,
"./xml_file", xml_file);
140 QDPIO::cerr << __func__ <<
": caught Exception reading XML: " << e << std::endl;
153 if(
params.xml_file ==
"" ) {
154 func(update_no, xml_out);
157 XMLFileWriter separate_output(
params.xml_file);
158 func(update_no, separate_output);
169 push(xml_out,
"USQCDReadDDPairsProp");
170 write(xml_out,
"update_no", update_no);
177 QDPIO::cout <<
"Attempt to read object name = " <<
params.input_file_name << std::endl;
184 TheNamedObjMap::Instance().create<LatticePropagator>(
params.source_id);
185 TheNamedObjMap::Instance().create<LatticePropagator>(
params.prop_id);
188 QDPIO::cerr <<
"Failed to create the source and prop" <<std::endl;
193 LatticePropagator& source_ref=TheNamedObjMap::Instance().getData<LatticePropagator>(
params.source_id);
194 LatticePropagator& prop_ref=TheNamedObjMap::Instance().getData<LatticePropagator>(
params.prop_id);
198 if (
params.parallel_io == QDPIO_PARALLEL ) {
200 QDPIO::cout <<
"Attempting Parallel IO for reading" << std::endl;
203 QDPIO::cout <<
"Attempting Serial IO for reading " << std::endl;
208 QDPFileReader input_file(file_xml,
213 push(xml_out,
"FileXML");
228 XMLReader prop_info_xml(file_xml,
"/usqcdPropFile/info");
231 if( prop_info_xml.count(
"./Propagator") != 0 ) {
234 QDPIO::cout <<
"Found header in Prop File <info> record" << std::endl;
235 QDPIO::cout <<
"Attempting to bind" << std::endl;
238 read(prop_info_xml,
"Propagator", prop_h_info);
248 std::istringstream is(
params.prop_xml);
249 XMLReader source_top(is);
251 QDPIO::cout <<
"Looking for <Propagator> tag in the user supplied XML" << std::endl;
253 if( source_top.count(
"/Propagator") == 0 ) {
254 QDPIO::cout <<
"<Propagator> tag not found!" << std::endl;
259 QDPIO::cout <<
"Attempting to bind" << std::endl;
260 read(source_top,
"/Propagator", prop_h_info);
265 QDPIO::cout <<
"<Propagator> header XML successfully bound" << std::endl;
271 QDPIO::cout <<
"Caught exception: " << e << std::endl;
276 QDPIO::cout <<
"Caught generic exception. Most likely I failed to open a reader on th std::string you provided for <PropXML>" << std::endl;
282 LatticeFermion tmpSource;
283 LatticeFermion tmpProp;
287 for(
int i=0;
i < 12;
i++) {
290 XMLReader rec_src_xml, rec_prop_xml;
300 read(input_file, rec_src_xml, tmpSource);
303 read(input_file, rec_prop_xml, tmpProp);
311 if ( rec_prop_xml.count(
"/usqcdPropInfo") != 0 ) {
315 read(rec_prop_xml,
"/usqcdPropInfo/spin", spin);
316 read(rec_prop_xml,
"/usqcdPropInfo/color", col);
317 QDPIO::cout <<
"Record is sink record with spin=" << spin <<
" color = "<< col << std::endl;
321 else if( rec_prop_xml.count(
"/usqcdInfo" ) != 0 ) {
325 read(rec_prop_xml,
"/usqcdInfo/spin", spin);
326 read(rec_prop_xml,
"/usqcdInfo/color", col);
327 QDPIO::cout <<
"Record is sink record with spin=" << spin <<
" color = "<< col << std::endl;
331 QDPIO::cout <<
"Found neither usqcdInfo nor usqcdPropInfo tag in the propagator record XML" << std::endl;
332 QDPIO::cout <<
"Aborting" << std::endl;
339 QDPIO::cout <<
"Caught exception reading XML" << e << std::endl;
352 XMLBufferWriter source_file_xml;
353 XMLBufferWriter prop_file_xml;
354 push(source_file_xml,
"source");
356 pop(source_file_xml);
358 push(prop_file_xml,
"propagator");
365 XMLBufferWriter prop_info_out;
366 XMLBufferWriter source_info_out;
367 write(prop_info_out,
"Propagator", prop_h_info);
368 write(source_info_out,
"MakeSource", make_source_header);
371 TheNamedObjMap::Instance().get(
params.prop_id).setFileXML(prop_file_xml);
372 TheNamedObjMap::Instance().get(
params.prop_id).setRecordXML(prop_info_out);
374 TheNamedObjMap::Instance().get(
params.source_id).setFileXML(source_file_xml);
375 TheNamedObjMap::Instance().get(
params.source_id).setRecordXML(source_info_out);
383 multi1d<Double> source_corr = sumMulti(localNorm2(source_ref),
386 multi1d<Double> prop_corr = sumMulti(localNorm2(prop_ref),
389 write(xml_out,
"source_corr", source_corr);
390 write(xml_out,
"prop_corr", prop_corr);
Inline measurement factory.
Primary include file for CHROMA library code.
Inline writing of memory objects.
Fourier transform phase factor support.
const Set & getSet() const
The set to be used in sumMulti.
void FermToProp(const LatticeFermionF &a, LatticePropagatorF &b, int color_index, int spin_index)
Insert a LatticeFermion into a LatticePropagator.
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams ¶m)
Read parameters.
std::string uniqueId()
Return a unique id.
ForwardProp_t prop_header
Inline task to read a USQCD DD Pairs Prop.
Named object function std::map.
static bool registered
Local registration flag.
bool registerAll()
Register all the factories.
multi1d< Hadron2PtContraction_t > operator()(const multi1d< LatticeColorMatrix > &u)
Asqtad Staggered-Dirac operator.
void write(XMLWriter &xml, const std::string &path, const InlineUSQCDReadDDPairsPropParams &p)
Object buffer.
Routines associated with Chroma propagator IO.
Fourier transform phase factor support.
Mega structure holding a propagator source.
PropSourceConst_t source_header
Mega structure holding a full forward prop (not sink smeared)
PropSourceConst_t source_header
push(xml_out,"Cooled_Topology")