mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-11-04 14:04:32 +00:00 
			
		
		
		
	Hadrons: XML validator utility
This commit is contained in:
		@@ -48,28 +48,32 @@ Application::Application(void)
 | 
			
		||||
{
 | 
			
		||||
    initLogger();
 | 
			
		||||
    auto dim = GridDefaultLatt(), mpi = GridDefaultMpi(), loc(dim);
 | 
			
		||||
    locVol_ = 1;
 | 
			
		||||
    for (unsigned int d = 0; d < dim.size(); ++d)
 | 
			
		||||
 | 
			
		||||
    if (dim.size())
 | 
			
		||||
    {
 | 
			
		||||
        loc[d]  /= mpi[d];
 | 
			
		||||
        locVol_ *= loc[d];
 | 
			
		||||
        locVol_ = 1;
 | 
			
		||||
        for (unsigned int d = 0; d < dim.size(); ++d)
 | 
			
		||||
        {
 | 
			
		||||
            loc[d]  /= mpi[d];
 | 
			
		||||
            locVol_ *= loc[d];
 | 
			
		||||
        }
 | 
			
		||||
        LOG(Message) << "====== HADRONS APPLICATION INITIALISATION ======" << std::endl;
 | 
			
		||||
        LOG(Message) << "** Dimensions" << std::endl;
 | 
			
		||||
        LOG(Message) << "Global lattice: " << dim << std::endl;
 | 
			
		||||
        LOG(Message) << "MPI partition : " << mpi << std::endl;
 | 
			
		||||
        LOG(Message) << "Local lattice : " << loc << std::endl;
 | 
			
		||||
        LOG(Message) << std::endl;
 | 
			
		||||
        LOG(Message) << "** Default parameters (and associated C macros)" << std::endl;
 | 
			
		||||
        LOG(Message) << "ASCII output precision  : " << MACOUT(DEFAULT_ASCII_PREC) << std::endl;
 | 
			
		||||
        LOG(Message) << "Fermion implementation  : " << MACOUTS(FIMPLBASE) << std::endl;
 | 
			
		||||
        LOG(Message) << "z-Fermion implementation: " << MACOUTS(ZFIMPLBASE) << std::endl;
 | 
			
		||||
        LOG(Message) << "Scalar implementation   : " << MACOUTS(SIMPLBASE) << std::endl;
 | 
			
		||||
        LOG(Message) << "Gauge implementation    : " << MACOUTS(GIMPLBASE) << std::endl;
 | 
			
		||||
        LOG(Message) << "Eigenvector base size   : " 
 | 
			
		||||
                    << MACOUT(HADRONS_DEFAULT_LANCZOS_NBASIS) << std::endl;
 | 
			
		||||
        LOG(Message) << "Schur decomposition     : " << MACOUTS(HADRONS_DEFAULT_SCHUR) << std::endl;
 | 
			
		||||
        LOG(Message) << std::endl;
 | 
			
		||||
    }
 | 
			
		||||
    LOG(Message) << "====== HADRONS APPLICATION INITIALISATION ======" << std::endl;
 | 
			
		||||
    LOG(Message) << "** Dimensions" << std::endl;
 | 
			
		||||
    LOG(Message) << "Global lattice: " << dim << std::endl;
 | 
			
		||||
    LOG(Message) << "MPI partition : " << mpi << std::endl;
 | 
			
		||||
    LOG(Message) << "Local lattice : " << loc << std::endl;
 | 
			
		||||
    LOG(Message) << std::endl;
 | 
			
		||||
    LOG(Message) << "** Default parameters (and associated C macros)" << std::endl;
 | 
			
		||||
    LOG(Message) << "ASCII output precision  : " << MACOUT(DEFAULT_ASCII_PREC) << std::endl;
 | 
			
		||||
    LOG(Message) << "Fermion implementation  : " << MACOUTS(FIMPLBASE) << std::endl;
 | 
			
		||||
    LOG(Message) << "z-Fermion implementation: " << MACOUTS(ZFIMPLBASE) << std::endl;
 | 
			
		||||
    LOG(Message) << "Scalar implementation   : " << MACOUTS(SIMPLBASE) << std::endl;
 | 
			
		||||
    LOG(Message) << "Gauge implementation    : " << MACOUTS(GIMPLBASE) << std::endl;
 | 
			
		||||
    LOG(Message) << "Eigenvector base size   : " 
 | 
			
		||||
                 << MACOUT(HADRONS_DEFAULT_LANCZOS_NBASIS) << std::endl;
 | 
			
		||||
    LOG(Message) << "Schur decomposition     : " << MACOUTS(HADRONS_DEFAULT_SCHUR) << std::endl;
 | 
			
		||||
    LOG(Message) << std::endl;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Application::Application(const Application::GlobalPar &par)
 | 
			
		||||
 
 | 
			
		||||
@@ -43,15 +43,13 @@ HADRONS_ERROR_REF(ObjectDefinition, "no object with address " + std::to_string(a
 | 
			
		||||
// constructor /////////////////////////////////////////////////////////////////
 | 
			
		||||
Environment::Environment(void)
 | 
			
		||||
{
 | 
			
		||||
    dim_         = GridDefaultLatt();
 | 
			
		||||
    nd_          = dim_.size();
 | 
			
		||||
    createGrid<vComplex>(1);
 | 
			
		||||
    dim_ = GridDefaultLatt();
 | 
			
		||||
    nd_  = dim_.size();
 | 
			
		||||
    vol_ = 1.;
 | 
			
		||||
    for (auto d: dim_)
 | 
			
		||||
    {
 | 
			
		||||
        vol_ *= d;
 | 
			
		||||
    }
 | 
			
		||||
    rng4d_.reset(new GridParallelRNG(getGrid()));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// grids ///////////////////////////////////////////////////////////////////////
 | 
			
		||||
@@ -76,8 +74,13 @@ double Environment::getVolume(void) const
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// random number generator /////////////////////////////////////////////////////
 | 
			
		||||
GridParallelRNG * Environment::get4dRng(void) const
 | 
			
		||||
GridParallelRNG * Environment::get4dRng(void)
 | 
			
		||||
{
 | 
			
		||||
    if (rng4d_ == nullptr)
 | 
			
		||||
    {
 | 
			
		||||
        rng4d_.reset(new GridParallelRNG(getGrid()));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return rng4d_.get();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -113,7 +113,7 @@ public:
 | 
			
		||||
    unsigned int            getNd(void) const;
 | 
			
		||||
    double                  getVolume(void) const;
 | 
			
		||||
    // random number generator
 | 
			
		||||
    GridParallelRNG *       get4dRng(void) const;
 | 
			
		||||
    GridParallelRNG *       get4dRng(void);
 | 
			
		||||
    // general memory management
 | 
			
		||||
    void                    addObject(const std::string name,
 | 
			
		||||
                                      const int moduleAddress = -1);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										64
									
								
								Hadrons/Utilities/HadronsXmlValidate.cc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								Hadrons/Utilities/HadronsXmlValidate.cc
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,64 @@
 | 
			
		||||
/*************************************************************************************
 | 
			
		||||
 | 
			
		||||
Grid physics library, www.github.com/paboyle/Grid 
 | 
			
		||||
 | 
			
		||||
Source file: Hadrons/Utilities/HadronsXmlValidate.cc
 | 
			
		||||
 | 
			
		||||
Copyright (C) 2015-2019
 | 
			
		||||
 | 
			
		||||
Author: Antonin Portelli <antonin.portelli@me.com>
 | 
			
		||||
 | 
			
		||||
This program is free software; you can redistribute it and/or modify
 | 
			
		||||
it under the terms of the GNU General Public License as published by
 | 
			
		||||
the Free Software Foundation; either version 2 of the License, or
 | 
			
		||||
(at your option) any later version.
 | 
			
		||||
 | 
			
		||||
This program is distributed in the hope that it will be useful,
 | 
			
		||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
GNU General Public License for more details.
 | 
			
		||||
 | 
			
		||||
You should have received a copy of the GNU General Public License along
 | 
			
		||||
with this program; if not, write to the Free Software Foundation, Inc.,
 | 
			
		||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 | 
			
		||||
 | 
			
		||||
See the full license in the file "LICENSE" in the top level distribution directory
 | 
			
		||||
*************************************************************************************/
 | 
			
		||||
/*  END LEGAL */
 | 
			
		||||
 | 
			
		||||
#include <Hadrons/Application.hpp>
 | 
			
		||||
 | 
			
		||||
using namespace Grid;
 | 
			
		||||
using namespace QCD;
 | 
			
		||||
using namespace Hadrons;
 | 
			
		||||
 | 
			
		||||
int main(int argc, char *argv[])
 | 
			
		||||
{
 | 
			
		||||
    // parse command line
 | 
			
		||||
    std::string parameterFileName;
 | 
			
		||||
    
 | 
			
		||||
    if (argc != 2)
 | 
			
		||||
    {
 | 
			
		||||
        std::cerr << "usage: " << argv[0] << " <parameter file>";
 | 
			
		||||
        std::cerr << std::endl;
 | 
			
		||||
        std::exit(EXIT_FAILURE);
 | 
			
		||||
    }
 | 
			
		||||
    parameterFileName = argv[1];
 | 
			
		||||
    
 | 
			
		||||
    try
 | 
			
		||||
    {
 | 
			
		||||
        Application application(parameterFileName);
 | 
			
		||||
        
 | 
			
		||||
        application.parseParameterFile(parameterFileName);
 | 
			
		||||
        auto &vm = VirtualMachine::getInstance();
 | 
			
		||||
        vm.getModuleGraph();
 | 
			
		||||
        LOG(Message) << "Application valid (check XML warnings though)" 
 | 
			
		||||
                     << std::endl;
 | 
			
		||||
    }
 | 
			
		||||
    catch (const std::exception& e)
 | 
			
		||||
    {
 | 
			
		||||
        Exceptions::abort(e);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    return EXIT_SUCCESS;
 | 
			
		||||
}
 | 
			
		||||
@@ -1,8 +1,11 @@
 | 
			
		||||
bin_PROGRAMS = HadronsXmlRun HadronsFermionEP64To32 HadronsContractor HadronsContractorBenchmark
 | 
			
		||||
bin_PROGRAMS = HadronsXmlRun HadronsXmlValidate HadronsFermionEP64To32 HadronsContractor HadronsContractorBenchmark
 | 
			
		||||
 | 
			
		||||
HadronsXmlRun_SOURCES = HadronsXmlRun.cc
 | 
			
		||||
HadronsXmlRun_LDADD   = ../libHadrons.a ../../Grid/libGrid.a
 | 
			
		||||
 | 
			
		||||
HadronsXmlValidate_SOURCES = HadronsXmlValidate.cc
 | 
			
		||||
HadronsXmlValidate_LDADD   = ../libHadrons.a ../../Grid/libGrid.a
 | 
			
		||||
 | 
			
		||||
HadronsFermionEP64To32_SOURCES  = EigenPackCast.cc
 | 
			
		||||
HadronsFermionEP64To32_CXXFLAGS = $(AM_CXXFLAGS) -DFIN=WilsonImplD::FermionField -DFOUT=WilsonImplF::FermionField
 | 
			
		||||
HadronsFermionEP64To32_LDADD    = ../libHadrons.a ../../Grid/libGrid.a
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user