purgaug.cc

Go to the documentation of this file.
00001 // $Id: purgaug.cc,v 3.10 2008/01/20 17:46:43 edwards Exp $
00002 /*! \file
00003  *  \brief Main code for pure gauge field generation
00004  */
00005 
00006 #include "chroma.h"
00007 #include "actions/gauge/gaugeacts/gaugeacts_aggregate.h"
00008 
00009 using namespace Chroma;
00010 
00011 namespace Chroma 
00012 {
00013 
00014   //! Holds gauge action
00015   struct HBGauge
00016   {
00017     string  gauge_act;     /*!<  Holds gauge action xml */
00018   };
00019 
00020 
00021   //! Read the parameters
00022   void read(XMLReader& xml_in, const std::string& path, HBGauge& p)
00023   {
00024     try {
00025       // Read the inverter Parameters
00026       XMLReader xml_tmp(xml_in, "./GaugeAction");
00027       std::ostringstream os;
00028       xml_tmp.print(os);
00029       p.gauge_act = os.str();
00030     }
00031     catch(const string& s) {
00032       QDPIO::cerr << "Caught Exception while reading gauge action: " << s <<endl;
00033       QDP_abort(1);
00034     }
00035 
00036     QDPIO::cout << "Gauge action: read \n" << p.gauge_act << endl;
00037   }
00038 
00039 
00040   //! Writer
00041   void write(XMLWriter& xml, const std::string& path, const HBGauge& p)
00042   {
00043     xml << p.gauge_act;
00044   }
00045 
00046 
00047   //! Reader
00048   void read(XMLReader& xml, const std::string& path, HBParams& p)
00049   {
00050     try { 
00051       XMLReader paramtop(xml, path);
00052       read(paramtop, "NmaxHB", p.NmaxHB);
00053       read(paramtop, "nOver", p.nOver);
00054     }
00055     catch(const std::string& e ) { 
00056       QDPIO::cerr << "Caught Exception reading HBParams: " << e << endl;
00057       QDP_abort(1);
00058     }
00059   }
00060 
00061   //! Writer
00062   void write(XMLWriter& xml, const std::string& path, const HBParams& p)
00063   {
00064     push(xml, path);
00065 
00066     write(xml, "NmaxHB", p.NmaxHB);
00067     write(xml, "nOver", p.nOver);
00068 
00069     pop(xml);
00070   }
00071 
00072 
00073   //! Params controlling running of monte carlo
00074   struct MCControl 
00075   {
00076     QDP::Seed rng_seed;
00077     unsigned long start_update_num;
00078     unsigned long n_warm_up_updates;
00079     unsigned long n_production_updates;
00080     unsigned int  n_updates_this_run;
00081     unsigned int  save_interval;
00082     std::string   save_prefix;
00083     QDP_volfmt_t  save_volfmt;
00084   };
00085 
00086   void read(XMLReader& xml, const std::string& path, MCControl& p) 
00087   {
00088     try { 
00089       XMLReader paramtop(xml, path);
00090       read(paramtop, "./RNG", p.rng_seed);
00091       read(paramtop, "./StartUpdateNum", p.start_update_num);
00092       read(paramtop, "./NWarmUpUpdates", p.n_warm_up_updates);
00093       read(paramtop, "./NProductionUpdates", p.n_production_updates);
00094       read(paramtop, "./NUpdatesThisRun", p.n_updates_this_run);
00095       read(paramtop, "./SaveInterval", p.save_interval);
00096       read(paramtop, "./SavePrefix", p.save_prefix);
00097       read(paramtop, "./SaveVolfmt", p.save_volfmt);
00098 
00099       if (p.n_updates_this_run % p.save_interval != 0)
00100         throw string("UpdateThisRun not a multiple of SaveInterval");
00101     }
00102     catch(const std::string& e ) { 
00103       QDPIO::cerr << "Caught Exception reading MCControl: " << e << endl;
00104       QDP_abort(1);
00105     }
00106   }
00107 
00108   void write(XMLWriter& xml, const std::string& path, const MCControl& p) 
00109   {
00110     push(xml, path);
00111 
00112     write(xml, "RNG", p.rng_seed);
00113     write(xml, "StartUpdateNum", p.start_update_num);
00114     write(xml, "NWarmUpUpdates", p.n_warm_up_updates);
00115     write(xml, "NProductionUpdates", p.n_production_updates);
00116     write(xml, "NUpdatesThisRun", p.n_updates_this_run);
00117     write(xml, "SaveInterval", p.save_interval);
00118     write(xml, "SavePrefix", p.save_prefix);
00119     write(xml, "SaveVolfmt", p.save_volfmt);
00120 
00121     pop(xml);
00122   }
00123 
00124 
00125   //! Holds params for Heat-bath
00126   struct HBItrParams 
00127   { 
00128     multi1d<int> nrow;
00129 
00130     HBGauge   hb_gaugeact;    /*!< This is polymorphic */
00131     HBParams  hb_params;      /*!< Solely the HB bit */
00132   };
00133 
00134   void write(XMLWriter& xml, const std::string& path, const HBItrParams& p)
00135   {
00136     push(xml, path);
00137     write(xml, "nrow", p.nrow);
00138     write(xml, "GaugeAction", p.hb_gaugeact);
00139     write(xml, "HBParams", p.hb_params);
00140     pop(xml);
00141   }
00142 
00143 
00144   void read(XMLReader& xml, const std::string& path, HBItrParams& p) 
00145   {
00146     try {
00147       XMLReader paramtop(xml, path);
00148       
00149       read(paramtop, "nrow", p.nrow);
00150       read(paramtop, "GaugeAction", p.hb_gaugeact);
00151       read(paramtop, "HBParams", p.hb_params);
00152     }
00153     catch( const std::string& e ) { 
00154       QDPIO::cerr << "Error reading HBItrParams XML : " << e << endl;
00155       QDP_abort(1);
00156     }
00157   }
00158 
00159   //! Main struct from input params and output restarts
00160   struct HBControl 
00161   {
00162     HBItrParams   hbitr_params;
00163     MCControl     mc_control;
00164     Cfg_t         cfg;
00165     std::string   inline_measurement_xml;
00166   };
00167 
00168 
00169   //! Reader
00170   void read(XMLReader& xml_in, const std::string& path, HBControl& p) 
00171   {
00172     try {
00173       XMLReader paramtop(xml_in, path);
00174 
00175       read(paramtop, "HBItr", p.hbitr_params);
00176       read(paramtop, "MCControl", p.mc_control);
00177       read(paramtop, "Cfg", p.cfg);
00178 
00179       if( paramtop.count("./InlineMeasurements") == 0 ) {
00180         XMLBufferWriter dummy;
00181         push(dummy, "InlineMeasurements");
00182         pop(dummy); // InlineMeasurements
00183         p.inline_measurement_xml = dummy.printCurrentContext();
00184       }
00185       else 
00186       {
00187         XMLReader measurements_xml(paramtop, "./InlineMeasurements");
00188         std::ostringstream inline_os;
00189         measurements_xml.print(inline_os);
00190         p.inline_measurement_xml = inline_os.str();
00191         QDPIO::cout << "InlineMeasurements are: " << endl;
00192         QDPIO::cout << p.inline_measurement_xml << endl;
00193       }
00194     }
00195     catch(const std::string& e) {
00196       QDPIO::cerr << "Caught Exception reading HBControl: " << e << endl;
00197       QDP_abort(1);
00198     }
00199   }
00200 
00201 
00202   //! Writer
00203   void write(XMLWriter& xml, const std::string& path, const HBControl& p) 
00204   {
00205     push(xml, path);
00206 
00207     write(xml, "Cfg", p.cfg);
00208     write(xml, "MCControl", p.mc_control);
00209     xml << p.inline_measurement_xml;
00210     write(xml, "HBItr", p.hbitr_params);
00211 
00212     pop(xml);
00213   }
00214 
00215 
00216 
00217   //--------------------------------------------------------------------------
00218   // Specialise
00219   MCControl newMCHeader(const HBItrParams& update_params, 
00220                         const MCControl& mc_control,
00221                         unsigned long update_no)
00222   {
00223     START_CODE();
00224 
00225     // Copy old params
00226     MCControl p_new = mc_control;
00227     
00228     // Get Current RNG Seed
00229     QDP::RNG::savern(p_new.rng_seed);
00230    
00231     // Set the current traj number
00232     p_new.start_update_num = update_no;
00233     
00234     // Reset the warmups
00235     p_new.n_warm_up_updates = 0;
00236     
00237     // Set the num_updates_this_run
00238     unsigned long total = mc_control.n_production_updates;
00239 
00240     if ( total < mc_control.n_updates_this_run + update_no ) { 
00241       p_new.n_updates_this_run = total - update_no;
00242     }
00243 
00244     END_CODE();
00245 
00246     return p_new;
00247   }
00248 
00249 
00250 
00251   // Specialise
00252   void saveState(const HBItrParams& update_params, 
00253                  MCControl& mc_control,
00254                  unsigned long update_no,
00255                  const string& inline_measurement_xml,
00256                  const multi1d<LatticeColorMatrix>& u)
00257   {
00258     START_CODE();
00259 
00260     MCControl mc_new = newMCHeader(update_params, mc_control, update_no);
00261 
00262     // Files
00263     std::ostringstream restart_data_filename;
00264     std::ostringstream restart_config_filename;
00265 
00266     unsigned long save_num = update_no / mc_control.save_interval;
00267     restart_data_filename << mc_control.save_prefix << ".ini.xml" << save_num;
00268     restart_config_filename << mc_control.save_prefix << ".lime" << save_num;
00269     
00270     {
00271       HBControl hb;
00272       hb.hbitr_params = update_params;
00273       hb.mc_control = mc_new;
00274       hb.inline_measurement_xml = inline_measurement_xml;
00275 
00276       // Set the name of the restart file
00277       hb.cfg.cfg_file = restart_config_filename.str();
00278 
00279       // Hijack this for now and assumes it means what I want it to mean
00280       hb.cfg.cfg_type = CFG_TYPE_SZINQIO;
00281 
00282       // Write a restart DATA file from the buffer XML
00283       XMLFileWriter restart_xml(restart_data_filename.str().c_str());
00284       write(restart_xml, "purgaug", hb);
00285       restart_xml.close();
00286     }
00287 
00288     {
00289       // Save the config
00290 
00291       // some dummy header for the file
00292       XMLBufferWriter file_xml;
00293       push(file_xml, "HB");
00294       proginfo(file_xml);
00295       pop(file_xml);
00296 
00297       XMLBufferWriter config_xml;
00298       push(config_xml, "ChromaHB");
00299       write(config_xml, "MCControl", mc_new);
00300       write(config_xml, "HBItr", update_params);
00301       pop(config_xml);
00302 
00303       // Save the config
00304       writeGauge(file_xml, 
00305                  config_xml,
00306                  u,
00307                  restart_config_filename.str(),
00308                  mc_new.save_volfmt,
00309                  QDPIO_SERIAL);    
00310     }
00311     
00312     END_CODE();
00313   }
00314 
00315 
00316   //--------------------------------------------------------------------------
00317   void doMeas(XMLWriter& xml_out,
00318               multi1d<LatticeColorMatrix>& u,
00319               HBControl& hb_control, 
00320               bool warm_up_p,
00321               unsigned long cur_update,
00322               const multi1d< Handle< AbsInlineMeasurement > >& default_measurements,
00323               const multi1d< Handle<AbsInlineMeasurement> >& user_measurements) 
00324   {
00325     START_CODE();
00326 
00327     // Create a gauge header for inline measurements.
00328     // Since there are defaults always measured, we must always
00329     // create a header.
00330     //
00331     // NOTE: THIS HEADER STUFF NEEDS A LOT MORE THOUGHT
00332     //
00333     MCControl mc_new = newMCHeader(hb_control.hbitr_params, hb_control.mc_control, cur_update);
00334 
00335     XMLBufferWriter gauge_xml;
00336     push(gauge_xml, "ChromaHB");
00337     write(gauge_xml, "MCControl", mc_new);
00338     write(gauge_xml, "HBItr", hb_control.hbitr_params);
00339     pop(gauge_xml);
00340 
00341     // Reset and set the default gauge field
00342     InlineDefaultGaugeField::reset();
00343     InlineDefaultGaugeField::set(u, gauge_xml);
00344 
00345     // Measure inline observables 
00346     push(xml_out, "InlineObservables");
00347 
00348     // Always measure defaults
00349     for(int m=0; m < default_measurements.size(); m++) 
00350     {
00351       // Caller writes elem rule 
00352       AbsInlineMeasurement& the_meas = *(default_measurements[m]);
00353       push(xml_out, "elem");
00354       the_meas(cur_update, xml_out);
00355       pop(xml_out);
00356     }
00357         
00358     // Only measure user measurements after warm up
00359     if( ! warm_up_p ) 
00360     {
00361       QDPIO::cout << "Doing " << user_measurements.size() 
00362                   <<" user measurements" << endl;
00363       for(int m=0; m < user_measurements.size(); m++) 
00364       {
00365         AbsInlineMeasurement& the_meas = *(user_measurements[m]);
00366         if( cur_update % the_meas.getFrequency() == 0 ) 
00367         { 
00368           // Caller writes elem rule
00369           push(xml_out, "elem");
00370           the_meas(cur_update, xml_out );
00371           pop(xml_out); 
00372         }
00373       }
00374     }
00375     pop(xml_out); // pop("InlineObservables");
00376 
00377     // Reset the default gauge field
00378     InlineDefaultGaugeField::reset();
00379     
00380     END_CODE();
00381   }
00382   
00383 
00384 
00385   //--------------------------------------------------------------------------
00386   void doWarmUp(XMLWriter& xml_out,
00387                 multi1d<LatticeColorMatrix>& u,
00388                 const LinearGaugeAction& S_g,
00389                 HBControl& hb_control,
00390                 const multi1d< Handle< AbsInlineMeasurement > >& default_measurements,
00391                 const multi1d< Handle<AbsInlineMeasurement> >& user_measurements) 
00392   {
00393     START_CODE();
00394 
00395     // Set the update number
00396     unsigned long cur_update = 0;
00397       
00398     // Compute how many updates to do
00399     unsigned long to_do = hb_control.mc_control.n_warm_up_updates;
00400       
00401     QDPIO::cout << "WarmUp Control: About to do " << to_do << " updates" << endl;
00402 
00403     // XML Output
00404     push(xml_out, "WarmUpdates");
00405 
00406     for(int i=0; i < to_do; i++) 
00407     {
00408       push(xml_out, "elem"); // Caller writes elem rule
00409 
00410       push(xml_out, "Update");
00411       // Increase current update counter
00412       cur_update++;
00413         
00414       // Log
00415       write(xml_out, "update_no", cur_update);
00416       write(xml_out, "WarmUpP", true);
00417 
00418       // Do the update, but with no measurements
00419       mciter(u, S_g, hb_control.hbitr_params.hb_params); //one hb sweep
00420 
00421       // Do measurements
00422       doMeas(xml_out, u, hb_control, true, cur_update,
00423              default_measurements, user_measurements);
00424 
00425       pop(xml_out); // pop("Update");
00426       pop(xml_out); // pop("elem");
00427     }
00428 
00429     pop(xml_out); // pop("WarmUpdates")
00430     
00431     END_CODE();
00432   }
00433   
00434 
00435   //--------------------------------------------------------------------------
00436   void doProd(XMLWriter& xml_out,
00437               multi1d<LatticeColorMatrix>& u,
00438               const LinearGaugeAction& S_g,
00439               HBControl& hb_control, 
00440               const multi1d< Handle< AbsInlineMeasurement > >& default_measurements,
00441               const multi1d< Handle<AbsInlineMeasurement> >& user_measurements) 
00442   {
00443     START_CODE();
00444 
00445     // Set the update number
00446     unsigned long cur_update = hb_control.mc_control.start_update_num;
00447       
00448     // Compute how many updates to do
00449     unsigned long total_updates = hb_control.mc_control.n_production_updates;
00450       
00451     unsigned long to_do = 0;
00452     if ( total_updates > hb_control.mc_control.n_updates_this_run + cur_update +1 ) {
00453       to_do = hb_control.mc_control.n_updates_this_run;
00454     }
00455     else {
00456       to_do = total_updates - cur_update ;
00457     }
00458       
00459     QDPIO::cout << "MC Control: About to do " << to_do << " updates" << endl;
00460 
00461     // XML Output
00462     push(xml_out, "MCUpdates");
00463 
00464     for(int i=0; i < to_do; i++) 
00465     {
00466       push(xml_out, "elem"); // Caller writes elem rule
00467 
00468       push(xml_out, "Update");
00469       // Increase current update counter
00470       cur_update++;
00471         
00472       // Decide if the next update is a warm up or not
00473       QDPIO::cout << "Doing Update: " << cur_update << " warm_up_p = " << false << endl;
00474 
00475       // Log
00476       write(xml_out, "update_no", cur_update);
00477       write(xml_out, "WarmUpP", false);
00478 
00479       // Do the update
00480       mciter(u, S_g, hb_control.hbitr_params.hb_params); //one hb sweep
00481 
00482       // Do measurements
00483       doMeas(xml_out, u, hb_control, false, cur_update,
00484              default_measurements, user_measurements);
00485 
00486       // Save if needed
00487       if( cur_update % hb_control.mc_control.save_interval == 0 ) 
00488       {
00489         saveState(hb_control.hbitr_params, hb_control.mc_control, 
00490                   cur_update,
00491                   hb_control.inline_measurement_xml, u);
00492       }
00493 
00494       pop(xml_out); // pop("Update");
00495       pop(xml_out); // pop("elem");
00496     }
00497 
00498     pop(xml_out); // pop("MCUpdates")
00499     
00500     END_CODE();
00501   }
00502   
00503 
00504   //--------------------------------------------------------------------------
00505   void doHB(multi1d<LatticeColorMatrix>& u,
00506             const LinearGaugeAction& S_g,
00507             HBControl& hb_control, 
00508             multi1d< Handle<AbsInlineMeasurement> >& user_measurements) 
00509   {
00510     START_CODE();
00511 
00512     XMLWriter& xml_out = TheXMLOutputWriter::Instance();
00513     push(xml_out, "doHB");
00514 
00515     multi1d< Handle< AbsInlineMeasurement > > default_measurements(1);
00516     InlinePlaquetteEnv::Params plaq_params;
00517     plaq_params.frequency = 1;
00518     // It is a handle
00519     default_measurements[0] = new InlinePlaquetteEnv::InlineMeas(plaq_params);
00520 
00521     try 
00522     {
00523       // Initialise the RNG
00524       QDP::RNG::setrn(hb_control.mc_control.rng_seed);
00525       
00526       // If warmups are required, do them first
00527       if (hb_control.mc_control.n_warm_up_updates > 0)
00528       {
00529         doWarmUp(xml_out, u, S_g, hb_control, default_measurements, user_measurements);
00530         hb_control.mc_control.n_warm_up_updates = 0;  // reset
00531       }
00532 
00533       // Do the production updates
00534       doProd(xml_out, u, S_g, hb_control, default_measurements, user_measurements);
00535     }
00536     catch( const std::string& e) { 
00537       QDPIO::cerr << "Caught Exception: " << e << endl;
00538       QDP_abort(1);
00539     }
00540 
00541     pop(xml_out);
00542     
00543     END_CODE();
00544   }
00545   
00546   bool linkageHack(void)
00547   {
00548     bool foo = true;
00549     
00550     // Gauge actions
00551     foo &= GaugeActsEnv::registerAll();
00552 
00553     // Inline Measurements
00554     foo &= InlineAggregateEnv::registerAll();
00555 
00556     return foo;
00557   }
00558 }
00559 
00560 
00561 using namespace Chroma;
00562 
00563 //! Pure gauge field generation via heatbath
00564 /*! \defgroup purgaug Heat-bath
00565  *  \ingroup main
00566  *
00567  * Main program for heat-bath generation of 
00568  */
00569 
00570 int main(int argc, char *argv[]) 
00571 {
00572   Chroma::initialize(&argc, &argv);
00573   
00574   START_CODE();
00575 
00576   // Chroma Init stuff -- Open DATA and XMLDAT
00577   linkageHack();
00578 
00579   XMLFileWriter& xml_out = Chroma::getXMLOutputInstance();
00580   push(xml_out, "purgaug");
00581 
00582   HBControl  hb_control;
00583 
00584   try
00585   {
00586     XMLReader xml_in(Chroma::getXMLInputFileName());
00587 
00588     read(xml_in, "/purgaug", hb_control);
00589 
00590     // Write out the input
00591     write(xml_out, "Input", xml_in);
00592   }
00593   catch( const std::string& e ) {
00594     QDPIO::cerr << "Caught Exception reading input XML: " << e << endl;
00595     QDP_abort(1);
00596   }
00597   catch( std::exception& e ) {
00598     QDPIO::cerr << "Caught standard library exception: " << e.what() << endl;
00599     QDP_abort(1);
00600   }
00601   catch(...) {
00602     QDPIO::cerr << "Caught unknown exception " << endl;
00603     QDP_abort(1);
00604   }
00605 
00606   Layout::setLattSize(hb_control.hbitr_params.nrow);
00607   Layout::create();
00608 
00609   proginfo(xml_out);    // Print out basic program info
00610 
00611   // Start up the config
00612   multi1d<LatticeColorMatrix> u(Nd);
00613   {
00614     XMLReader file_xml;
00615     XMLReader config_xml;
00616     
00617     gaugeStartup(file_xml, config_xml, u, hb_control.cfg);
00618 
00619     // Write out the config header
00620     push(xml_out, "Config_info");
00621     write(xml_out, "file_xml", file_xml);
00622     write(xml_out, "config_xml", config_xml);
00623     pop(xml_out);
00624   }
00625   
00626 
00627   // Create the gauge action
00628   // This code is limited to only rb sets and subsets.
00629   // The main point is
00630   // The number of subsets within the staples, etc. and to get the subsets
00631   // straight
00632   Handle< LinearGaugeAction > S_g;
00633   try
00634   {
00635     std::istringstream is(hb_control.hbitr_params.hb_gaugeact.gauge_act);
00636     XMLReader gaugeact_reader(is);
00637 
00638     // Get the name of the gauge act
00639     std::string gaugeact_string;
00640     try { 
00641       read(gaugeact_reader, "/GaugeAction/Name", gaugeact_string);
00642     }
00643     catch( const std::string& e) 
00644     {
00645       QDPIO::cerr << "Error grepping the gaugeact name: " << e<<  endl;
00646       QDP_abort(1);
00647     }
00648 
00649     // Throw an exception if not found
00650     typedef multi1d<LatticeColorMatrix>  P;
00651     typedef multi1d<LatticeColorMatrix>  Q;
00652 
00653     GaugeAction<P,Q>* gaugeact = 
00654       TheGaugeActFactory::Instance().createObject(gaugeact_string, 
00655                                                   gaugeact_reader, 
00656                                                   "/GaugeAction");
00657     S_g = dynamic_cast<LinearGaugeAction*>(gaugeact);
00658   }
00659   catch(std::bad_cast) 
00660   {
00661     QDPIO::cerr << "PURGAUG: caught cast error" << endl;
00662     QDP_abort(1);
00663   }
00664   catch(std::bad_alloc) 
00665   { 
00666     // This might happen on any node, so report it
00667     cerr << "PURGAUG: caught bad memory allocation" << endl;
00668     QDP_abort(1);
00669   }
00670   catch(const std::string& e) 
00671   {
00672     QDPIO::cerr << "PURGAUG: Caught Exception: " << e << endl;
00673     QDP_abort(1);
00674   }
00675   catch(std::exception& e) 
00676   {
00677     QDPIO::cerr << "PURGAUG: Caught standard library exception: " << e.what() << endl;
00678     QDP_abort(1);
00679   }
00680   catch(...)
00681   {
00682     // This might happen on any node, so report it
00683     cerr << "PURGAUG: caught generic exception during measurement" << endl;
00684     QDP_abort(1);
00685   }
00686 
00687 
00688   // Get the measurements
00689   multi1d < Handle< AbsInlineMeasurement > > the_measurements;
00690 
00691   try { 
00692     std::istringstream Measurements_is(hb_control.inline_measurement_xml);
00693 
00694     XMLReader MeasXML(Measurements_is);
00695 
00696     std::ostringstream os;
00697     MeasXML.print(os);
00698     QDPIO::cout << os.str() << endl << flush;
00699 
00700     read(MeasXML, "/InlineMeasurements", the_measurements);
00701   }
00702   catch(const std::string& e) { 
00703     QDPIO::cerr << "Caugth exception while reading measurements: " << e << endl
00704                 << flush;
00705 
00706     QDP_abort(1);
00707   }
00708 
00709   QDPIO::cout << "There are " << the_measurements.size() << " user measurements " << endl;
00710 
00711   
00712   // Run
00713   try 
00714   {
00715     doHB(u, *S_g, hb_control, the_measurements);
00716   } 
00717   catch(std::bad_cast) 
00718   {
00719     QDPIO::cerr << "PURGAUG: caught cast error" << endl;
00720     QDP_abort(1);
00721   }
00722   catch(std::bad_alloc) 
00723   { 
00724     QDPIO::cerr << "PURGAUG: caught bad memory allocation" << endl;
00725     QDP_abort(1);
00726   }
00727   catch(const std::string& e) 
00728   { 
00729     QDPIO::cerr << "PURGAUG: Caught string exception: " << e << endl;
00730     QDP_abort(1);
00731   }
00732   catch(std::exception& e) 
00733   {
00734     QDPIO::cerr << "PURGAUG: Caught standard library exception: " << e.what() << endl;
00735     QDP_abort(1);
00736   }
00737   catch(...) 
00738   {
00739     QDPIO::cerr << "PURGAUG: Caught generic/unknown exception" << endl;
00740     QDP_abort(1);
00741   }
00742 
00743   pop(xml_out);
00744 
00745   END_CODE();
00746 
00747   Chroma::finalize();
00748   exit(0);
00749 }
00750 

Generated on Sun Nov 22 04:34:07 2009 for CHROMA by  doxygen 1.4.7