mirror of
https://github.com/paboyle/Grid.git
synced 2025-06-13 04:37:05 +01:00
Merge branch 'develop' of https://github.com/paboyle/Grid into develop
This commit is contained in:
@ -76,7 +76,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
std::cout << GridLogMessage << "Spatial zero-mode norm 2" << std::endl;
|
||||
sliceSum(a, zm, grid.Nd() - 1);
|
||||
for (unsigned int t = 0; t < latt_size.size(); ++t)
|
||||
for (unsigned int t = 0; t < latt_size[Tp]; ++t)
|
||||
{
|
||||
std::cout << GridLogMessage << "t = " << t << " " << std::sqrt(norm2(zm[t])) << std::endl;
|
||||
}
|
||||
|
@ -1,3 +0,0 @@
|
||||
AM_LDFLAGS += -L../../Hadrons
|
||||
|
||||
include Make.inc
|
@ -1,265 +0,0 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: Tests/Hadrons/Test_QED.cc
|
||||
|
||||
Copyright (C) 2015-2018
|
||||
|
||||
Author: Antonin Portelli <antonin.portelli@me.com>
|
||||
Author: Vera Guelpers <v.m.guelpers@soton.ac.uk>
|
||||
|
||||
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>
|
||||
#include <Hadrons/Modules.hpp>
|
||||
|
||||
using namespace Grid;
|
||||
using namespace Hadrons;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// initialization //////////////////////////////////////////////////////////
|
||||
Grid_init(&argc, &argv);
|
||||
HadronsLogError.Active(GridLogError.isActive());
|
||||
HadronsLogWarning.Active(GridLogWarning.isActive());
|
||||
HadronsLogMessage.Active(GridLogMessage.isActive());
|
||||
HadronsLogIterative.Active(GridLogIterative.isActive());
|
||||
HadronsLogDebug.Active(GridLogDebug.isActive());
|
||||
LOG(Message) << "Grid initialized" << std::endl;
|
||||
|
||||
|
||||
// run setup ///////////////////////////////////////////////////////////////
|
||||
Application application;
|
||||
std::vector<std::string> flavour = {"h"}; //{"l", "s", "c1", "c2", "c3"};
|
||||
std::vector<double> mass = {.2}; //{.01, .04, .2 , .25 , .3 };
|
||||
|
||||
unsigned int nt = GridDefaultLatt()[Tp];
|
||||
|
||||
// global parameters
|
||||
Application::GlobalPar globalPar;
|
||||
globalPar.trajCounter.start = 1500;
|
||||
globalPar.trajCounter.end = 1520;
|
||||
globalPar.trajCounter.step = 20;
|
||||
globalPar.runId = "test";
|
||||
application.setPar(globalPar);
|
||||
// gauge field
|
||||
application.createModule<MGauge::Unit>("gauge");
|
||||
// pt source
|
||||
MSource::Point::Par ptPar;
|
||||
ptPar.position = "0 0 0 0";
|
||||
application.createModule<MSource::Point>("pt", ptPar);
|
||||
// sink
|
||||
MSink::Point::Par sinkPar;
|
||||
sinkPar.mom = "0 0 0";
|
||||
application.createModule<MSink::ScalarPoint>("sink", sinkPar);
|
||||
|
||||
// set fermion boundary conditions to be periodic space, antiperiodic time.
|
||||
std::string boundary = "1 1 1 -1";
|
||||
std::string twist = "0. 0. 0. 0.";
|
||||
|
||||
//stochastic photon field
|
||||
MGauge::StochEm::Par photonPar;
|
||||
photonPar.gauge = PhotonR::Gauge::feynman;
|
||||
photonPar.zmScheme = PhotonR::ZmScheme::qedL;
|
||||
application.createModule<MGauge::StochEm>("ph_field", photonPar);
|
||||
|
||||
|
||||
|
||||
for (unsigned int i = 0; i < flavour.size(); ++i)
|
||||
{
|
||||
// actions
|
||||
MAction::DWF::Par actionPar;
|
||||
actionPar.gauge = "gauge";
|
||||
actionPar.Ls = 8;
|
||||
actionPar.M5 = 1.8;
|
||||
actionPar.mass = mass[i];
|
||||
actionPar.boundary = boundary;
|
||||
actionPar.twist = "0. 0. 0. 0.";
|
||||
application.createModule<MAction::DWF>("DWF_" + flavour[i], actionPar);
|
||||
|
||||
|
||||
// solvers
|
||||
MSolver::RBPrecCG::Par solverPar;
|
||||
solverPar.action = "DWF_" + flavour[i];
|
||||
solverPar.residual = 1.0e-8;
|
||||
solverPar.maxIteration = 10000;
|
||||
application.createModule<MSolver::RBPrecCG>("CG_" + flavour[i],
|
||||
solverPar);
|
||||
|
||||
// propagators
|
||||
MFermion::GaugeProp::Par quarkPar;
|
||||
quarkPar.solver = "CG_" + flavour[i];
|
||||
quarkPar.source = "pt";
|
||||
application.createModule<MFermion::GaugeProp>("Qpt_" + flavour[i],
|
||||
quarkPar);
|
||||
|
||||
|
||||
//seq sources with tadpole insertion
|
||||
MSource::SeqConserved::Par seqPar_T;
|
||||
seqPar_T.q = "Qpt_" + flavour[i] + "_5d";
|
||||
seqPar_T.action = "DWF_" + flavour[i];
|
||||
seqPar_T.tA = 0;
|
||||
seqPar_T.tB = nt-1;
|
||||
seqPar_T.curr_type = Current::Tadpole;
|
||||
seqPar_T.mu_min = 0;
|
||||
seqPar_T.mu_max = 3;
|
||||
seqPar_T.mom = "0. 0. 0. 0.";
|
||||
application.createModule<MSource::SeqConserved>("Qpt_" + flavour[i]
|
||||
+ "_seq_T", seqPar_T);
|
||||
// seq propagator with tadpole insertion
|
||||
MFermion::GaugeProp::Par quarkPar_seq_T;
|
||||
quarkPar_seq_T.solver = "CG_" + flavour[i];
|
||||
quarkPar_seq_T.source = "Qpt_" + flavour[i] + "_seq_T";
|
||||
application.createModule<MFermion::GaugeProp>("Qpt_" + flavour[i]
|
||||
+ "_seq_T" + flavour[i],
|
||||
quarkPar_seq_T);
|
||||
|
||||
|
||||
|
||||
//seq sources with conserved vector and photon insertion
|
||||
MSource::SeqConserved::Par seqPar_V;
|
||||
seqPar_V.q = "Qpt_" + flavour[i] + "_5d";
|
||||
seqPar_V.action = "DWF_" + flavour[i];
|
||||
seqPar_V.tA = 0;
|
||||
seqPar_V.tB = nt-1;
|
||||
seqPar_V.curr_type = Current::Vector;
|
||||
seqPar_V.mu_min = 0;
|
||||
seqPar_V.mu_max = 3;
|
||||
seqPar_V.mom = "0. 0. 0. 0.";
|
||||
seqPar_V.photon = "ph_field";
|
||||
application.createModule<MSource::SeqConserved>("Qpt_" + flavour[i]
|
||||
+ "_seq_V_ph", seqPar_V);
|
||||
// seq propagator with conserved vector and photon insertion
|
||||
MFermion::GaugeProp::Par quarkPar_seq_V;
|
||||
quarkPar_seq_V.solver = "CG_" + flavour[i];
|
||||
quarkPar_seq_V.source = "Qpt_" + flavour[i] + "_seq_V_ph";
|
||||
application.createModule<MFermion::GaugeProp>("Qpt_" + flavour[i]
|
||||
+ "_seq_V_ph_" + flavour[i],
|
||||
quarkPar_seq_V);
|
||||
|
||||
|
||||
|
||||
//double seq sources with conserved vector and photon insertion
|
||||
//(for self energy)
|
||||
MSource::SeqConserved::Par seqPar_VV;
|
||||
seqPar_VV.q = "Qpt_" + flavour[i] + "_seq_V_ph_"
|
||||
+ flavour[i] + "_5d";
|
||||
seqPar_VV.action = "DWF_" + flavour[i];
|
||||
seqPar_VV.tA = 0;
|
||||
seqPar_VV.tB = nt-1;
|
||||
seqPar_VV.curr_type = Current::Vector;
|
||||
seqPar_VV.mu_min = 0;
|
||||
seqPar_VV.mu_max = 3;
|
||||
seqPar_VV.mom = "0. 0. 0. 0.";
|
||||
seqPar_VV.photon = "ph_field";
|
||||
application.createModule<MSource::SeqConserved>("Qpt_" + flavour[i]
|
||||
+ "_seq_V_ph" + flavour[i]
|
||||
+ "_seq_V_ph", seqPar_VV);
|
||||
//double seq propagator with conserved vector and photon insertion
|
||||
MFermion::GaugeProp::Par quarkPar_seq_VV;
|
||||
quarkPar_seq_VV.solver = "CG_" + flavour[i];
|
||||
quarkPar_seq_VV.source = "Qpt_" + flavour[i] + "_seq_V_ph"
|
||||
+ flavour[i] + "_seq_V_ph";
|
||||
application.createModule<MFermion::GaugeProp>("Qpt_" + flavour[i]
|
||||
+ "_seq_V_ph_" + flavour[i]
|
||||
+ "_seq_V_ph_" + flavour[i],
|
||||
quarkPar_seq_VV);
|
||||
|
||||
|
||||
|
||||
}
|
||||
for (unsigned int i = 0; i < flavour.size(); ++i)
|
||||
for (unsigned int j = i; j < flavour.size(); ++j)
|
||||
{
|
||||
//2pt function contraction
|
||||
MContraction::Meson::Par mesPar;
|
||||
mesPar.output = "QED/pt_" + flavour[i] + flavour[j];
|
||||
mesPar.q1 = "Qpt_" + flavour[i];
|
||||
mesPar.q2 = "Qpt_" + flavour[j];
|
||||
mesPar.gammas = "(Gamma5 Gamma5)";
|
||||
mesPar.sink = "sink";
|
||||
application.createModule<MContraction::Meson>("meson_pt_"
|
||||
+ flavour[i] + flavour[j],
|
||||
mesPar);
|
||||
|
||||
|
||||
|
||||
//tadpole contraction
|
||||
MContraction::Meson::Par mesPar_seq_T;
|
||||
mesPar_seq_T.output = "QED/tadpole_pt_" + flavour[i] + "_T_"
|
||||
+ flavour[i] + "__" + flavour[j];
|
||||
mesPar_seq_T.q1 = "Qpt_" + flavour[i] + "_seq_T" + flavour[i];
|
||||
mesPar_seq_T.q2 = "Qpt_" + flavour[j];
|
||||
mesPar_seq_T.gammas = "(Gamma5 Gamma5)";
|
||||
mesPar_seq_T.sink = "sink";
|
||||
application.createModule<MContraction::Meson>("meson_tadpole_pt_" +
|
||||
flavour[i] + "_seq_T"
|
||||
+ flavour[i] + flavour[j],
|
||||
mesPar_seq_T);
|
||||
|
||||
|
||||
|
||||
//photon exchange contraction
|
||||
MContraction::Meson::Par mesPar_seq_E;
|
||||
mesPar_seq_E.output = "QED/exchange_pt_" + flavour[i] + "_V_ph_"
|
||||
+ flavour[i] + "__" + flavour[j] + "_V_ph_"
|
||||
+ flavour[j];
|
||||
mesPar_seq_E.q1 = "Qpt_" + flavour[i] + "_seq_V_ph_" + flavour[i];
|
||||
mesPar_seq_E.q2 = "Qpt_" + flavour[j] + "_seq_V_ph_" + flavour[j];
|
||||
mesPar_seq_E.gammas = "(Gamma5 Gamma5)";
|
||||
mesPar_seq_E.sink = "sink";
|
||||
application.createModule<MContraction::Meson>("meson_exchange_pt_"
|
||||
+ flavour[i] + "_seq_V_ph_" + flavour[i]
|
||||
+ flavour[j] + "_seq_V_ph_" + flavour[j],
|
||||
mesPar_seq_E);
|
||||
|
||||
|
||||
|
||||
//self energy contraction
|
||||
MContraction::Meson::Par mesPar_seq_S;
|
||||
mesPar_seq_S.output = "QED/selfenergy_pt_" + flavour[i] + "_V_ph_"
|
||||
+ flavour[i] + "_V_ph_" + flavour[i] + "__"
|
||||
+ flavour[j];
|
||||
mesPar_seq_S.q1 = "Qpt_" + flavour[i] + "_seq_V_ph_" + flavour[i]
|
||||
+ "_seq_V_ph_" + flavour[i];
|
||||
mesPar_seq_S.q2 = "Qpt_" + flavour[j];
|
||||
mesPar_seq_S.gammas = "(Gamma5 Gamma5)";
|
||||
mesPar_seq_S.sink = "sink";
|
||||
application.createModule<MContraction::Meson>("meson_selfenergy_pt_"
|
||||
+ flavour[i] + "_seq_V_ph_"
|
||||
+ flavour[i] + "_seq_V_ph_"
|
||||
+ flavour[i] + flavour[j],
|
||||
mesPar_seq_S);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// execution
|
||||
application.saveParameterFile("QED.xml");
|
||||
application.run();
|
||||
|
||||
// epilogue
|
||||
LOG(Message) << "Grid is finalizing now" << std::endl;
|
||||
Grid_finalize();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
@ -1,113 +0,0 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: Tests/Hadrons/Test_diskvector.cc
|
||||
|
||||
Copyright (C) 2015-2018
|
||||
|
||||
|
||||
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 */
|
||||
#define DV_DEBUG
|
||||
#include <Hadrons/DiskVector.hpp>
|
||||
|
||||
using namespace Grid;
|
||||
using namespace Grid::Hadrons;
|
||||
|
||||
GRID_SERIALIZABLE_ENUM(Enum, undef, red, 1, blue, 2, green, 3);
|
||||
|
||||
class Object: Serializable {
|
||||
public:
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(Object,
|
||||
Enum, e,
|
||||
SpinColourMatrix, scm);
|
||||
};
|
||||
|
||||
#ifdef HAVE_HDF5
|
||||
typedef Hdf5Reader TestReader;
|
||||
typedef Hdf5Writer TestWriter;
|
||||
#else
|
||||
typedef BinaryReader TestReader;
|
||||
typedef BinaryWriter TestWriter;
|
||||
#endif
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Grid_init(&argc, &argv);
|
||||
|
||||
GridSerialRNG rng;
|
||||
Object obj, v2w, v2r, v13w, v13r;
|
||||
|
||||
SerializableDiskVector<Object, TestReader, TestWriter> v("diskvector_test", 1000, 4);
|
||||
|
||||
obj.e = Enum::red;
|
||||
random(rng, obj.scm);
|
||||
v[32] = obj;
|
||||
random(rng, obj.scm);
|
||||
v[2] = obj;
|
||||
v2w = obj;
|
||||
random(rng, obj.scm);
|
||||
v[6] = obj;
|
||||
random(rng, obj.scm);
|
||||
v[7] = obj;
|
||||
random(rng, obj.scm);
|
||||
v[8] = obj;
|
||||
random(rng, obj.scm);
|
||||
v[9] = obj;
|
||||
random(rng, obj.scm);
|
||||
v[10] = obj;
|
||||
random(rng, obj.scm);
|
||||
v[11] = obj;
|
||||
random(rng, obj.scm);
|
||||
v[12] = obj;
|
||||
random(rng, obj.scm);
|
||||
v[13] = obj;
|
||||
v13w = obj;
|
||||
random(rng, obj.scm);
|
||||
v[14] = obj;
|
||||
random(rng, obj.scm);
|
||||
v[15] = obj;
|
||||
|
||||
v2r = v[2];
|
||||
LOG(Message) << "v[2] correct? "
|
||||
<< ((v2r == v2w) ? "yes" : "no" ) << std::endl;
|
||||
v13r = v[13];
|
||||
LOG(Message) << "v[13] correct? "
|
||||
<< ((v13r == v13w) ? "yes" : "no" ) << std::endl;
|
||||
LOG(Message) << "hit ratio " << v.hitRatio() << std::endl;
|
||||
|
||||
EigenDiskVector<ComplexD> w("eigendiskvector_test", 1000, 4);
|
||||
EigenDiskVector<ComplexD>::Matrix m,n;
|
||||
|
||||
w[2] = EigenDiskVectorMat<ComplexD>::Random(2000, 2000);
|
||||
m = w[2];
|
||||
w[3] = EigenDiskVectorMat<ComplexD>::Random(2000, 2000);
|
||||
w[4] = EigenDiskVectorMat<ComplexD>::Random(2000, 2000);
|
||||
w[5] = EigenDiskVectorMat<ComplexD>::Random(2000, 2000);
|
||||
w[6] = EigenDiskVectorMat<ComplexD>::Random(2000, 2000);
|
||||
w[7] = EigenDiskVectorMat<ComplexD>::Random(2000, 2000);
|
||||
n = w[2];
|
||||
LOG(Message) << "w[2] correct? "
|
||||
<< ((m == n) ? "yes" : "no" ) << std::endl;
|
||||
LOG(Message) << "hit ratio " << w.hitRatio() << std::endl;
|
||||
|
||||
Grid_finalize();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
@ -1,382 +0,0 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: Tests/Hadrons/Test_hadrons_distil.cc
|
||||
|
||||
Copyright (C) 2015-2019
|
||||
|
||||
Author: Felix Erben <ferben@ed.ac.uk>
|
||||
Author: Michael Marshall <Michael.Marshall@ed.ac.uk>
|
||||
|
||||
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 <typeinfo>
|
||||
#include <Hadrons/Application.hpp>
|
||||
#include <Hadrons/Modules.hpp>
|
||||
|
||||
using namespace Grid;
|
||||
using namespace Hadrons;
|
||||
|
||||
// Very simple iterators for Eigen tensors
|
||||
// The only way I could get these iterators to work is to put the begin() and end() functions in the Eigen namespace
|
||||
// So if Eigen ever defines these, we'll have a conflict and have to change this
|
||||
namespace Eigen {
|
||||
template <typename ET>
|
||||
inline typename std::enable_if<EigenIO::is_tensor<ET>::value, typename EigenIO::Traits<ET>::scalar_type *>::type
|
||||
begin( ET & et ) { return reinterpret_cast<typename Grid::EigenIO::Traits<ET>::scalar_type *>(et.data()); }
|
||||
template <typename ET>
|
||||
inline typename std::enable_if<EigenIO::is_tensor<ET>::value, typename EigenIO::Traits<ET>::scalar_type *>::type
|
||||
end( ET & et ) { return begin(et) + et.size() * EigenIO::Traits<ET>::count; }
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// Test creation of laplacian eigenvectors
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
void test_Global(Application &application)
|
||||
{
|
||||
// global parameters
|
||||
Application::GlobalPar globalPar;
|
||||
globalPar.trajCounter.start = 1100;
|
||||
globalPar.trajCounter.end = 1120;
|
||||
globalPar.trajCounter.step = 20;
|
||||
globalPar.runId = "test";
|
||||
globalPar.graphFile = "";
|
||||
globalPar.scheduleFile = "";
|
||||
globalPar.saveSchedule = "false";
|
||||
globalPar.parallelWriteMaxRetry = -1;
|
||||
application.setPar(globalPar);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// Create a random gauge with the correct name
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
std::string test_Gauge(Application &application )
|
||||
{
|
||||
std::string sGaugeName{ "gauge" };
|
||||
application.createModule<MGauge::Random>( sGaugeName );
|
||||
return sGaugeName;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// Test creation of laplacian eigenvectors
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
void test_LapEvec(Application &application)
|
||||
{
|
||||
const char szModuleName[] = "LapEvec";
|
||||
test_Gauge( application );
|
||||
MDistil::LapEvecPar p;
|
||||
p.gauge = "gauge";
|
||||
p.Stout.steps = 3;
|
||||
p.Stout.rho = 0.2;
|
||||
p.Cheby.PolyOrder = 11;
|
||||
p.Cheby.alpha = 0.55;
|
||||
p.Cheby.beta = 35.5;
|
||||
p.Lanczos.Nvec = 5;
|
||||
p.Lanczos.Nk = 6;
|
||||
p.Lanczos.Np = 2;
|
||||
p.Lanczos.MaxIt = 1000;
|
||||
p.Lanczos.resid = 1e-2;
|
||||
p.Lanczos.IRLLog = 0;
|
||||
application.createModule<MDistil::LapEvec>(szModuleName,p);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// Test creation Solver
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
std::string SolverName( const char * pSuffix = nullptr ) {
|
||||
std::string sSolverName{ "CG" };
|
||||
if( pSuffix && pSuffix[0] ) {
|
||||
sSolverName.append( "_" );
|
||||
sSolverName.append( pSuffix );
|
||||
}
|
||||
return sSolverName;
|
||||
}
|
||||
|
||||
std::string test_Solver(Application &application, const char * pSuffix = nullptr )
|
||||
{
|
||||
std::string sActionName{ "DWF" };
|
||||
if( pSuffix && pSuffix[0] ) {
|
||||
sActionName.append( "_" );
|
||||
sActionName.append( pSuffix );
|
||||
}
|
||||
MAction::DWF::Par actionPar;
|
||||
actionPar.gauge = "gauge";
|
||||
actionPar.Ls = 16;
|
||||
actionPar.M5 = 1.8;
|
||||
actionPar.mass = 0.005;
|
||||
actionPar.boundary = "1 1 1 -1";
|
||||
actionPar.twist = "0. 0. 0. 0.";
|
||||
application.createModule<MAction::DWF>( sActionName, actionPar );
|
||||
MSolver::RBPrecCG::Par solverPar;
|
||||
solverPar.action = sActionName;
|
||||
solverPar.residual = 1.0e-2;
|
||||
solverPar.maxIteration = 10000;
|
||||
std::string sSolverName{ SolverName( pSuffix ) };
|
||||
application.createModule<MSolver::RBPrecCG>( sSolverName, solverPar );
|
||||
return sSolverName;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// DistilParameters
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
std::string test_DPar(Application &application) {
|
||||
MDistil::DistilParameters DPar;
|
||||
DPar.nvec = 5;
|
||||
DPar.nnoise = 1;
|
||||
DPar.tsrc = 0;
|
||||
DPar.LI = 5;
|
||||
DPar.TI = 8;
|
||||
DPar.SI = 4;
|
||||
std::string sDParName{"DPar_l"};
|
||||
application.createModule<MDistil::DistilPar>(sDParName,DPar);
|
||||
return sDParName;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////
|
||||
// Noises
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
std::string test_Noises(Application &application, const std::string &sNoiseBaseName ) {
|
||||
MDistil::NoisesPar NoisePar;
|
||||
NoisePar.DistilParams = "DPar_l";
|
||||
NoisePar.NoiseFileName = "noise";
|
||||
std::string sNoiseName{"noise"};
|
||||
application.createModule<MDistil::Noises>(sNoiseName,NoisePar);
|
||||
return sNoiseName;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// Perambulators
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
std::string PerambulatorName( const char * pszSuffix = nullptr )
|
||||
{
|
||||
std::string sPerambulatorName{ "Peramb" };
|
||||
if( pszSuffix && pszSuffix[0] )
|
||||
sPerambulatorName.append( pszSuffix );
|
||||
return sPerambulatorName;
|
||||
}
|
||||
|
||||
void test_LoadPerambulators( Application &application, const char * pszSuffix = nullptr )
|
||||
{
|
||||
std::string sModuleName{ "Peramb_load" };
|
||||
MIO::LoadPerambulator::Par PerambPar;
|
||||
PerambPar.PerambFileName = "Peramb";
|
||||
PerambPar.DistilParams = "DPar_l";
|
||||
test_Noises(application, sModuleName); // I want these written after solver stuff
|
||||
application.createModule<MIO::LoadPerambulator>( sModuleName, PerambPar );
|
||||
}
|
||||
|
||||
void test_Perambulators( Application &application, const char * pszSuffix = nullptr )
|
||||
{
|
||||
std::string sModuleName{ PerambulatorName( pszSuffix ) };
|
||||
// Perambulator parameters
|
||||
MDistil::Perambulator::Par PerambPar;
|
||||
PerambPar.lapevec = "LapEvec";
|
||||
PerambPar.PerambFileName = sModuleName;
|
||||
PerambPar.solver = test_Solver( application, pszSuffix );
|
||||
PerambPar.DistilParams = "DPar_l";
|
||||
PerambPar.noise = "noise";
|
||||
test_Noises(application, sModuleName); // I want these written after solver stuff
|
||||
application.createModule<MDistil::Perambulator>( sModuleName, PerambPar );
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// DistilVectors
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
void test_DistilVectors(Application &application, const char * pszSuffix = nullptr, const char * pszNvec = nullptr )
|
||||
{
|
||||
std::string sModuleName{"DistilVecs"};
|
||||
if( pszSuffix )
|
||||
sModuleName.append( pszSuffix );
|
||||
std::string sPerambName{"Peramb"};
|
||||
if( pszSuffix )
|
||||
sPerambName.append( pszSuffix );
|
||||
MDistil::DistilVectors::Par DistilVecPar;
|
||||
DistilVecPar.noise = "noise";
|
||||
DistilVecPar.rho = "rho";
|
||||
DistilVecPar.phi = "phi";
|
||||
DistilVecPar.perambulator = sPerambName;
|
||||
DistilVecPar.lapevec = "LapEvec";
|
||||
DistilVecPar.DistilParams = "DPar_l";
|
||||
application.createModule<MDistil::DistilVectors>(sModuleName,DistilVecPar);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// MesonSink
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
void test_MesonSink(Application &application)
|
||||
{
|
||||
// DistilVectors parameters
|
||||
MContraction::A2AMesonField::Par A2AMesonFieldPar;
|
||||
//A2AMesonFieldPar.left="Peramb_unsmeared_sink";
|
||||
A2AMesonFieldPar.left="g5phi";
|
||||
A2AMesonFieldPar.right="Peramb_unsmeared_sink";
|
||||
A2AMesonFieldPar.output="DistilFields";
|
||||
A2AMesonFieldPar.gammas="Identity";
|
||||
A2AMesonFieldPar.mom={"0 0 0"};
|
||||
A2AMesonFieldPar.cacheBlock=2;
|
||||
A2AMesonFieldPar.block=4;
|
||||
application.createModule<MContraction::A2AMesonField>("DistilMesonSink",A2AMesonFieldPar);
|
||||
}
|
||||
/////////////////////////////////////////////////////////////
|
||||
// MesonFields
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
void test_MesonField(Application &application, const char * pszFileSuffix,
|
||||
const char * pszObjectLeft = nullptr, const char * pszObjectRight = nullptr )
|
||||
{
|
||||
// DistilVectors parameters
|
||||
if( pszObjectLeft == nullptr )
|
||||
pszObjectLeft = pszFileSuffix;
|
||||
if( pszObjectRight == nullptr )
|
||||
pszObjectRight = pszObjectLeft;
|
||||
MContraction::A2AMesonField::Par A2AMesonFieldPar;
|
||||
A2AMesonFieldPar.left="";
|
||||
A2AMesonFieldPar.right=A2AMesonFieldPar.left;
|
||||
A2AMesonFieldPar.left.append( pszObjectLeft );
|
||||
A2AMesonFieldPar.right.append( pszObjectRight );
|
||||
A2AMesonFieldPar.output="MesonSinks";
|
||||
A2AMesonFieldPar.output.append( pszFileSuffix );
|
||||
A2AMesonFieldPar.gammas="Identity";
|
||||
A2AMesonFieldPar.mom={"0 0 0"};
|
||||
A2AMesonFieldPar.cacheBlock=2;
|
||||
A2AMesonFieldPar.block=4;
|
||||
std::string sObjectName{"DistilMesonField"};
|
||||
sObjectName.append( pszFileSuffix );
|
||||
application.createModule<MContraction::A2AMesonField>(sObjectName, A2AMesonFieldPar);
|
||||
}
|
||||
|
||||
bool bNumber( int &ri, const char * & pstr, bool bGobbleWhiteSpace = true )
|
||||
{
|
||||
if( bGobbleWhiteSpace )
|
||||
while( std::isspace(static_cast<unsigned char>(*pstr)) )
|
||||
pstr++;
|
||||
const char * p = pstr;
|
||||
bool bMinus = false;
|
||||
char c = * p++;
|
||||
if( c == '+' )
|
||||
c = * p++;
|
||||
else if( c == '-' ) {
|
||||
bMinus = true;
|
||||
c = * p++;
|
||||
}
|
||||
int n = c - '0';
|
||||
if( n < 0 || n > 9 )
|
||||
return false;
|
||||
while( * p >= '0' && * p <= '9' ) {
|
||||
n = n * 10 + ( * p ) - '0';
|
||||
p++;
|
||||
}
|
||||
if( bMinus )
|
||||
n *= -1;
|
||||
ri = n;
|
||||
pstr = p;
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// Decode command-line parameters. 1st one is which test to run
|
||||
int iTestNum = -1;
|
||||
|
||||
for(int i = 1 ; i < argc ; i++ ) {
|
||||
std::cout << "argv[" << i << "]=\"" << argv[i] << "\"" << std::endl;
|
||||
const char * p = argv[i];
|
||||
if( * p == '/' || * p == '-' ) {
|
||||
p++;
|
||||
char c = * p++;
|
||||
switch(toupper(c)) {
|
||||
case 'T':
|
||||
if( bNumber( iTestNum, p ) ) {
|
||||
std::cout << "Test " << iTestNum << " requested";
|
||||
if( * p )
|
||||
std::cout << " (ignoring trailer \"" << p << "\")";
|
||||
std::cout << std::endl;
|
||||
}
|
||||
else
|
||||
std::cout << "Invalid test \"" << &argv[i][2] << "\"" << std::endl;
|
||||
break;
|
||||
default:
|
||||
std::cout << "Ignoring switch \"" << &argv[i][1] << "\"" << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// initialization //////////////////////////////////////////////////////////
|
||||
Grid_init(&argc, &argv);
|
||||
HadronsLogError.Active(GridLogError.isActive());
|
||||
HadronsLogWarning.Active(GridLogWarning.isActive());
|
||||
HadronsLogMessage.Active(GridLogMessage.isActive());
|
||||
HadronsLogIterative.Active(GridLogIterative.isActive());
|
||||
HadronsLogDebug.Active(GridLogDebug.isActive());
|
||||
LOG(Message) << "Grid initialized" << std::endl;
|
||||
|
||||
// run setup ///////////////////////////////////////////////////////////////
|
||||
Application application;
|
||||
|
||||
// For now perform free propagator test - replace this with distillation test(s)
|
||||
LOG(Message) << "====== Creating xml for test " << iTestNum << " ======" << std::endl;
|
||||
|
||||
switch(iTestNum) {
|
||||
default: // 0
|
||||
LOG(Message) << "Computing Meson 2pt-function" << std::endl;
|
||||
test_Global( application );
|
||||
test_LapEvec( application );
|
||||
test_DPar( application );
|
||||
test_Perambulators( application );
|
||||
test_DistilVectors( application );
|
||||
test_MesonField( application, "Phi", "phi" );
|
||||
test_MesonField( application, "Rho", "rho" );
|
||||
break;
|
||||
case 1:
|
||||
LOG(Message) << "Computing Meson 2pt-function by loading perambulators" << std::endl;
|
||||
test_Global( application );
|
||||
test_LapEvec( application );
|
||||
test_DPar( application );
|
||||
test_LoadPerambulators( application );
|
||||
test_DistilVectors( application, "_load" );
|
||||
test_MesonField( application, "Phi", "phi" );
|
||||
test_MesonField( application, "Rho", "rho" );
|
||||
break;
|
||||
}
|
||||
// execution
|
||||
static const char XmlFileName[] = "test_distil.xml";
|
||||
application.saveParameterFile( XmlFileName );
|
||||
|
||||
const Grid::Coordinate &lat{GridDefaultLatt()};
|
||||
if( lat.size() == 4 && lat[0] == 4 && lat[1] == 4 && lat[2] == 4 && lat[3] == 8 )
|
||||
application.run();
|
||||
else
|
||||
LOG(Warning) << "The parameters in " << XmlFileName << " are designed to run on a laptop usid --grid 4.4.4.8" << std::endl;
|
||||
|
||||
// epilogue
|
||||
LOG(Message) << "Grid is finalizing now" << std::endl;
|
||||
Grid_finalize();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
@ -1,246 +0,0 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: Tests/Hadrons/Test_free_prop.cc
|
||||
|
||||
Copyright (C) 2015-2018
|
||||
|
||||
Author: Antonin Portelli <antonin.portelli@me.com>
|
||||
Author: Vera Guelpers <v.m.guelpers@soton.ac.uk>
|
||||
|
||||
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>
|
||||
#include <Hadrons/Modules.hpp>
|
||||
|
||||
using namespace Grid;
|
||||
using namespace Hadrons;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// initialization //////////////////////////////////////////////////////////
|
||||
Grid_init(&argc, &argv);
|
||||
HadronsLogError.Active(GridLogError.isActive());
|
||||
HadronsLogWarning.Active(GridLogWarning.isActive());
|
||||
HadronsLogMessage.Active(GridLogMessage.isActive());
|
||||
HadronsLogIterative.Active(GridLogIterative.isActive());
|
||||
HadronsLogDebug.Active(GridLogDebug.isActive());
|
||||
LOG(Message) << "Grid initialized" << std::endl;
|
||||
|
||||
|
||||
// run setup ///////////////////////////////////////////////////////////////
|
||||
Application application;
|
||||
std::vector<std::string> flavour = {"h"}; //{"l", "s", "c1", "c2", "c3"};
|
||||
std::vector<double> mass = {.2}; //{.01, .04, .2 , .25 , .3 };
|
||||
std::vector<std::string> lepton_flavour = {"mu"};
|
||||
std::vector<double> lepton_mass = {.2};
|
||||
|
||||
unsigned int nt = GridDefaultLatt()[Tp];
|
||||
|
||||
// global parameters
|
||||
Application::GlobalPar globalPar;
|
||||
globalPar.trajCounter.start = 1500;
|
||||
globalPar.trajCounter.end = 1520;
|
||||
globalPar.trajCounter.step = 20;
|
||||
globalPar.runId = "test";
|
||||
application.setPar(globalPar);
|
||||
// gauge field
|
||||
application.createModule<MGauge::Unit>("gauge");
|
||||
// unit gauge field for lepton
|
||||
application.createModule<MGauge::Unit>("free_gauge");
|
||||
// pt source
|
||||
MSource::Point::Par ptPar;
|
||||
ptPar.position = "0 0 0 0";
|
||||
application.createModule<MSource::Point>("pt", ptPar);
|
||||
// sink
|
||||
MSink::Point::Par sinkPar;
|
||||
sinkPar.mom = "0 0 0";
|
||||
application.createModule<MSink::ScalarPoint>("sink", sinkPar);
|
||||
|
||||
// set fermion boundary conditions to be periodic space, antiperiodic time.
|
||||
std::string boundary = "1 1 1 -1";
|
||||
|
||||
|
||||
//Propagators from FFT and Feynman rules
|
||||
for (unsigned int i = 0; i < lepton_mass.size(); ++i)
|
||||
{
|
||||
//DWF actions
|
||||
MAction::DWF::Par actionPar_lep;
|
||||
actionPar_lep.gauge = "free_gauge";
|
||||
actionPar_lep.Ls = 8;
|
||||
actionPar_lep.M5 = 1.8;
|
||||
actionPar_lep.mass = lepton_mass[i];
|
||||
actionPar_lep.boundary = boundary;
|
||||
application.createModule<MAction::DWF>("free_DWF_" + lepton_flavour[i], actionPar_lep);
|
||||
|
||||
//DWF free propagators
|
||||
MFermion::FreeProp::Par freePar;
|
||||
freePar.source = "pt";
|
||||
freePar.action = "free_DWF_" + lepton_flavour[i];
|
||||
freePar.twist = "0 0 0 0.5";
|
||||
freePar.mass = lepton_mass[i];
|
||||
application.createModule<MFermion::FreeProp>("Lpt_" + lepton_flavour[i],
|
||||
freePar);
|
||||
|
||||
//Wilson actions
|
||||
MAction::Wilson::Par actionPar_lep_W;
|
||||
actionPar_lep_W.gauge = "free_gauge";
|
||||
actionPar_lep_W.mass = lepton_mass[i];
|
||||
actionPar_lep_W.boundary = boundary;
|
||||
application.createModule<MAction::Wilson>("free_W_" + lepton_flavour[i], actionPar_lep_W);
|
||||
|
||||
//Wilson free propagators
|
||||
MFermion::FreeProp::Par freePar_W;
|
||||
freePar_W.source = "pt";
|
||||
freePar_W.action = "free_W_" + lepton_flavour[i];
|
||||
freePar_W.twist = "0 0 0 0.5";
|
||||
freePar_W.mass = lepton_mass[i];
|
||||
application.createModule<MFermion::FreeProp>("W_Lpt_" + lepton_flavour[i],
|
||||
freePar_W);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Propagators from inversion
|
||||
for (unsigned int i = 0; i < flavour.size(); ++i)
|
||||
{
|
||||
//DWF actions
|
||||
MAction::DWF::Par actionPar;
|
||||
actionPar.gauge = "gauge";
|
||||
actionPar.Ls = 8;
|
||||
actionPar.M5 = 1.8;
|
||||
actionPar.mass = mass[i];
|
||||
actionPar.boundary = boundary;
|
||||
application.createModule<MAction::DWF>("DWF_" + flavour[i], actionPar);
|
||||
|
||||
// solvers
|
||||
MSolver::RBPrecCG::Par solverPar;
|
||||
solverPar.action = "DWF_" + flavour[i];
|
||||
solverPar.residual = 1.0e-8;
|
||||
solverPar.maxIteration = 10000;
|
||||
application.createModule<MSolver::RBPrecCG>("CG_" + flavour[i],
|
||||
solverPar);
|
||||
|
||||
//DWF propagators
|
||||
MFermion::GaugeProp::Par quarkPar;
|
||||
quarkPar.solver = "CG_" + flavour[i];
|
||||
quarkPar.source = "pt";
|
||||
application.createModule<MFermion::GaugeProp>("Qpt_" + flavour[i],
|
||||
quarkPar);
|
||||
|
||||
|
||||
|
||||
//Wilson actions
|
||||
MAction::Wilson::Par actionPar_W;
|
||||
actionPar_W.gauge = "gauge";
|
||||
actionPar_W.mass = mass[i];
|
||||
actionPar_W.boundary = boundary;
|
||||
application.createModule<MAction::Wilson>("W_" + flavour[i], actionPar_W);
|
||||
|
||||
|
||||
// solvers
|
||||
MSolver::RBPrecCG::Par solverPar_W;
|
||||
solverPar_W.action = "W_" + flavour[i];
|
||||
solverPar_W.residual = 1.0e-8;
|
||||
solverPar_W.maxIteration = 10000;
|
||||
application.createModule<MSolver::RBPrecCG>("W_CG_" + flavour[i],
|
||||
solverPar_W);
|
||||
|
||||
//Wilson propagators
|
||||
MFermion::GaugeProp::Par quarkPar_W;
|
||||
quarkPar_W.solver = "W_CG_" + flavour[i];
|
||||
quarkPar_W.source = "pt";
|
||||
application.createModule<MFermion::GaugeProp>("W_Qpt_" + flavour[i],
|
||||
quarkPar_W);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//2pt contraction for Propagators from FFT and Feynman rules
|
||||
for (unsigned int i = 0; i < lepton_flavour.size(); ++i)
|
||||
for (unsigned int j = i; j < lepton_flavour.size(); ++j)
|
||||
{
|
||||
//2pt function contraction DWF
|
||||
MContraction::Meson::Par freemesPar;
|
||||
freemesPar.output = "2pt_free/DWF_L_pt_" + lepton_flavour[i] + lepton_flavour[j];
|
||||
freemesPar.q1 = "Lpt_" + lepton_flavour[i];
|
||||
freemesPar.q2 = "Lpt_" + lepton_flavour[j];
|
||||
freemesPar.gammas = "(Gamma5 Gamma5)";
|
||||
freemesPar.sink = "sink";
|
||||
application.createModule<MContraction::Meson>("meson_L_pt_"
|
||||
+ lepton_flavour[i] + lepton_flavour[j],
|
||||
freemesPar);
|
||||
|
||||
//2pt function contraction Wilson
|
||||
MContraction::Meson::Par freemesPar_W;
|
||||
freemesPar_W.output = "2pt_free/W_L_pt_" + lepton_flavour[i] + lepton_flavour[j];
|
||||
freemesPar_W.q1 = "W_Lpt_" + lepton_flavour[i];
|
||||
freemesPar_W.q2 = "W_Lpt_" + lepton_flavour[j];
|
||||
freemesPar_W.gammas = "(Gamma5 Gamma5)";
|
||||
freemesPar_W.sink = "sink";
|
||||
application.createModule<MContraction::Meson>("W_meson_L_pt_"
|
||||
+ lepton_flavour[i] + lepton_flavour[j],
|
||||
freemesPar_W);
|
||||
|
||||
}
|
||||
|
||||
//2pt contraction for Propagators from inverion
|
||||
for (unsigned int i = 0; i < flavour.size(); ++i)
|
||||
for (unsigned int j = i; j < flavour.size(); ++j)
|
||||
{
|
||||
//2pt function contraction DWF
|
||||
MContraction::Meson::Par mesPar;
|
||||
mesPar.output = "2pt_free/DWF_pt_" + flavour[i] + flavour[j];
|
||||
mesPar.q1 = "Qpt_" + flavour[i];
|
||||
mesPar.q2 = "Qpt_" + flavour[j];
|
||||
mesPar.gammas = "(Gamma5 Gamma5)";
|
||||
mesPar.sink = "sink";
|
||||
application.createModule<MContraction::Meson>("meson_pt_"
|
||||
+ flavour[i] + flavour[j],
|
||||
mesPar);
|
||||
|
||||
|
||||
//2pt function contraction Wilson
|
||||
MContraction::Meson::Par mesPar_W;
|
||||
mesPar_W.output = "2pt_free/W_pt_" + flavour[i] + flavour[j];
|
||||
mesPar_W.q1 = "W_Qpt_" + flavour[i];
|
||||
mesPar_W.q2 = "W_Qpt_" + flavour[j];
|
||||
mesPar_W.gammas = "(Gamma5 Gamma5)";
|
||||
mesPar_W.sink = "sink";
|
||||
application.createModule<MContraction::Meson>("W_meson_pt_"
|
||||
+ flavour[i] + flavour[j],
|
||||
mesPar_W);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// execution
|
||||
application.saveParameterFile("free_prop.xml");
|
||||
application.run();
|
||||
|
||||
// epilogue
|
||||
LOG(Message) << "Grid is finalizing now" << std::endl;
|
||||
Grid_finalize();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
@ -1,188 +0,0 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: Tests/Hadrons/Test_hadrons_meson_3pt.cc
|
||||
|
||||
Copyright (C) 2015-2018
|
||||
|
||||
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>
|
||||
#include <Hadrons/Modules.hpp>
|
||||
|
||||
using namespace Grid;
|
||||
using namespace Hadrons;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// initialization //////////////////////////////////////////////////////////
|
||||
Grid_init(&argc, &argv);
|
||||
HadronsLogError.Active(GridLogError.isActive());
|
||||
HadronsLogWarning.Active(GridLogWarning.isActive());
|
||||
HadronsLogMessage.Active(GridLogMessage.isActive());
|
||||
HadronsLogIterative.Active(GridLogIterative.isActive());
|
||||
HadronsLogDebug.Active(GridLogDebug.isActive());
|
||||
LOG(Message) << "Grid initialized" << std::endl;
|
||||
|
||||
// run setup ///////////////////////////////////////////////////////////////
|
||||
Application application;
|
||||
std::vector<std::string> flavour = {"l", "s", "c1", "c2", "c3"};
|
||||
std::vector<double> mass = {.01, .04, .2 , .25 , .3 };
|
||||
unsigned int nt = GridDefaultLatt()[Tp];
|
||||
|
||||
// global parameters
|
||||
Application::GlobalPar globalPar;
|
||||
globalPar.trajCounter.start = 1500;
|
||||
globalPar.trajCounter.end = 1520;
|
||||
globalPar.trajCounter.step = 20;
|
||||
globalPar.runId = "test";
|
||||
globalPar.genetic.maxGen = 1000;
|
||||
globalPar.genetic.maxCstGen = 200;
|
||||
globalPar.genetic.popSize = 20;
|
||||
globalPar.genetic.mutationRate = .1;
|
||||
application.setPar(globalPar);
|
||||
|
||||
// gauge field
|
||||
application.createModule<MGauge::Unit>("gauge");
|
||||
|
||||
// set fermion boundary conditions to be periodic space, antiperiodic time.
|
||||
std::string boundary = "1 1 1 -1";
|
||||
std::string twist = "0. 0. 0. 0.";
|
||||
|
||||
// sink
|
||||
MSink::Point::Par sinkPar;
|
||||
sinkPar.mom = "0 0 0";
|
||||
application.createModule<MSink::ScalarPoint>("sink", sinkPar);
|
||||
for (unsigned int i = 0; i < flavour.size(); ++i)
|
||||
{
|
||||
// actions
|
||||
MAction::DWF::Par actionPar;
|
||||
actionPar.gauge = "gauge";
|
||||
actionPar.Ls = 12;
|
||||
actionPar.M5 = 1.8;
|
||||
actionPar.mass = mass[i];
|
||||
actionPar.boundary = boundary;
|
||||
actionPar.twist = twist;
|
||||
application.createModule<MAction::DWF>("DWF_" + flavour[i], actionPar);
|
||||
|
||||
// solvers
|
||||
MSolver::RBPrecCG::Par solverPar;
|
||||
solverPar.action = "DWF_" + flavour[i];
|
||||
solverPar.residual = 1.0e-8;
|
||||
solverPar.maxIteration = 10000;
|
||||
application.createModule<MSolver::RBPrecCG>("CG_" + flavour[i],
|
||||
solverPar);
|
||||
}
|
||||
for (unsigned int t = 0; t < nt; t += 1)
|
||||
{
|
||||
std::string srcName;
|
||||
std::vector<std::string> qName;
|
||||
std::vector<std::vector<std::string>> seqName;
|
||||
|
||||
// Z2 source
|
||||
MSource::Z2::Par z2Par;
|
||||
z2Par.tA = t;
|
||||
z2Par.tB = t;
|
||||
srcName = "z2_" + std::to_string(t);
|
||||
application.createModule<MSource::Z2>(srcName, z2Par);
|
||||
for (unsigned int i = 0; i < flavour.size(); ++i)
|
||||
{
|
||||
// sequential sources
|
||||
MSource::SeqGamma::Par seqPar;
|
||||
qName.push_back("QZ2_" + flavour[i] + "_" + std::to_string(t));
|
||||
seqPar.q = qName[i];
|
||||
seqPar.tA = (t + nt/4) % nt;
|
||||
seqPar.tB = (t + nt/4) % nt;
|
||||
seqPar.mom = "1. 0. 0. 0.";
|
||||
seqName.push_back(std::vector<std::string>(Nd));
|
||||
for (unsigned int mu = 0; mu < Nd; ++mu)
|
||||
{
|
||||
seqPar.gamma = 0x1 << mu;
|
||||
seqName[i][mu] = "G" + std::to_string(seqPar.gamma)
|
||||
+ "_" + std::to_string(seqPar.tA) + "-"
|
||||
+ qName[i];
|
||||
application.createModule<MSource::SeqGamma>(seqName[i][mu], seqPar);
|
||||
}
|
||||
|
||||
// propagators
|
||||
MFermion::GaugeProp::Par quarkPar;
|
||||
quarkPar.solver = "CG_" + flavour[i];
|
||||
quarkPar.source = srcName;
|
||||
application.createModule<MFermion::GaugeProp>(qName[i], quarkPar);
|
||||
for (unsigned int mu = 0; mu < Nd; ++mu)
|
||||
{
|
||||
quarkPar.source = seqName[i][mu];
|
||||
seqName[i][mu] = "Q_" + flavour[i] + "-" + seqName[i][mu];
|
||||
application.createModule<MFermion::GaugeProp>(seqName[i][mu], quarkPar);
|
||||
}
|
||||
}
|
||||
|
||||
// contractions
|
||||
MContraction::Meson::Par mesPar;
|
||||
for (unsigned int i = 0; i < flavour.size(); ++i)
|
||||
for (unsigned int j = i; j < flavour.size(); ++j)
|
||||
{
|
||||
mesPar.output = "mesons/Z2_" + flavour[i] + flavour[j];
|
||||
mesPar.q1 = qName[i];
|
||||
mesPar.q2 = qName[j];
|
||||
mesPar.gammas = "all";
|
||||
mesPar.sink = "sink";
|
||||
application.createModule<MContraction::Meson>("meson_Z2_"
|
||||
+ std::to_string(t)
|
||||
+ "_"
|
||||
+ flavour[i]
|
||||
+ flavour[j],
|
||||
mesPar);
|
||||
}
|
||||
for (unsigned int i = 0; i < flavour.size(); ++i)
|
||||
for (unsigned int j = 0; j < flavour.size(); ++j)
|
||||
for (unsigned int mu = 0; mu < Nd; ++mu)
|
||||
{
|
||||
MContraction::Meson::Par mesPar;
|
||||
|
||||
mesPar.output = "3pt/Z2_" + flavour[i] + flavour[j] + "_"
|
||||
+ std::to_string(mu);
|
||||
mesPar.q1 = qName[i];
|
||||
mesPar.q2 = seqName[j][mu];
|
||||
mesPar.gammas = "all";
|
||||
mesPar.sink = "sink";
|
||||
application.createModule<MContraction::Meson>("3pt_Z2_"
|
||||
+ std::to_string(t)
|
||||
+ "_"
|
||||
+ flavour[i]
|
||||
+ flavour[j]
|
||||
+ "_"
|
||||
+ std::to_string(mu),
|
||||
mesPar);
|
||||
}
|
||||
}
|
||||
|
||||
// execution
|
||||
application.saveParameterFile("meson3pt.xml");
|
||||
application.run();
|
||||
|
||||
// epilogue
|
||||
LOG(Message) << "Grid is finalizing now" << std::endl;
|
||||
Grid_finalize();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
@ -1,155 +0,0 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: Tests/Hadrons/Test_hadrons_spectrum.cc
|
||||
|
||||
Copyright (C) 2015-2018
|
||||
|
||||
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>
|
||||
#include <Hadrons/Modules.hpp>
|
||||
|
||||
using namespace Grid;
|
||||
using namespace Hadrons;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// initialization //////////////////////////////////////////////////////////
|
||||
Grid_init(&argc, &argv);
|
||||
HadronsLogError.Active(GridLogError.isActive());
|
||||
HadronsLogWarning.Active(GridLogWarning.isActive());
|
||||
HadronsLogMessage.Active(GridLogMessage.isActive());
|
||||
HadronsLogIterative.Active(GridLogIterative.isActive());
|
||||
HadronsLogDebug.Active(GridLogDebug.isActive());
|
||||
LOG(Message) << "Grid initialized" << std::endl;
|
||||
|
||||
// run setup ///////////////////////////////////////////////////////////////
|
||||
Application application;
|
||||
std::vector<std::string> flavour = {"l", "s", "c1", "c2", "c3"};
|
||||
std::vector<std::string> flavour_baryon = {"l", "s", "a", "b", "c"}; //needs to be a single character
|
||||
std::vector<double> mass = {.01, .04, .2 , .25 , .3 };
|
||||
|
||||
// global parameters
|
||||
Application::GlobalPar globalPar;
|
||||
globalPar.trajCounter.start = 1500;
|
||||
globalPar.trajCounter.end = 1520;
|
||||
globalPar.trajCounter.step = 20;
|
||||
globalPar.runId = "test";
|
||||
application.setPar(globalPar);
|
||||
// gauge field
|
||||
application.createModule<MGauge::Unit>("gauge");
|
||||
// sources
|
||||
MSource::Z2::Par z2Par;
|
||||
z2Par.tA = 0;
|
||||
z2Par.tB = 0;
|
||||
application.createModule<MSource::Z2>("z2", z2Par);
|
||||
MSource::Point::Par ptPar;
|
||||
ptPar.position = "0 0 0 0";
|
||||
application.createModule<MSource::Point>("pt", ptPar);
|
||||
// sink
|
||||
MSink::Point::Par sinkPar;
|
||||
sinkPar.mom = "0 0 0";
|
||||
application.createModule<MSink::ScalarPoint>("sink", sinkPar);
|
||||
|
||||
// set fermion boundary conditions to be periodic space, antiperiodic time.
|
||||
std::string boundary = "1 1 1 -1";
|
||||
std::string twist = "0. 0. 0. 0.";
|
||||
|
||||
for (unsigned int i = 0; i < flavour.size(); ++i)
|
||||
{
|
||||
// actions
|
||||
MAction::DWF::Par actionPar;
|
||||
actionPar.gauge = "gauge";
|
||||
actionPar.Ls = 12;
|
||||
actionPar.M5 = 1.8;
|
||||
actionPar.mass = mass[i];
|
||||
actionPar.boundary = boundary;
|
||||
actionPar.twist = twist;
|
||||
application.createModule<MAction::DWF>("DWF_" + flavour[i], actionPar);
|
||||
|
||||
// solvers
|
||||
MSolver::RBPrecCG::Par solverPar;
|
||||
solverPar.action = "DWF_" + flavour[i];
|
||||
solverPar.residual = 1.0e-8;
|
||||
solverPar.maxIteration = 10000;
|
||||
application.createModule<MSolver::RBPrecCG>("CG_" + flavour[i],
|
||||
solverPar);
|
||||
|
||||
// propagators
|
||||
MFermion::GaugeProp::Par quarkPar;
|
||||
quarkPar.solver = "CG_" + flavour[i];
|
||||
quarkPar.source = "pt";
|
||||
application.createModule<MFermion::GaugeProp>("Qpt_" + flavour[i], quarkPar);
|
||||
quarkPar.source = "z2";
|
||||
application.createModule<MFermion::GaugeProp>("QZ2_" + flavour[i], quarkPar);
|
||||
}
|
||||
for (unsigned int i = 0; i < flavour.size(); ++i)
|
||||
for (unsigned int j = i; j < flavour.size(); ++j)
|
||||
{
|
||||
MContraction::Meson::Par mesPar;
|
||||
|
||||
mesPar.output = "mesons/pt_" + flavour[i] + flavour[j];
|
||||
mesPar.q1 = "Qpt_" + flavour[i];
|
||||
mesPar.q2 = "Qpt_" + flavour[j];
|
||||
mesPar.gammas = "all";
|
||||
mesPar.sink = "sink";
|
||||
application.createModule<MContraction::Meson>("meson_pt_"
|
||||
+ flavour[i] + flavour[j],
|
||||
mesPar);
|
||||
mesPar.output = "mesons/Z2_" + flavour[i] + flavour[j];
|
||||
mesPar.q1 = "QZ2_" + flavour[i];
|
||||
mesPar.q2 = "QZ2_" + flavour[j];
|
||||
mesPar.gammas = "all";
|
||||
mesPar.sink = "sink";
|
||||
application.createModule<MContraction::Meson>("meson_Z2_"
|
||||
+ flavour[i] + flavour[j],
|
||||
mesPar);
|
||||
}
|
||||
for (unsigned int i = 0; i < flavour.size(); ++i)
|
||||
for (unsigned int j = i; j < flavour.size(); ++j)
|
||||
for (unsigned int k = j; k < flavour.size(); ++k)
|
||||
{
|
||||
MContraction::Baryon::Par barPar;
|
||||
|
||||
barPar.output = "baryons/pt_" + flavour[i] + flavour[j] + flavour[k];
|
||||
barPar.q1 = "Qpt_" + flavour[i];
|
||||
barPar.q2 = "Qpt_" + flavour[j];
|
||||
barPar.q3 = "Qpt_" + flavour[k];
|
||||
barPar.gammas = "(j12 j12) (j32X j32Y)";
|
||||
barPar.quarks = flavour_baryon[i] + flavour_baryon[j] + flavour_baryon[k];
|
||||
barPar.prefactors = "1.0";
|
||||
barPar.sink = "sink";
|
||||
application.createModule<MContraction::Baryon>(
|
||||
"baryon_pt_" + flavour[i] + flavour[j] + flavour[k], barPar);
|
||||
}
|
||||
|
||||
// execution
|
||||
application.saveParameterFile("spectrum.xml");
|
||||
application.run();
|
||||
|
||||
// epilogue
|
||||
LOG(Message) << "Grid is finalizing now" << std::endl;
|
||||
Grid_finalize();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
@ -1,154 +0,0 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: Tests/Hadrons/Test_hadrons_spectrum.cc
|
||||
|
||||
Copyright (C) 2015-2018
|
||||
|
||||
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>
|
||||
#include <Hadrons/Modules.hpp>
|
||||
|
||||
using namespace Grid;
|
||||
using namespace Hadrons;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// initialization //////////////////////////////////////////////////////////
|
||||
Grid_init(&argc, &argv);
|
||||
HadronsLogError.Active(GridLogError.isActive());
|
||||
HadronsLogWarning.Active(GridLogWarning.isActive());
|
||||
HadronsLogMessage.Active(GridLogMessage.isActive());
|
||||
HadronsLogIterative.Active(GridLogIterative.isActive());
|
||||
HadronsLogDebug.Active(GridLogDebug.isActive());
|
||||
LOG(Message) << "Grid initialized" << std::endl;
|
||||
|
||||
// run setup ///////////////////////////////////////////////////////////////
|
||||
Application application;
|
||||
std::vector<std::string> flavour = {"l", "s", "c"};
|
||||
std::vector<double> mass = {.01, .04, .2 };
|
||||
|
||||
// global parameters
|
||||
Application::GlobalPar globalPar;
|
||||
globalPar.trajCounter.start = 1500;
|
||||
globalPar.trajCounter.end = 1520;
|
||||
globalPar.trajCounter.step = 20;
|
||||
globalPar.runId = "test";
|
||||
application.setPar(globalPar);
|
||||
// gauge field
|
||||
application.createModule<MGauge::Unit>("gauge");
|
||||
// sources
|
||||
MSource::Point::Par ptPar;
|
||||
ptPar.position = "0 0 0 0";
|
||||
application.createModule<MSource::Point>("pt_0", ptPar);
|
||||
ptPar.position = "0 0 0 4";
|
||||
application.createModule<MSource::Point>("pt_4", ptPar);
|
||||
// sink
|
||||
MSink::Point::Par sinkPar;
|
||||
sinkPar.mom = "0 0 0";
|
||||
application.createModule<MSink::ScalarPoint>("sink", sinkPar);
|
||||
application.createModule<MSink::Point>("sink_spec", sinkPar);
|
||||
|
||||
// set fermion boundary conditions to be periodic space, antiperiodic time.
|
||||
std::string boundary = "1 1 1 -1";
|
||||
std::string twist = "0. 0. 0. 0.";
|
||||
|
||||
for (unsigned int i = 0; i < flavour.size(); ++i)
|
||||
{
|
||||
// actions
|
||||
MAction::DWF::Par actionPar;
|
||||
actionPar.gauge = "gauge";
|
||||
actionPar.Ls = 12;
|
||||
actionPar.M5 = 1.8;
|
||||
actionPar.mass = mass[i];
|
||||
actionPar.boundary = boundary;
|
||||
actionPar.twist = twist;
|
||||
application.createModule<MAction::DWF>("DWF_" + flavour[i], actionPar);
|
||||
|
||||
// solvers
|
||||
MSolver::RBPrecCG::Par solverPar;
|
||||
solverPar.action = "DWF_" + flavour[i];
|
||||
solverPar.residual = 1.0e-8;
|
||||
solverPar.maxIteration = 10000;
|
||||
application.createModule<MSolver::RBPrecCG>("CG_" + flavour[i],
|
||||
solverPar);
|
||||
|
||||
}
|
||||
|
||||
// propagators
|
||||
MFermion::GaugeProp::Par quarkPar;
|
||||
quarkPar.solver = "CG_l";
|
||||
quarkPar.source = "pt_0";
|
||||
application.createModule<MFermion::GaugeProp>("Qpt_l_0", quarkPar);
|
||||
quarkPar.source = "pt_4";
|
||||
application.createModule<MFermion::GaugeProp>("Qpt_l_4", quarkPar);
|
||||
quarkPar.solver = "CG_s";
|
||||
quarkPar.source = "pt_0";
|
||||
application.createModule<MFermion::GaugeProp>("Qpt_s_0", quarkPar);
|
||||
//This should be a loop - how do I make this?
|
||||
quarkPar.solver = "CG_c";
|
||||
quarkPar.source = "pt_0";
|
||||
application.createModule<MFermion::GaugeProp>("Qpt_c_loop", quarkPar);
|
||||
quarkPar.solver = "CG_l";
|
||||
quarkPar.source = "pt_0";
|
||||
application.createModule<MFermion::GaugeProp>("Qpt_l_loop", quarkPar);
|
||||
|
||||
MSink::Smear::Par smearPar;
|
||||
smearPar.q="Qpt_l_0";
|
||||
smearPar.sink = "sink_spec";
|
||||
application.createModule<MSink::Smear>("Qpt_u_spec",smearPar);
|
||||
|
||||
|
||||
MContraction::SigmaToNucleonEye::Par EyePar;
|
||||
EyePar.output = "SigmaToNucleon/Eye_u";
|
||||
EyePar.qqLoop = "Qpt_l_loop";
|
||||
EyePar.quSpec = "Qpt_u_spec";
|
||||
EyePar.qdTf = "Qpt_l_4";
|
||||
EyePar.qsTi = "Qpt_s_0";
|
||||
EyePar.tf = 4;
|
||||
EyePar.sink = "sink";
|
||||
application.createModule<MContraction::SigmaToNucleonEye>("SigmaToNucleonEye_u", EyePar);
|
||||
EyePar.output = "SigmaToNucleon/Eye_c";
|
||||
EyePar.qqLoop = "Qpt_c_loop";
|
||||
application.createModule<MContraction::SigmaToNucleonEye>("SigmaToNucleonEye_c", EyePar);
|
||||
MContraction::SigmaToNucleonNonEye::Par NonEyePar;
|
||||
NonEyePar.output = "SigmaToNucleon/NonEye";
|
||||
NonEyePar.quTi = "Qpt_l_0";
|
||||
NonEyePar.quTf = "Qpt_l_4";
|
||||
NonEyePar.quSpec = "Qpt_u_spec";
|
||||
NonEyePar.qdTf = "Qpt_l_4";
|
||||
NonEyePar.qsTi = "Qpt_s_0";
|
||||
NonEyePar.tf = 4;
|
||||
NonEyePar.sink = "sink";
|
||||
application.createModule<MContraction::SigmaToNucleonNonEye>("SigmaToNucleonNonEye", NonEyePar);
|
||||
|
||||
// execution
|
||||
application.saveParameterFile("stn.xml");
|
||||
application.run();
|
||||
|
||||
// epilogue
|
||||
LOG(Message) << "Grid is finalizing now" << std::endl;
|
||||
Grid_finalize();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
@ -73,6 +73,7 @@ public:
|
||||
}
|
||||
|
||||
// Support for coarsening to a multigrid
|
||||
void OpDirAll (const Field &in, std::vector<Field> &out){};
|
||||
void OpDiag (const Field &in, Field &out) {};
|
||||
void OpDir (const Field &in, Field &out,int dir,int disp){};
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
/*************************************************************************************
|
||||
|
||||
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
@ -29,323 +31,174 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
|
||||
/* END LEGAL */
|
||||
#include <Grid/Grid.h>
|
||||
#include <Grid/algorithms/iterative/PrecGeneralisedConjugateResidual.h>
|
||||
//#include <algorithms/iterative/PrecConjugateResidual.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Grid;
|
||||
;
|
||||
/* Params
|
||||
* Grid:
|
||||
* block1(4)
|
||||
* block2(4)
|
||||
*
|
||||
* Subspace
|
||||
* * Fine : Subspace(nbasis,hi,lo,order,first,step) -- 32, 60,0.02,500,100,100
|
||||
* * Coarse: Subspace(nbasis,hi,lo,order,first,step) -- 32, 18,0.02,500,100,100
|
||||
|
||||
class myclass: Serializable {
|
||||
public:
|
||||
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(myclass,
|
||||
int, domaindecompose,
|
||||
int, domainsize,
|
||||
int, order,
|
||||
int, Ls,
|
||||
double, mq,
|
||||
double, lo,
|
||||
double, hi,
|
||||
int, steps);
|
||||
|
||||
myclass(){};
|
||||
|
||||
};
|
||||
myclass params;
|
||||
* Smoother:
|
||||
* * Fine: Cheby(hi, lo, order) -- 60,0.5,10
|
||||
* * Coarse: Cheby(hi, lo, order) -- 12,0.1,4
|
||||
|
||||
* Lanczos:
|
||||
* CoarseCoarse IRL( Nk, Nm, Nstop, poly(lo,hi,order)) 24,36,24,0.002,4.0,61
|
||||
*/
|
||||
RealD InverseApproximation(RealD x){
|
||||
return 1.0/x;
|
||||
}
|
||||
|
||||
template<class Fobj,class CComplex,int nbasis, class Matrix>
|
||||
template<class Field,class Matrix> class ChebyshevSmoother : public LinearFunction<Field>
|
||||
{
|
||||
public:
|
||||
typedef LinearOperatorBase<Field> FineOperator;
|
||||
Matrix & _SmootherMatrix;
|
||||
FineOperator & _SmootherOperator;
|
||||
|
||||
Chebyshev<Field> Cheby;
|
||||
|
||||
ChebyshevSmoother(RealD _lo,RealD _hi,int _ord, FineOperator &SmootherOperator,Matrix &SmootherMatrix) :
|
||||
_SmootherOperator(SmootherOperator),
|
||||
_SmootherMatrix(SmootherMatrix),
|
||||
Cheby(_lo,_hi,_ord,InverseApproximation)
|
||||
{};
|
||||
|
||||
void operator() (const Field &in, Field &out)
|
||||
{
|
||||
Field tmp(in.Grid());
|
||||
MdagMLinearOperator<Matrix,Field> MdagMOp(_SmootherMatrix);
|
||||
_SmootherOperator.AdjOp(in,tmp);
|
||||
Cheby(MdagMOp,tmp,out);
|
||||
}
|
||||
};
|
||||
template<class Field,class Matrix> class MirsSmoother : public LinearFunction<Field>
|
||||
{
|
||||
public:
|
||||
typedef LinearOperatorBase<Field> FineOperator;
|
||||
Matrix & SmootherMatrix;
|
||||
FineOperator & SmootherOperator;
|
||||
RealD tol;
|
||||
RealD shift;
|
||||
int maxit;
|
||||
|
||||
MirsSmoother(RealD _shift,RealD _tol,int _maxit,FineOperator &_SmootherOperator,Matrix &_SmootherMatrix) :
|
||||
shift(_shift),tol(_tol),maxit(_maxit),
|
||||
SmootherOperator(_SmootherOperator),
|
||||
SmootherMatrix(_SmootherMatrix)
|
||||
{};
|
||||
|
||||
void operator() (const Field &in, Field &out)
|
||||
{
|
||||
ZeroGuesser<Field> Guess;
|
||||
ConjugateGradient<Field> CG(tol,maxit,false);
|
||||
|
||||
Field src(in.Grid());
|
||||
|
||||
ShiftedMdagMLinearOperator<SparseMatrixBase<Field>,Field> MdagMOp(SmootherMatrix,shift);
|
||||
SmootherOperator.AdjOp(in,src);
|
||||
Guess(src,out);
|
||||
CG(MdagMOp,src,out);
|
||||
}
|
||||
};
|
||||
|
||||
template<class Fobj,class CComplex,int nbasis, class Matrix, class Guesser, class CoarseSolver>
|
||||
class MultiGridPreconditioner : public LinearFunction< Lattice<Fobj> > {
|
||||
public:
|
||||
|
||||
typedef Aggregation<Fobj,CComplex,nbasis> Aggregates;
|
||||
typedef CoarsenedMatrix<Fobj,CComplex,nbasis> CoarseOperator;
|
||||
|
||||
typedef typename Aggregation<Fobj,CComplex,nbasis>::siteVector siteVector;
|
||||
typedef typename Aggregation<Fobj,CComplex,nbasis>::CoarseScalar CoarseScalar;
|
||||
typedef typename Aggregation<Fobj,CComplex,nbasis>::CoarseVector CoarseVector;
|
||||
typedef typename Aggregation<Fobj,CComplex,nbasis>::CoarseMatrix CoarseMatrix;
|
||||
typedef typename Aggregation<Fobj,CComplex,nbasis>::FineField FineField;
|
||||
typedef LinearOperatorBase<FineField> FineOperator;
|
||||
typedef LinearFunction <FineField> FineSmoother;
|
||||
|
||||
Aggregates & _Aggregates;
|
||||
CoarseOperator & _CoarseOperator;
|
||||
Matrix & _FineMatrix;
|
||||
FineOperator & _FineOperator;
|
||||
Matrix & _SmootherMatrix;
|
||||
FineOperator & _SmootherOperator;
|
||||
Guesser & _Guess;
|
||||
FineSmoother & _Smoother;
|
||||
CoarseSolver & _CoarseSolve;
|
||||
|
||||
int level; void Level(int lv) {level = lv; };
|
||||
|
||||
#define GridLogLevel std::cout << GridLogMessage <<std::string(level,'\t')<< " Level "<<level <<" "
|
||||
|
||||
// Constructor
|
||||
MultiGridPreconditioner(Aggregates &Agg, CoarseOperator &Coarse,
|
||||
FineOperator &Fine,Matrix &FineMatrix,
|
||||
FineOperator &Smooth,Matrix &SmootherMatrix)
|
||||
FineSmoother &Smoother,
|
||||
Guesser &Guess_,
|
||||
CoarseSolver &CoarseSolve_)
|
||||
: _Aggregates(Agg),
|
||||
_CoarseOperator(Coarse),
|
||||
_FineOperator(Fine),
|
||||
_FineMatrix(FineMatrix),
|
||||
_SmootherOperator(Smooth),
|
||||
_SmootherMatrix(SmootherMatrix)
|
||||
_Smoother(Smoother),
|
||||
_Guess(Guess_),
|
||||
_CoarseSolve(CoarseSolve_),
|
||||
level(1) { }
|
||||
|
||||
virtual void operator()(const FineField &in, FineField & out)
|
||||
{
|
||||
}
|
||||
|
||||
void PowerMethod(const FineField &in) {
|
||||
|
||||
FineField p1(in.Grid());
|
||||
FineField p2(in.Grid());
|
||||
|
||||
MdagMLinearOperator<Matrix,FineField> fMdagMOp(_FineMatrix);
|
||||
|
||||
p1=in;
|
||||
for(int i=0;i<20;i++){
|
||||
RealD absp1=std::sqrt(norm2(p1));
|
||||
fMdagMOp.HermOp(p1,p2);// this is the G5 herm bit
|
||||
// _FineOperator.Op(p1,p2);// this is the G5 herm bit
|
||||
RealD absp2=std::sqrt(norm2(p2));
|
||||
if(i%10==9)
|
||||
std::cout<<GridLogMessage << "Power method on mdagm "<<i<<" " << absp2/absp1<<std::endl;
|
||||
p1=p2*(1.0/std::sqrt(absp2));
|
||||
}
|
||||
}
|
||||
|
||||
void operator()(const FineField &in, FineField & out) {
|
||||
operatorCheby(in,out);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// ADEF2: [PTM+Q] in = [1 - Q A] M in + Q in = Min + Q [ in -A Min]
|
||||
// ADEF1: [MP+Q ] in =M [1 - A Q] in + Q in
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
#if 1
|
||||
void operatorADEF2(const FineField &in, FineField & out) {
|
||||
|
||||
CoarseVector Csrc(_CoarseOperator.Grid());
|
||||
CoarseVector Ctmp(_CoarseOperator.Grid());
|
||||
CoarseVector Csol(_CoarseOperator.Grid());
|
||||
|
||||
ConjugateGradient<CoarseVector> CG(1.0e-10,100000);
|
||||
ConjugateGradient<FineField> fCG(3.0e-2,1000);
|
||||
|
||||
HermitianLinearOperator<CoarseOperator,CoarseVector> HermOp(_CoarseOperator);
|
||||
MdagMLinearOperator<CoarseOperator,CoarseVector> MdagMOp(_CoarseOperator);
|
||||
MdagMLinearOperator<Matrix,FineField> fMdagMOp(_FineMatrix);
|
||||
|
||||
FineField tmp(in.Grid());
|
||||
FineField res(in.Grid());
|
||||
FineField Min(in.Grid());
|
||||
|
||||
// Monitor completeness of low mode space
|
||||
_Aggregates.ProjectToSubspace (Csrc,in);
|
||||
_Aggregates.PromoteFromSubspace(Csrc,out);
|
||||
std::cout<<GridLogMessage<<"Coarse Grid Preconditioner\nCompleteness in: "<<std::sqrt(norm2(out)/norm2(in))<<std::endl;
|
||||
|
||||
// [PTM+Q] in = [1 - Q A] M in + Q in = Min + Q [ in -A Min]
|
||||
_FineOperator.Op(in,tmp);// this is the G5 herm bit
|
||||
fCG(fMdagMOp,tmp,Min); // solves MdagM = g5 M g5M
|
||||
|
||||
// Monitor completeness of low mode space
|
||||
_Aggregates.ProjectToSubspace (Csrc,Min);
|
||||
_Aggregates.PromoteFromSubspace(Csrc,out);
|
||||
std::cout<<GridLogMessage<<"Completeness Min: "<<std::sqrt(norm2(out)/norm2(Min))<<std::endl;
|
||||
|
||||
_FineOperator.Op(Min,tmp);
|
||||
tmp = in - tmp; // in - A Min
|
||||
|
||||
Csol=Zero();
|
||||
_Aggregates.ProjectToSubspace (Csrc,tmp);
|
||||
HermOp.AdjOp(Csrc,Ctmp);// Normal equations
|
||||
CG(MdagMOp,Ctmp,Csol);
|
||||
|
||||
HermOp.Op(Csol,Ctmp);
|
||||
Ctmp=Ctmp-Csrc;
|
||||
std::cout<<GridLogMessage<<"coarse space true residual "<<std::sqrt(norm2(Ctmp)/norm2(Csrc))<<std::endl;
|
||||
_Aggregates.PromoteFromSubspace(Csol,out);
|
||||
|
||||
_FineOperator.Op(out,res);
|
||||
res=res-tmp;
|
||||
std::cout<<GridLogMessage<<"promoted sol residual "<<std::sqrt(norm2(res)/norm2(tmp))<<std::endl;
|
||||
_Aggregates.ProjectToSubspace (Csrc,res);
|
||||
std::cout<<GridLogMessage<<"coarse space proj of residual "<<norm2(Csrc)<<std::endl;
|
||||
|
||||
|
||||
out = out+Min; // additive coarse space correction
|
||||
// out = Min; // no additive coarse space correction
|
||||
|
||||
_FineOperator.Op(out,tmp);
|
||||
tmp=tmp-in; // tmp is new residual
|
||||
|
||||
std::cout<<GridLogMessage<< " Preconditioner in " << norm2(in)<<std::endl;
|
||||
std::cout<<GridLogMessage<< " Preconditioner out " << norm2(out)<<std::endl;
|
||||
std::cout<<GridLogMessage<<"preconditioner thinks residual is "<<std::sqrt(norm2(tmp)/norm2(in))<<std::endl;
|
||||
|
||||
}
|
||||
#endif
|
||||
// ADEF1: [MP+Q ] in =M [1 - A Q] in + Q in
|
||||
#if 1
|
||||
void operatorADEF1(const FineField &in, FineField & out) {
|
||||
|
||||
CoarseVector Csrc(_CoarseOperator.Grid());
|
||||
CoarseVector Ctmp(_CoarseOperator.Grid());
|
||||
CoarseVector Csol(_CoarseOperator.Grid()); Csol=Zero();
|
||||
|
||||
ConjugateGradient<CoarseVector> CG(1.0e-10,100000);
|
||||
ConjugateGradient<FineField> fCG(3.0e-2,1000);
|
||||
|
||||
HermitianLinearOperator<CoarseOperator,CoarseVector> HermOp(_CoarseOperator);
|
||||
MdagMLinearOperator<CoarseOperator,CoarseVector> MdagMOp(_CoarseOperator);
|
||||
ShiftedMdagMLinearOperator<Matrix,FineField> fMdagMOp(_FineMatrix,0.1);
|
||||
|
||||
FineField tmp(in.Grid());
|
||||
FineField res(in.Grid());
|
||||
FineField Qin(in.Grid());
|
||||
|
||||
// Monitor completeness of low mode space
|
||||
// _Aggregates.ProjectToSubspace (Csrc,in);
|
||||
// _Aggregates.PromoteFromSubspace(Csrc,out);
|
||||
// std::cout<<GridLogMessage<<"Coarse Grid Preconditioner\nCompleteness in: "<<std::sqrt(norm2(out)/norm2(in))<<std::endl;
|
||||
|
||||
_Aggregates.ProjectToSubspace (Csrc,in);
|
||||
HermOp.AdjOp(Csrc,Ctmp);// Normal equations
|
||||
CG(MdagMOp,Ctmp,Csol);
|
||||
_Aggregates.PromoteFromSubspace(Csol,Qin);
|
||||
|
||||
// Qin=0;
|
||||
_FineOperator.Op(Qin,tmp);// A Q in
|
||||
tmp = in - tmp; // in - A Q in
|
||||
|
||||
_FineOperator.Op(tmp,res);// this is the G5 herm bit
|
||||
fCG(fMdagMOp,res,out); // solves MdagM = g5 M g5M
|
||||
|
||||
out = out + Qin;
|
||||
|
||||
_FineOperator.Op(out,tmp);
|
||||
tmp=tmp-in; // tmp is new residual
|
||||
|
||||
std::cout<<GridLogMessage<<"preconditioner thinks residual is "<<std::sqrt(norm2(tmp)/norm2(in))<<std::endl;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
void SmootherTest (const FineField & in){
|
||||
|
||||
FineField vec1(in.Grid());
|
||||
FineField vec2(in.Grid());
|
||||
RealD lo[3] = { 0.5, 1.0, 2.0};
|
||||
|
||||
// MdagMLinearOperator<Matrix,FineField> fMdagMOp(_FineMatrix);
|
||||
ShiftedMdagMLinearOperator<Matrix,FineField> fMdagMOp(_SmootherMatrix,0.0);
|
||||
|
||||
RealD Ni,r;
|
||||
|
||||
Ni = norm2(in);
|
||||
|
||||
for(int ilo=0;ilo<3;ilo++){
|
||||
for(int ord=5;ord<50;ord*=2){
|
||||
|
||||
std::cout << " lo "<<lo[ilo]<<" order "<<ord<<std::endl;
|
||||
|
||||
_SmootherOperator.AdjOp(in,vec1);
|
||||
|
||||
Chebyshev<FineField> Cheby (lo[ilo],70.0,ord,InverseApproximation);
|
||||
Cheby(fMdagMOp,vec1,vec2); // solves MdagM = g5 M g5M
|
||||
|
||||
_FineOperator.Op(vec2,vec1);// this is the G5 herm bit
|
||||
vec1 = in - vec1; // tmp = in - A Min
|
||||
r=norm2(vec1);
|
||||
std::cout<<GridLogMessage << "Smoother resid "<<std::sqrt(r/Ni)<<std::endl;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void operatorCheby(const FineField &in, FineField & out) {
|
||||
|
||||
CoarseVector Csrc(_CoarseOperator.Grid());
|
||||
CoarseVector Ctmp(_CoarseOperator.Grid());
|
||||
CoarseVector Csol(_CoarseOperator.Grid()); Csol=Zero();
|
||||
|
||||
ConjugateGradient<CoarseVector> CG(3.0e-3,100000);
|
||||
|
||||
HermitianLinearOperator<CoarseOperator,CoarseVector> HermOp(_CoarseOperator);
|
||||
MdagMLinearOperator<CoarseOperator,CoarseVector> MdagMOp(_CoarseOperator);
|
||||
// MdagMLinearOperator<Matrix,FineField> fMdagMOp(_FineMatrix);
|
||||
ShiftedMdagMLinearOperator<Matrix,FineField> fMdagMOp(_SmootherMatrix,0.0);
|
||||
|
||||
CoarseVector Csol(_CoarseOperator.Grid());
|
||||
FineField vec1(in.Grid());
|
||||
FineField vec2(in.Grid());
|
||||
|
||||
Chebyshev<FineField> Cheby (params.lo,params.hi,params.order,InverseApproximation);
|
||||
Chebyshev<FineField> ChebyAccu(params.lo,params.hi,params.order,InverseApproximation);
|
||||
double t;
|
||||
// Fine Smoother
|
||||
t=-usecond();
|
||||
_Smoother(in,out);
|
||||
t+=usecond();
|
||||
GridLogLevel << "Smoother took "<< t/1000.0<< "ms" <<std::endl;
|
||||
|
||||
_Aggregates.ProjectToSubspace (Csrc,in);
|
||||
// Update the residual
|
||||
_FineOperator.Op(out,vec1); sub(vec1, in ,vec1);
|
||||
|
||||
// _Aggregates.PromoteFromSubspace(Csrc,out);
|
||||
// std::cout<<GridLogMessage<<"Completeness: "<<std::sqrt(norm2(out)/norm2(in))<<std::endl;
|
||||
|
||||
// ofstream fout("smoother");
|
||||
// Cheby.csv(fout);
|
||||
|
||||
// V11 multigrid.
|
||||
// Use a fixed chebyshev and hope hermiticity helps.
|
||||
|
||||
// To make a working smoother for indefinite operator
|
||||
// must multiply by "Mdag" (ouch loses all low mode content)
|
||||
// and apply to poly approx of (mdagm)^-1.
|
||||
// so that we end up with an odd polynomial.
|
||||
|
||||
RealD Ni = norm2(in);
|
||||
|
||||
_SmootherOperator.AdjOp(in,vec1);// this is the G5 herm bit
|
||||
ChebyAccu(fMdagMOp,vec1,out); // solves MdagM = g5 M g5M
|
||||
|
||||
// Update with residual for out
|
||||
_FineOperator.Op(out,vec1);// this is the G5 herm bit
|
||||
vec1 = in - vec1; // tmp = in - A Min
|
||||
|
||||
RealD r = norm2(vec1);
|
||||
|
||||
std::cout<<GridLogMessage << "Smoother resid "<<std::sqrt(r/Ni)<< " " << r << " " << Ni <<std::endl;
|
||||
|
||||
// Fine to Coarse
|
||||
t=-usecond();
|
||||
_Aggregates.ProjectToSubspace (Csrc,vec1);
|
||||
|
||||
HermOp.AdjOp(Csrc,Ctmp);// Normal equations // This appears to be zero.
|
||||
CG(MdagMOp,Ctmp,Csol);
|
||||
_Aggregates.PromoteFromSubspace(Csol,vec1); // Ass^{-1} [in - A Min]_s
|
||||
// Q = Q[in - A Min]
|
||||
out = out+vec1;
|
||||
t+=usecond();
|
||||
GridLogLevel << "Project to coarse took "<< t/1000.0<< "ms" <<std::endl;
|
||||
|
||||
// Three preconditioner smoothing -- hermitian if C3 = C1
|
||||
// Recompute error
|
||||
_FineOperator.Op(out,vec1);// this is the G5 herm bit
|
||||
vec1 = in - vec1; // tmp = in - A Min
|
||||
r=norm2(vec1);
|
||||
// Coarse correction
|
||||
t=-usecond();
|
||||
_CoarseSolve(Csrc,Csol);
|
||||
t+=usecond();
|
||||
GridLogLevel << "Coarse solve took "<< t/1000.0<< "ms" <<std::endl;
|
||||
|
||||
std::cout<<GridLogMessage << "Coarse resid "<<std::sqrt(r/Ni)<<std::endl;
|
||||
// Coarse to Fine
|
||||
t=-usecond();
|
||||
_Aggregates.PromoteFromSubspace(Csol,vec1);
|
||||
add(out,out,vec1);
|
||||
t+=usecond();
|
||||
GridLogLevel << "Promote to this level took "<< t/1000.0<< "ms" <<std::endl;
|
||||
|
||||
// Reapply smoother
|
||||
_SmootherOperator.Op(vec1,vec2); // this is the G5 herm bit
|
||||
ChebyAccu(fMdagMOp,vec2,vec1); // solves MdagM = g5 M g5M
|
||||
// Residual
|
||||
_FineOperator.Op(out,vec1); sub(vec1 ,in , vec1);
|
||||
|
||||
out =out+vec1;
|
||||
vec1 = in - vec1; // tmp = in - A Min
|
||||
r=norm2(vec1);
|
||||
std::cout<<GridLogMessage << "Smoother resid "<<std::sqrt(r/Ni)<<std::endl;
|
||||
// Fine Smoother
|
||||
t=-usecond();
|
||||
_Smoother(vec1,vec2);
|
||||
t+=usecond();
|
||||
GridLogLevel << "Smoother took "<< t/1000.0<< "ms" <<std::endl;
|
||||
|
||||
add( out,out,vec2);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
int main (int argc, char ** argv)
|
||||
{
|
||||
Grid_init(&argc,&argv);
|
||||
|
||||
XmlReader RD("params.xml");
|
||||
read(RD,"params",params);
|
||||
std::cout<<"Params: Order "<<params.order<<"["<<params.lo<<","<<params.hi<<"]"<< " steps "<<params.steps<<std::endl;
|
||||
|
||||
const int Ls=params.Ls;
|
||||
const int Ls=16;
|
||||
|
||||
GridCartesian * UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi());
|
||||
GridRedBlackCartesian * UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid);
|
||||
@ -357,14 +210,22 @@ int main (int argc, char ** argv)
|
||||
// Construct a coarsened grid; utility for this?
|
||||
///////////////////////////////////////////////////
|
||||
std::vector<int> block ({2,2,2,2});
|
||||
std::vector<int> blockc ({2,2,2,2});
|
||||
const int nbasis= 32;
|
||||
|
||||
const int nbasisc= 32;
|
||||
auto clatt = GridDefaultLatt();
|
||||
for(int d=0;d<clatt.size();d++){
|
||||
clatt[d] = clatt[d]/block[d];
|
||||
}
|
||||
auto cclatt = clatt;
|
||||
for(int d=0;d<clatt.size();d++){
|
||||
cclatt[d] = clatt[d]/blockc[d];
|
||||
}
|
||||
|
||||
GridCartesian *Coarse4d = SpaceTimeGrid::makeFourDimGrid(clatt, GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi());;
|
||||
GridCartesian *Coarse5d = SpaceTimeGrid::makeFiveDimGrid(1,Coarse4d);
|
||||
GridCartesian *CoarseCoarse4d = SpaceTimeGrid::makeFourDimGrid(cclatt, GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi());;
|
||||
GridCartesian *CoarseCoarse5d = SpaceTimeGrid::makeFiveDimGrid(1,CoarseCoarse4d);
|
||||
|
||||
std::vector<int> seeds4({1,2,3,4});
|
||||
std::vector<int> seeds5({5,6,7,8});
|
||||
@ -372,186 +233,167 @@ int main (int argc, char ** argv)
|
||||
GridParallelRNG RNG5(FGrid); RNG5.SeedFixedIntegers(seeds5);
|
||||
GridParallelRNG RNG4(UGrid); RNG4.SeedFixedIntegers(seeds4);
|
||||
GridParallelRNG CRNG(Coarse5d);CRNG.SeedFixedIntegers(cseeds);
|
||||
|
||||
Gamma g5(Gamma::Algebra::Gamma5);
|
||||
|
||||
LatticeFermion src(FGrid); gaussian(RNG5,src);// src=src+g5*src;
|
||||
LatticeFermion result(FGrid); result=Zero();
|
||||
LatticeFermion ref(FGrid); ref=Zero();
|
||||
LatticeFermion tmp(FGrid);
|
||||
LatticeFermion err(FGrid);
|
||||
LatticeFermion result(FGrid);
|
||||
LatticeGaugeField Umu(UGrid);
|
||||
LatticeGaugeField UmuDD(UGrid);
|
||||
LatticeColourMatrix U(UGrid);
|
||||
LatticeColourMatrix zz(UGrid);
|
||||
|
||||
FieldMetaData header;
|
||||
std::string file("./ckpoint_lat.4000");
|
||||
NerscIO::readConfiguration(Umu,header,file);
|
||||
|
||||
|
||||
if ( params.domaindecompose ) {
|
||||
Lattice<iScalar<vInteger> > coor(UGrid);
|
||||
zz=Zero();
|
||||
for(int mu=0;mu<Nd;mu++){
|
||||
LatticeCoordinate(coor,mu);
|
||||
U = PeekIndex<LorentzIndex>(Umu,mu);
|
||||
U = where(mod(coor,params.domainsize)==(Integer)0,zz,U);
|
||||
PokeIndex<LorentzIndex>(UmuDD,U,mu);
|
||||
}
|
||||
} else {
|
||||
UmuDD = Umu;
|
||||
}
|
||||
// SU3::ColdConfiguration(RNG4,Umu);
|
||||
// SU3::TepidConfiguration(RNG4,Umu);
|
||||
// SU3::HotConfiguration(RNG4,Umu);
|
||||
// Umu=Zero();
|
||||
|
||||
RealD mass=params.mq;
|
||||
RealD M5=1.8;
|
||||
|
||||
std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
std::cout<<GridLogMessage << "Building g5R5 hermitian DWF operator" <<std::endl;
|
||||
std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
RealD mass=0.001;
|
||||
RealD M5=1.8;
|
||||
DomainWallFermionR Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5);
|
||||
DomainWallFermionR DdwfDD(UmuDD,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5);
|
||||
|
||||
typedef Aggregation<vSpinColourVector,vTComplex,nbasis> Subspace;
|
||||
typedef CoarsenedMatrix<vSpinColourVector,vTComplex,nbasis> CoarseOperator;
|
||||
typedef CoarseOperator::CoarseVector CoarseVector;
|
||||
|
||||
typedef CoarseOperator::siteVector siteVector;
|
||||
std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
std::cout<<GridLogMessage << "Calling Aggregation class to build subspace" <<std::endl;
|
||||
std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
MdagMLinearOperator<DomainWallFermionR,LatticeFermion> HermDefOp(Ddwf);
|
||||
Subspace Aggregates(Coarse5d,FGrid,0);
|
||||
// Aggregates.CreateSubspace(RNG5,HermDefOp,nbasis);
|
||||
assert ( (nbasis & 0x1)==0);
|
||||
int nb=nbasis/2;
|
||||
std::cout<<GridLogMessage << " nbasis/2 = "<<nb<<std::endl;
|
||||
// Aggregates.CreateSubspace(RNG5,HermDefOp,nb);
|
||||
// Aggregates.CreateSubspaceLanczos(RNG5,HermDefOp,nb);
|
||||
Aggregates.CreateSubspaceChebyshev(RNG5,HermDefOp,nb);
|
||||
for(int n=0;n<nb;n++){
|
||||
G5R5(Aggregates.subspace[n+nb],Aggregates.subspace[n]);
|
||||
std::cout<<GridLogMessage<<n<<" subspace "<<norm2(Aggregates.subspace[n+nb])<<" "<<norm2(Aggregates.subspace[n]) <<std::endl;
|
||||
}
|
||||
for(int n=0;n<nbasis;n++){
|
||||
std::cout<<GridLogMessage << "vec["<<n<<"] = "<<norm2(Aggregates.subspace[n]) <<std::endl;
|
||||
}
|
||||
|
||||
// for(int i=0;i<nbasis;i++){
|
||||
// result = Aggregates.subspace[i];
|
||||
// Aggregates.subspace[i]=result+g5*result;
|
||||
// }
|
||||
result=Zero();
|
||||
Subspace Aggregates(Coarse5d,FGrid,0);
|
||||
|
||||
assert ( (nbasis & 0x1)==0);
|
||||
{
|
||||
int nb=nbasis/2;
|
||||
Aggregates.CreateSubspaceChebyshev(RNG5,HermDefOp,nb,60.0,0.02,500,100,100,0.0);
|
||||
for(int n=0;n<nb;n++){
|
||||
G5R5(Aggregates.subspace[n+nb],Aggregates.subspace[n]);
|
||||
}
|
||||
LatticeFermion A(FGrid);
|
||||
LatticeFermion B(FGrid);
|
||||
for(int n=0;n<nb;n++){
|
||||
A = Aggregates.subspace[n];
|
||||
B = Aggregates.subspace[n+nb];
|
||||
Aggregates.subspace[n] = A+B; // 1+G5 // eigen value of G5R5 is +1
|
||||
Aggregates.subspace[n+nb]= A-B; // 1-G5 // eigen value of G5R5 is -1
|
||||
}
|
||||
}
|
||||
|
||||
std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
std::cout<<GridLogMessage << "Building coarse representation of Indef operator" <<std::endl;
|
||||
std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
typedef CoarsenedMatrix<vSpinColourVector,vTComplex,nbasis> Level1Op;
|
||||
typedef CoarsenedMatrix<siteVector,iScalar<vTComplex>,nbasisc> Level2Op;
|
||||
|
||||
Gamma5R5HermitianLinearOperator<DomainWallFermionR,LatticeFermion> HermIndefOp(Ddwf);
|
||||
Gamma5R5HermitianLinearOperator<DomainWallFermionR,LatticeFermion> HermIndefOpDD(DdwfDD);
|
||||
CoarsenedMatrix<vSpinColourVector,vTComplex,nbasis> LDOp(*Coarse5d,1); // Hermitian matrix
|
||||
LDOp.CoarsenOperator(FGrid,HermIndefOp,Aggregates);
|
||||
|
||||
Level1Op LDOp(*Coarse5d,1); LDOp.CoarsenOperator(FGrid,HermIndefOp,Aggregates);
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// Deflate the course space. Recursive multigrid?
|
||||
//////////////////////////////////////////////////
|
||||
typedef Aggregation<siteVector,iScalar<vTComplex>,nbasisc> CoarseSubspace;
|
||||
CoarseSubspace CoarseAggregates(CoarseCoarse5d,Coarse5d,0);
|
||||
|
||||
std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
std::cout<<GridLogMessage << "Testing some coarse space solvers " <<std::endl;
|
||||
std::cout<<GridLogMessage << "Build deflation space in coarse operator "<< std::endl;
|
||||
std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
CoarseVector c_src (Coarse5d);
|
||||
CoarseVector c_res (Coarse5d);
|
||||
gaussian(CRNG,c_src);
|
||||
c_res=Zero();
|
||||
|
||||
std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
std::cout<<GridLogMessage << "Solving posdef-CG on coarse space "<< std::endl;
|
||||
std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
MdagMLinearOperator<CoarseOperator,CoarseVector> PosdefLdop(LDOp);
|
||||
ConjugateGradient<CoarseVector> CG(1.0e-6,100000);
|
||||
CG(PosdefLdop,c_src,c_res);
|
||||
{
|
||||
int nb=nbasisc/2;
|
||||
CoarseAggregates.CreateSubspaceChebyshev(CRNG,PosdefLdop,nb,12.0,0.02,500,100,100,0.0);
|
||||
for(int n=0;n<nb;n++){
|
||||
auto subspace = CoarseAggregates.subspace[n].View();
|
||||
auto subspace_g5 = CoarseAggregates.subspace[n+nb].View();
|
||||
for(int nn=0;nn<nb;nn++){
|
||||
for(int site=0;site<Coarse5d->oSites();site++){
|
||||
subspace_g5[site](nn) = subspace[site](nn);
|
||||
subspace_g5[site](nn+nb)=-subspace[site](nn+nb);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Level2Op L2Op(*CoarseCoarse5d,1); // Hermitian matrix
|
||||
typedef Level2Op::CoarseVector CoarseCoarseVector;
|
||||
HermitianLinearOperator<Level1Op,CoarseVector> L1LinOp(LDOp);
|
||||
L2Op.CoarsenOperator(Coarse5d,L1LinOp,CoarseAggregates);
|
||||
|
||||
std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
std::cout<<GridLogMessage << "Solving indef-MCR on coarse space "<< std::endl;
|
||||
std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
// HermitianLinearOperator<CoarseOperator,CoarseVector> HermIndefLdop(LDOp);
|
||||
// ConjugateResidual<CoarseVector> MCR(1.0e-6,100000);
|
||||
// MCR(HermIndefLdop,c_src,c_res);
|
||||
|
||||
std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
std::cout<<GridLogMessage << "Building deflation preconditioner "<< std::endl;
|
||||
std::cout<<GridLogMessage << " Running CoarseCoarse grid Lanczos "<< std::endl;
|
||||
std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
|
||||
MultiGridPreconditioner <vSpinColourVector,vTComplex,nbasis,DomainWallFermionR> Precon (Aggregates, LDOp,
|
||||
HermIndefOp,Ddwf,
|
||||
HermIndefOp,Ddwf);
|
||||
MdagMLinearOperator<Level2Op,CoarseCoarseVector> IRLHermOpL2(L2Op);
|
||||
Chebyshev<CoarseCoarseVector> IRLChebyL2(0.001,4.2,71);
|
||||
FunctionHermOp<CoarseCoarseVector> IRLOpChebyL2(IRLChebyL2,IRLHermOpL2);
|
||||
PlainHermOp<CoarseCoarseVector> IRLOpL2 (IRLHermOpL2);
|
||||
int cNk=24;
|
||||
int cNm=36;
|
||||
int cNstop=24;
|
||||
ImplicitlyRestartedLanczos<CoarseCoarseVector> IRLL2(IRLOpChebyL2,IRLOpL2,cNstop,cNk,cNm,1.0e-3,20);
|
||||
|
||||
// MultiGridPreconditioner <vSpinColourVector,vTComplex,nbasis,DomainWallFermionR> PreconDD(Aggregates, LDOp,
|
||||
// HermIndefOp,Ddwf,
|
||||
// HermIndefOpDD,DdwfDD);
|
||||
// TrivialPrecon<LatticeFermion> simple;
|
||||
int cNconv;
|
||||
std::vector<RealD> eval2(cNm);
|
||||
std::vector<CoarseCoarseVector> evec2(cNm,CoarseCoarse5d);
|
||||
CoarseCoarseVector cc_src(CoarseCoarse5d); cc_src=1.0;
|
||||
IRLL2.calc(eval2,evec2,cc_src,cNconv);
|
||||
|
||||
ConjugateGradient<CoarseCoarseVector> CoarseCoarseCG(0.1,1000);
|
||||
DeflatedGuesser<CoarseCoarseVector> DeflCoarseCoarseGuesser(evec2,eval2);
|
||||
NormalEquations<CoarseCoarseVector> DeflCoarseCoarseCGNE(L2Op,CoarseCoarseCG,DeflCoarseCoarseGuesser);
|
||||
|
||||
std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
std::cout<<GridLogMessage << "Testing smoother efficacy"<< std::endl;
|
||||
std::cout<<GridLogMessage << "Building 3 level Multigrid "<< std::endl;
|
||||
std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
Precon.SmootherTest(src);
|
||||
typedef MultiGridPreconditioner<vSpinColourVector, vTComplex,nbasis, DomainWallFermionR,DeflatedGuesser<CoarseVector> , NormalEquations<CoarseVector> > TwoLevelMG;
|
||||
typedef MultiGridPreconditioner<siteVector,iScalar<vTComplex>,nbasisc,Level1Op, DeflatedGuesser<CoarseCoarseVector>, NormalEquations<CoarseCoarseVector> > CoarseMG;
|
||||
typedef MultiGridPreconditioner<vSpinColourVector, vTComplex,nbasis, DomainWallFermionR,ZeroGuesser<CoarseVector>, LinearFunction<CoarseVector> > ThreeLevelMG;
|
||||
|
||||
// std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
// std::cout<<GridLogMessage << "Testing DD smoother efficacy"<< std::endl;
|
||||
// std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
// PreconDD.SmootherTest(src);
|
||||
// MultiGrid preconditioner acting on the coarse space <-> coarsecoarse space
|
||||
ChebyshevSmoother<CoarseVector, Level1Op > CoarseSmoother(0.1,12.0,3,L1LinOp,LDOp);
|
||||
ChebyshevSmoother<LatticeFermion,DomainWallFermionR> FineSmoother(0.5,60.0,10,HermIndefOp,Ddwf);
|
||||
|
||||
// std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
// std::cout<<GridLogMessage << "Testing SAP smoother efficacy"<< std::endl;
|
||||
// std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
// PreconDD.SAP(src,result);
|
||||
// MirsSmoother<CoarseVector, Level1Op > CoarseCGSmoother(0.1,0.1,4,L1LinOp,LDOp);
|
||||
// MirsSmoother<LatticeFermion,DomainWallFermionR> FineCGSmoother(0.0,0.01,8,HermIndefOp,Ddwf);
|
||||
|
||||
// std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
// std::cout<<GridLogMessage << "Unprec CG "<< std::endl;
|
||||
// std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
|
||||
// TrivialPrecon<LatticeFermion> simple;
|
||||
// ConjugateGradient<LatticeFermion> fCG(1.0e-8,100000);
|
||||
// fCG(HermDefOp,src,result);
|
||||
|
||||
std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
std::cout<<GridLogMessage << "Red Black Prec CG "<< std::endl;
|
||||
std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
LatticeFermion src_o(FrbGrid);
|
||||
LatticeFermion result_o(FrbGrid);
|
||||
pickCheckerboard(Odd,src_o,src);
|
||||
result_o=Zero();
|
||||
SchurDiagMooeeOperator<DomainWallFermionR,LatticeFermion> HermOpEO(Ddwf);
|
||||
ConjugateGradient<LatticeFermion> pCG(1.0e-8,10000);
|
||||
// pCG(HermOpEO,src_o,result_o);
|
||||
|
||||
// std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
// std::cout<<GridLogMessage << "Testing GCR on indef matrix "<< std::endl;
|
||||
// std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
// PrecGeneralisedConjugateResidual<LatticeFermion> UPGCR(1.0e-8,100000,simple,8,128);
|
||||
// UPGCR(HermIndefOp,src,result);
|
||||
CoarseMG Level2Precon (CoarseAggregates, L2Op,
|
||||
L1LinOp,LDOp,
|
||||
CoarseSmoother,
|
||||
DeflCoarseCoarseGuesser,
|
||||
DeflCoarseCoarseCGNE);
|
||||
Level2Precon.Level(2);
|
||||
|
||||
// PGCR Applying this solver to solve the coarse space problem
|
||||
PrecGeneralisedConjugateResidual<CoarseVector> l2PGCR(0.1, 100, L1LinOp,Level2Precon,16,16);
|
||||
l2PGCR.Level(2);
|
||||
|
||||
/// Get themax eval
|
||||
std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
std::cout<<GridLogMessage <<" Applying power method to find spectral range "<<std::endl;
|
||||
std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
Precon.PowerMethod(src);
|
||||
// Wrap the 2nd level solver in a MultiGrid preconditioner acting on the fine space
|
||||
ZeroGuesser<CoarseVector> CoarseZeroGuesser;
|
||||
ThreeLevelMG ThreeLevelPrecon(Aggregates, LDOp,
|
||||
HermIndefOp,Ddwf,
|
||||
FineSmoother,
|
||||
CoarseZeroGuesser,
|
||||
l2PGCR);
|
||||
ThreeLevelPrecon.Level(1);
|
||||
|
||||
|
||||
// std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
// std::cout<<GridLogMessage << "Building a two level DDPGCR "<< std::endl;
|
||||
// std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
// PrecGeneralisedConjugateResidual<LatticeFermion> PGCRDD(1.0e-8,100000,PreconDD,8,128);
|
||||
// result=Zero();
|
||||
// std::cout<<GridLogMessage<<"checking norm src "<<norm2(src)<<std::endl;
|
||||
// PGCRDD(HermIndefOp,src,result);
|
||||
// Apply the fine-coarse-coarsecoarse 2 deep MG preconditioner in an outer PGCR on the fine fgrid
|
||||
PrecGeneralisedConjugateResidual<LatticeFermion> l1PGCR(1.0e-8,1000,HermIndefOp,ThreeLevelPrecon,16,16);
|
||||
l1PGCR.Level(1);
|
||||
|
||||
std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
std::cout<<GridLogMessage << "Building a two level PGCR "<< std::endl;
|
||||
std::cout<<GridLogMessage << "Calling 3 level Multigrid "<< std::endl;
|
||||
std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
PrecGeneralisedConjugateResidual<LatticeFermion> PGCR(1.0e-8,100000,Precon,8,8);
|
||||
std::cout<<GridLogMessage<<"checking norm src "<<norm2(src)<<std::endl;
|
||||
result=Zero();
|
||||
PGCR(HermIndefOp,src,result);
|
||||
l1PGCR(src,result);
|
||||
|
||||
CoarseVector c_src(Coarse5d); c_src=1.0;
|
||||
std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
std::cout<<GridLogMessage << " Fine PowerMethod "<< std::endl;
|
||||
PowerMethod<LatticeFermion> PM; PM(HermDefOp,src);
|
||||
std::cout<<GridLogMessage << " Coarse PowerMethod "<< std::endl;
|
||||
PowerMethod<CoarseVector> cPM; cPM(PosdefLdop,c_src);
|
||||
std::cout<<GridLogMessage << " CoarseCoarse PowerMethod "<< std::endl;
|
||||
PowerMethod<CoarseCoarseVector> ccPM; ccPM(IRLHermOpL2,cc_src);
|
||||
|
||||
std::cout<<GridLogMessage << "**************************************************"<< std::endl;
|
||||
std::cout<<GridLogMessage << "Done "<< std::endl;
|
||||
|
85
tests/solver/Test_wilsonclover_bicgstab_prec.cc
Normal file
85
tests/solver/Test_wilsonclover_bicgstab_prec.cc
Normal file
@ -0,0 +1,85 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./tests/Test_wilson_cg_unprec.cc
|
||||
|
||||
Copyright (C) 2015
|
||||
|
||||
Author: Azusa Yamaguchi <ayamaguc@staffmail.ed.ac.uk>
|
||||
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
||||
|
||||
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 <Grid/Grid.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Grid;
|
||||
;
|
||||
|
||||
template<class d>
|
||||
struct scal {
|
||||
d internal;
|
||||
};
|
||||
|
||||
Gamma::Algebra Gmu [] = {
|
||||
Gamma::Algebra::GammaX,
|
||||
Gamma::Algebra::GammaY,
|
||||
Gamma::Algebra::GammaZ,
|
||||
Gamma::Algebra::GammaT
|
||||
};
|
||||
|
||||
int main (int argc, char ** argv)
|
||||
{
|
||||
Grid_init(&argc,&argv);
|
||||
|
||||
Coordinate latt_size = GridDefaultLatt();
|
||||
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
||||
Coordinate mpi_layout = GridDefaultMpi();
|
||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||
GridRedBlackCartesian RBGrid(&Grid);
|
||||
|
||||
std::vector<int> seeds({1,2,3,4});
|
||||
GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(seeds);
|
||||
|
||||
LatticeFermion src(&Grid); random(pRNG,src);
|
||||
RealD nrm = norm2(src);
|
||||
LatticeFermion result(&Grid); result=Zero();
|
||||
LatticeGaugeField Umu(&Grid); SU3::HotConfiguration(pRNG,Umu);
|
||||
|
||||
double volume=1;
|
||||
for(int mu=0;mu<Nd;mu++){
|
||||
volume=volume*latt_size[mu];
|
||||
}
|
||||
|
||||
RealD mass = -0.1;
|
||||
RealD csw_r = 1.0;
|
||||
RealD csw_t = 1.0;
|
||||
WilsonCloverFermionR Dw(Umu, Grid, RBGrid, mass, csw_r, csw_t);
|
||||
|
||||
LatticeFermion src_o(&RBGrid);
|
||||
LatticeFermion result_o(&RBGrid);
|
||||
pickCheckerboard(Odd, src_o, src);
|
||||
result_o = Zero();
|
||||
|
||||
NonHermitianSchurDiagMooeeOperator<WilsonCloverFermionR,LatticeFermion> HermOp(Dw);
|
||||
BiCGSTAB<LatticeFermion> CG(1.0e-8,10000);
|
||||
CG(HermOp, src_o, result_o);
|
||||
|
||||
Grid_finalize();
|
||||
}
|
81
tests/solver/Test_wilsonclover_bicgstab_schur.cc
Normal file
81
tests/solver/Test_wilsonclover_bicgstab_schur.cc
Normal file
@ -0,0 +1,81 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./tests/Test_wilson_cg_unprec.cc
|
||||
|
||||
Copyright (C) 2015
|
||||
|
||||
Author: Azusa Yamaguchi <ayamaguc@staffmail.ed.ac.uk>
|
||||
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
||||
|
||||
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 <Grid/Grid.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Grid;
|
||||
;
|
||||
|
||||
template<class d>
|
||||
struct scal {
|
||||
d internal;
|
||||
};
|
||||
|
||||
Gamma::Algebra Gmu [] = {
|
||||
Gamma::Algebra::GammaX,
|
||||
Gamma::Algebra::GammaY,
|
||||
Gamma::Algebra::GammaZ,
|
||||
Gamma::Algebra::GammaT
|
||||
};
|
||||
|
||||
int main (int argc, char ** argv)
|
||||
{
|
||||
Grid_init(&argc,&argv);
|
||||
|
||||
Coordinate latt_size = GridDefaultLatt();
|
||||
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
||||
Coordinate mpi_layout = GridDefaultMpi();
|
||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||
GridRedBlackCartesian RBGrid(&Grid);
|
||||
|
||||
std::vector<int> seeds({1,2,3,4});
|
||||
GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(seeds);
|
||||
|
||||
LatticeFermion src(&Grid); random(pRNG,src);
|
||||
RealD nrm = norm2(src);
|
||||
LatticeFermion result(&Grid); result=Zero();
|
||||
LatticeGaugeField Umu(&Grid); SU3::HotConfiguration(pRNG,Umu);
|
||||
|
||||
double volume=1;
|
||||
for(int mu=0;mu<Nd;mu++){
|
||||
volume=volume*latt_size[mu];
|
||||
}
|
||||
|
||||
RealD mass = -0.1;
|
||||
RealD csw_r = 1.0;
|
||||
RealD csw_t = 1.0;
|
||||
WilsonCloverFermionR Dw(Umu, Grid, RBGrid, mass, csw_r, csw_t);
|
||||
|
||||
BiCGSTAB<LatticeFermion> CG(1.0e-8,10000);
|
||||
NonHermitianSchurRedBlackDiagMooeeSolve<LatticeFermion> SchurSolver(CG);
|
||||
|
||||
SchurSolver(Dw, src, result);
|
||||
|
||||
Grid_finalize();
|
||||
}
|
80
tests/solver/Test_wilsonclover_bicgstab_unprec.cc
Normal file
80
tests/solver/Test_wilsonclover_bicgstab_unprec.cc
Normal file
@ -0,0 +1,80 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./tests/Test_wilson_cg_unprec.cc
|
||||
|
||||
Copyright (C) 2015
|
||||
|
||||
Author: Azusa Yamaguchi <ayamaguc@staffmail.ed.ac.uk>
|
||||
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
||||
|
||||
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 <Grid/Grid.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Grid;
|
||||
;
|
||||
|
||||
template<class d>
|
||||
struct scal {
|
||||
d internal;
|
||||
};
|
||||
|
||||
Gamma::Algebra Gmu [] = {
|
||||
Gamma::Algebra::GammaX,
|
||||
Gamma::Algebra::GammaY,
|
||||
Gamma::Algebra::GammaZ,
|
||||
Gamma::Algebra::GammaT
|
||||
};
|
||||
|
||||
int main (int argc, char ** argv)
|
||||
{
|
||||
Grid_init(&argc,&argv);
|
||||
|
||||
Coordinate latt_size = GridDefaultLatt();
|
||||
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
||||
Coordinate mpi_layout = GridDefaultMpi();
|
||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||
GridRedBlackCartesian RBGrid(&Grid);
|
||||
|
||||
std::vector<int> seeds({1,2,3,4});
|
||||
GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(seeds);
|
||||
|
||||
LatticeFermion src(&Grid); random(pRNG,src);
|
||||
RealD nrm = norm2(src);
|
||||
LatticeFermion result(&Grid); result=Zero();
|
||||
LatticeGaugeField Umu(&Grid); SU3::HotConfiguration(pRNG,Umu);
|
||||
|
||||
double volume=1;
|
||||
for(int mu=0;mu<Nd;mu++){
|
||||
volume=volume*latt_size[mu];
|
||||
}
|
||||
|
||||
RealD mass = -0.1;
|
||||
RealD csw_r = 1.0;
|
||||
RealD csw_t = 1.0;
|
||||
WilsonCloverFermionR Dw(Umu, Grid, RBGrid, mass, csw_r, csw_t);
|
||||
|
||||
NonHermitianLinearOperator<WilsonCloverFermionR,LatticeFermion> HermOp(Dw);
|
||||
BiCGSTAB<LatticeFermion> CG(1.0e-8,10000);
|
||||
CG(HermOp,src,result);
|
||||
|
||||
Grid_finalize();
|
||||
}
|
91
tests/solver/Test_wilsonclover_cg_prec.cc
Normal file
91
tests/solver/Test_wilsonclover_cg_prec.cc
Normal file
@ -0,0 +1,91 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./tests/Test_wilson_cg_prec.cc
|
||||
|
||||
Copyright (C) 2015
|
||||
|
||||
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
||||
|
||||
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 <Grid/Grid.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Grid;
|
||||
;
|
||||
|
||||
template<class d>
|
||||
struct scal {
|
||||
d internal;
|
||||
};
|
||||
|
||||
Gamma::Algebra Gmu [] = {
|
||||
Gamma::Algebra::GammaX,
|
||||
Gamma::Algebra::GammaY,
|
||||
Gamma::Algebra::GammaZ,
|
||||
Gamma::Algebra::GammaT
|
||||
};
|
||||
|
||||
int main (int argc, char ** argv)
|
||||
{
|
||||
Grid_init(&argc,&argv);
|
||||
|
||||
|
||||
Coordinate latt_size = GridDefaultLatt();
|
||||
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
||||
Coordinate mpi_layout = GridDefaultMpi();
|
||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||
GridRedBlackCartesian RBGrid(&Grid);
|
||||
|
||||
std::vector<int> seeds({1,2,3,4});
|
||||
GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(seeds);
|
||||
|
||||
LatticeFermion src(&Grid); random(pRNG,src);
|
||||
RealD nrm = norm2(src);
|
||||
LatticeFermion result(&Grid); result=Zero();
|
||||
LatticeGaugeField Umu(&Grid); SU3::HotConfiguration(pRNG,Umu);
|
||||
|
||||
std::vector<LatticeColourMatrix> U(4,&Grid);
|
||||
|
||||
for(int mu=0;mu<Nd;mu++){
|
||||
U[mu] = PeekIndex<LorentzIndex>(Umu,mu);
|
||||
}
|
||||
|
||||
RealD mass = -0.1;
|
||||
RealD csw_r = 1.0;
|
||||
RealD csw_t = 1.0;
|
||||
WilsonCloverFermionR Dw(Umu, Grid, RBGrid, mass, csw_r, csw_t);
|
||||
|
||||
// HermitianOperator<WilsonFermion,LatticeFermion> HermOp(Dw);
|
||||
// ConjugateGradient<LatticeFermion> CG(1.0e-8,10000);
|
||||
// CG(HermOp,src,result);
|
||||
|
||||
LatticeFermion src_o(&RBGrid);
|
||||
LatticeFermion result_o(&RBGrid);
|
||||
pickCheckerboard(Odd,src_o,src);
|
||||
result_o=Zero();
|
||||
|
||||
SchurDiagMooeeOperator<WilsonCloverFermionR,LatticeFermion> HermOpEO(Dw);
|
||||
ConjugateGradient<LatticeFermion> CG(1.0e-8,10000);
|
||||
CG(HermOpEO,src_o,result_o);
|
||||
|
||||
|
||||
Grid_finalize();
|
||||
}
|
77
tests/solver/Test_wilsonclover_cg_schur.cc
Normal file
77
tests/solver/Test_wilsonclover_cg_schur.cc
Normal file
@ -0,0 +1,77 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./tests/Test_wilson_cg_schur.cc
|
||||
|
||||
Copyright (C) 2015
|
||||
|
||||
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
||||
|
||||
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 <Grid/Grid.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Grid;
|
||||
;
|
||||
|
||||
template<class d>
|
||||
struct scal {
|
||||
d internal;
|
||||
};
|
||||
|
||||
Gamma::Algebra Gmu [] = {
|
||||
Gamma::Algebra::GammaX,
|
||||
Gamma::Algebra::GammaY,
|
||||
Gamma::Algebra::GammaZ,
|
||||
Gamma::Algebra::GammaT
|
||||
};
|
||||
|
||||
int main (int argc, char ** argv)
|
||||
{
|
||||
Grid_init(&argc,&argv);
|
||||
|
||||
|
||||
Coordinate latt_size = GridDefaultLatt();
|
||||
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
||||
Coordinate mpi_layout = GridDefaultMpi();
|
||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||
GridRedBlackCartesian RBGrid(&Grid);
|
||||
|
||||
std::vector<int> seeds({1,2,3,4});
|
||||
GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(seeds);
|
||||
|
||||
LatticeGaugeField Umu(&Grid); SU3::HotConfiguration(pRNG,Umu);
|
||||
|
||||
LatticeFermion src(&Grid); random(pRNG,src);
|
||||
LatticeFermion result(&Grid); result=Zero();
|
||||
LatticeFermion resid(&Grid);
|
||||
|
||||
RealD mass = -0.1;
|
||||
RealD csw_r = 1.0;
|
||||
RealD csw_t = 1.0;
|
||||
WilsonCloverFermionR Dw(Umu, Grid, RBGrid, mass, csw_r, csw_t);
|
||||
|
||||
ConjugateGradient<LatticeFermion> CG(1.0e-8,10000);
|
||||
SchurRedBlackDiagMooeeSolve<LatticeFermion> SchurSolver(CG);
|
||||
|
||||
SchurSolver(Dw,src,result);
|
||||
|
||||
Grid_finalize();
|
||||
}
|
80
tests/solver/Test_wilsonclover_cg_unprec.cc
Normal file
80
tests/solver/Test_wilsonclover_cg_unprec.cc
Normal file
@ -0,0 +1,80 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./tests/Test_wilson_cg_unprec.cc
|
||||
|
||||
Copyright (C) 2015
|
||||
|
||||
Author: Azusa Yamaguchi <ayamaguc@staffmail.ed.ac.uk>
|
||||
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
||||
|
||||
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 <Grid/Grid.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Grid;
|
||||
;
|
||||
|
||||
template<class d>
|
||||
struct scal {
|
||||
d internal;
|
||||
};
|
||||
|
||||
Gamma::Algebra Gmu [] = {
|
||||
Gamma::Algebra::GammaX,
|
||||
Gamma::Algebra::GammaY,
|
||||
Gamma::Algebra::GammaZ,
|
||||
Gamma::Algebra::GammaT
|
||||
};
|
||||
|
||||
int main (int argc, char ** argv)
|
||||
{
|
||||
Grid_init(&argc,&argv);
|
||||
|
||||
Coordinate latt_size = GridDefaultLatt();
|
||||
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
||||
Coordinate mpi_layout = GridDefaultMpi();
|
||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||
GridRedBlackCartesian RBGrid(&Grid);
|
||||
|
||||
std::vector<int> seeds({1,2,3,4});
|
||||
GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(seeds);
|
||||
|
||||
LatticeFermion src(&Grid); random(pRNG,src);
|
||||
RealD nrm = norm2(src);
|
||||
LatticeFermion result(&Grid); result=Zero();
|
||||
LatticeGaugeField Umu(&Grid); SU3::HotConfiguration(pRNG,Umu);
|
||||
|
||||
double volume=1;
|
||||
for(int mu=0;mu<Nd;mu++){
|
||||
volume=volume*latt_size[mu];
|
||||
}
|
||||
|
||||
RealD mass = -0.1;
|
||||
RealD csw_r = 1.0;
|
||||
RealD csw_t = 1.0;
|
||||
WilsonCloverFermionR Dw(Umu, Grid, RBGrid, mass, csw_r, csw_t);
|
||||
|
||||
MdagMLinearOperator<WilsonFermionR,LatticeFermion> HermOp(Dw);
|
||||
ConjugateGradient<LatticeFermion> CG(1.0e-8,10000);
|
||||
CG(HermOp,src,result);
|
||||
|
||||
Grid_finalize();
|
||||
}
|
126
tests/solver/Test_wilsonclover_mixedbicgstab_prec.cc
Normal file
126
tests/solver/Test_wilsonclover_mixedbicgstab_prec.cc
Normal file
@ -0,0 +1,126 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./tests/Test_dwf_cg_prec.cc
|
||||
|
||||
Copyright (C) 2015
|
||||
|
||||
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
||||
|
||||
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 <Grid/Grid.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Grid;
|
||||
;
|
||||
|
||||
template<class d>
|
||||
struct scal {
|
||||
d internal;
|
||||
};
|
||||
|
||||
Gamma::Algebra Gmu [] = {
|
||||
Gamma::Algebra::GammaX,
|
||||
Gamma::Algebra::GammaY,
|
||||
Gamma::Algebra::GammaZ,
|
||||
Gamma::Algebra::GammaT
|
||||
};
|
||||
|
||||
int main (int argc, char ** argv)
|
||||
{
|
||||
Grid_init(&argc,&argv);
|
||||
|
||||
std::cout << GridLogMessage << "::::: NB: to enable a quick bit reproducibility check use the --checksums flag. " << std::endl;
|
||||
|
||||
GridCartesian *FGrid_d = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd, vComplexD::Nsimd()), GridDefaultMpi());
|
||||
GridCartesian *FGrid_f = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd, vComplexF::Nsimd()), GridDefaultMpi());
|
||||
GridRedBlackCartesian *FrbGrid_d = SpaceTimeGrid::makeFourDimRedBlackGrid(FGrid_d);
|
||||
GridRedBlackCartesian *FrbGrid_f = SpaceTimeGrid::makeFourDimRedBlackGrid(FGrid_f);
|
||||
|
||||
std::vector<int> fSeeds({1, 2, 3, 4});
|
||||
GridParallelRNG fPRNG(FGrid_d);
|
||||
fPRNG.SeedFixedIntegers(fSeeds);
|
||||
|
||||
// clang-format off
|
||||
LatticeFermionD src(FGrid_d); gaussian(fPRNG, src);
|
||||
LatticeFermionD result(FGrid_d); result = Zero();
|
||||
LatticeGaugeFieldD Umu_d(FGrid_d); SU3::HotConfiguration(fPRNG, Umu_d);
|
||||
LatticeGaugeFieldF Umu_f(FGrid_f); precisionChange(Umu_f, Umu_d);
|
||||
// clang-format on
|
||||
|
||||
RealD mass = -0.1;
|
||||
RealD csw_r = 1.0;
|
||||
RealD csw_t = 1.0;
|
||||
WilsonCloverFermionD Dw_d(Umu_d, *FGrid_d, *FrbGrid_d, mass, csw_r, csw_t);
|
||||
WilsonCloverFermionF Dw_f(Umu_f, *FGrid_f, *FrbGrid_f, mass, csw_r, csw_t);
|
||||
|
||||
LatticeFermionD src_o(FrbGrid_d);
|
||||
LatticeFermionD result_o(FrbGrid_d);
|
||||
LatticeFermionD result_o_2(FrbGrid_d);
|
||||
pickCheckerboard(Odd, src_o, src);
|
||||
result_o.Checkerboard() = Odd;
|
||||
result_o = Zero();
|
||||
result_o_2.Checkerboard() = Odd;
|
||||
result_o_2 = Zero();
|
||||
|
||||
NonHermitianSchurDiagMooeeOperator<WilsonCloverFermionD, LatticeFermionD> NonHermOpEO_d(Dw_d);
|
||||
NonHermitianSchurDiagMooeeOperator<WilsonCloverFermionF, LatticeFermionF> NonHermOpEO_f(Dw_f);
|
||||
|
||||
std::cout << GridLogMessage << "::::::::::::: Starting mixed CG" << std::endl;
|
||||
MixedPrecisionBiCGSTAB<LatticeFermionD, LatticeFermionF> mCG(1.0e-8, 10000, 50, FrbGrid_f, NonHermOpEO_f, NonHermOpEO_d);
|
||||
mCG(src_o, result_o);
|
||||
|
||||
std::cout << GridLogMessage << "::::::::::::: Starting regular CG" << std::endl;
|
||||
BiCGSTAB<LatticeFermionD> CG(1.0e-8, 10000);
|
||||
CG(NonHermOpEO_d, src_o, result_o_2);
|
||||
|
||||
LatticeFermionD diff_o(FrbGrid_d);
|
||||
RealD diff = axpy_norm(diff_o, -1.0, result_o, result_o_2);
|
||||
|
||||
std::cout << GridLogMessage << "::::::::::::: Diff between mixed and regular CG: " << diff << std::endl;
|
||||
|
||||
#ifdef HAVE_LIME
|
||||
if( GridCmdOptionExists(argv,argv+argc,"--checksums") )
|
||||
{
|
||||
std::string file1("./Propagator1");
|
||||
emptyUserRecord record;
|
||||
uint32_t nersc_csum;
|
||||
uint32_t scidac_csuma;
|
||||
uint32_t scidac_csumb;
|
||||
typedef SpinColourVectorD FermionD;
|
||||
typedef vSpinColourVectorD vFermionD;
|
||||
|
||||
BinarySimpleMunger<FermionD,FermionD> munge;
|
||||
std::string format = getFormatString<vFermionD>();
|
||||
|
||||
BinaryIO::writeLatticeObject<vFermionD,FermionD>(result_o,file1,munge, 0, format,
|
||||
nersc_csum,scidac_csuma,scidac_csumb);
|
||||
|
||||
std::cout << GridLogMessage << " Mixed checksums "<<std::hex << scidac_csuma << " "<<scidac_csumb<<std::endl;
|
||||
|
||||
BinaryIO::writeLatticeObject<vFermionD,FermionD>(result_o_2,file1,munge, 0, format,
|
||||
nersc_csum,scidac_csuma,scidac_csumb);
|
||||
|
||||
std::cout << GridLogMessage << " CG checksums "<<std::hex << scidac_csuma << " "<<scidac_csumb<<std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
Grid_finalize();
|
||||
}
|
126
tests/solver/Test_wilsonclover_mixedcg_prec.cc
Normal file
126
tests/solver/Test_wilsonclover_mixedcg_prec.cc
Normal file
@ -0,0 +1,126 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./tests/Test_dwf_cg_prec.cc
|
||||
|
||||
Copyright (C) 2015
|
||||
|
||||
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
||||
|
||||
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 <Grid/Grid.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Grid;
|
||||
;
|
||||
|
||||
template<class d>
|
||||
struct scal {
|
||||
d internal;
|
||||
};
|
||||
|
||||
Gamma::Algebra Gmu [] = {
|
||||
Gamma::Algebra::GammaX,
|
||||
Gamma::Algebra::GammaY,
|
||||
Gamma::Algebra::GammaZ,
|
||||
Gamma::Algebra::GammaT
|
||||
};
|
||||
|
||||
int main (int argc, char ** argv)
|
||||
{
|
||||
Grid_init(&argc,&argv);
|
||||
|
||||
std::cout << GridLogMessage << "::::: NB: to enable a quick bit reproducibility check use the --checksums flag. " << std::endl;
|
||||
|
||||
GridCartesian *FGrid_d = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd, vComplexD::Nsimd()), GridDefaultMpi());
|
||||
GridCartesian *FGrid_f = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd, vComplexF::Nsimd()), GridDefaultMpi());
|
||||
GridRedBlackCartesian *FrbGrid_d = SpaceTimeGrid::makeFourDimRedBlackGrid(FGrid_d);
|
||||
GridRedBlackCartesian *FrbGrid_f = SpaceTimeGrid::makeFourDimRedBlackGrid(FGrid_f);
|
||||
|
||||
std::vector<int> fSeeds({1, 2, 3, 4});
|
||||
GridParallelRNG fPRNG(FGrid_d);
|
||||
fPRNG.SeedFixedIntegers(fSeeds);
|
||||
|
||||
// clang-format off
|
||||
LatticeFermionD src(FGrid_d); gaussian(fPRNG, src);
|
||||
LatticeFermionD result(FGrid_d); result = Zero();
|
||||
LatticeGaugeFieldD Umu_d(FGrid_d); SU3::HotConfiguration(fPRNG, Umu_d);
|
||||
LatticeGaugeFieldF Umu_f(FGrid_f); precisionChange(Umu_f, Umu_d);
|
||||
// clang-format on
|
||||
|
||||
RealD mass = -0.1;
|
||||
RealD csw_r = 1.0;
|
||||
RealD csw_t = 1.0;
|
||||
WilsonCloverFermionD Dw_d(Umu_d, *FGrid_d, *FrbGrid_d, mass, csw_r, csw_t);
|
||||
WilsonCloverFermionF Dw_f(Umu_f, *FGrid_f, *FrbGrid_f, mass, csw_r, csw_t);
|
||||
|
||||
LatticeFermionD src_o(FrbGrid_d);
|
||||
LatticeFermionD result_o(FrbGrid_d);
|
||||
LatticeFermionD result_o_2(FrbGrid_d);
|
||||
pickCheckerboard(Odd, src_o, src);
|
||||
result_o.Checkerboard() = Odd;
|
||||
result_o = Zero();
|
||||
result_o_2.Checkerboard() = Odd;
|
||||
result_o_2 = Zero();
|
||||
|
||||
SchurDiagMooeeOperator<WilsonCloverFermionD, LatticeFermionD> HermOpEO_d(Dw_d);
|
||||
SchurDiagMooeeOperator<WilsonCloverFermionF, LatticeFermionF> HermOpEO_f(Dw_f);
|
||||
|
||||
std::cout << GridLogMessage << "::::::::::::: Starting mixed CG" << std::endl;
|
||||
MixedPrecisionConjugateGradient<LatticeFermionD, LatticeFermionF> mCG(1.0e-8, 10000, 50, FrbGrid_f, HermOpEO_f, HermOpEO_d);
|
||||
mCG(src_o, result_o);
|
||||
|
||||
std::cout << GridLogMessage << "::::::::::::: Starting regular CG" << std::endl;
|
||||
ConjugateGradient<LatticeFermionD> CG(1.0e-8, 10000);
|
||||
CG(HermOpEO_d, src_o, result_o_2);
|
||||
|
||||
LatticeFermionD diff_o(FrbGrid_d);
|
||||
RealD diff = axpy_norm(diff_o, -1.0, result_o, result_o_2);
|
||||
|
||||
std::cout << GridLogMessage << "::::::::::::: Diff between mixed and regular CG: " << diff << std::endl;
|
||||
|
||||
#ifdef HAVE_LIME
|
||||
if( GridCmdOptionExists(argv,argv+argc,"--checksums") )
|
||||
{
|
||||
std::string file1("./Propagator1");
|
||||
emptyUserRecord record;
|
||||
uint32_t nersc_csum;
|
||||
uint32_t scidac_csuma;
|
||||
uint32_t scidac_csumb;
|
||||
typedef SpinColourVectorD FermionD;
|
||||
typedef vSpinColourVectorD vFermionD;
|
||||
|
||||
BinarySimpleMunger<FermionD,FermionD> munge;
|
||||
std::string format = getFormatString<vFermionD>();
|
||||
|
||||
BinaryIO::writeLatticeObject<vFermionD,FermionD>(result_o,file1,munge, 0, format,
|
||||
nersc_csum,scidac_csuma,scidac_csumb);
|
||||
|
||||
std::cout << GridLogMessage << " Mixed checksums "<<std::hex << scidac_csuma << " "<<scidac_csumb<<std::endl;
|
||||
|
||||
BinaryIO::writeLatticeObject<vFermionD,FermionD>(result_o_2,file1,munge, 0, format,
|
||||
nersc_csum,scidac_csuma,scidac_csumb);
|
||||
|
||||
std::cout << GridLogMessage << " CG checksums "<<std::hex << scidac_csuma << " "<<scidac_csumb<<std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
Grid_finalize();
|
||||
}
|
303
tests/solver/Test_zMADWF_prec.cc
Normal file
303
tests/solver/Test_zMADWF_prec.cc
Normal file
@ -0,0 +1,303 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./tests/solver/Test_zMADWF_prec.cc
|
||||
|
||||
Copyright (C) 2015
|
||||
|
||||
Author: Christopher Kelly <ckelly@phys.columbia.edu>
|
||||
|
||||
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 */
|
||||
|
||||
//This test computes the zMobius approximation to the Mobius action and uses it within the MADWF context to accelerate an inversion
|
||||
#include <Grid/Grid.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Grid;
|
||||
|
||||
struct TestParams{
|
||||
bool load_config;
|
||||
std::string config_file;
|
||||
|
||||
double mass;
|
||||
|
||||
std::string outer_precon;
|
||||
std::string inner_precon;
|
||||
|
||||
int Ls_outer;
|
||||
double b_plus_c_outer;
|
||||
double resid_outer;
|
||||
|
||||
int Ls_inner;
|
||||
double b_plus_c_inner; //irrelevant for ZMobius
|
||||
double resid_inner;
|
||||
bool zmobius_inner;
|
||||
double lambda_max; //upper bound of H_T eigenvalue range required to generate zMobius approximation
|
||||
|
||||
TestParams(): load_config(true), config_file("ckpoint_lat.1000"), mass(0.01),
|
||||
Ls_outer(24), b_plus_c_outer(2.0), resid_outer(1e-8),
|
||||
Ls_inner(12), b_plus_c_inner(1.0), resid_inner(1e-8), zmobius_inner(true), lambda_max(1.42), outer_precon("Standard"), inner_precon("Standard")
|
||||
{}
|
||||
|
||||
void write(const std::string &file) const{
|
||||
XmlWriter wr(file);
|
||||
#define DOIT(A) wr.writeDefault(#A, A)
|
||||
DOIT(load_config);
|
||||
DOIT(config_file);
|
||||
DOIT(mass);
|
||||
DOIT(outer_precon);
|
||||
DOIT(inner_precon);
|
||||
DOIT(Ls_outer);
|
||||
DOIT(b_plus_c_outer);
|
||||
DOIT(resid_outer);
|
||||
DOIT(Ls_inner);
|
||||
DOIT(b_plus_c_inner);
|
||||
DOIT(resid_inner);
|
||||
DOIT(zmobius_inner);
|
||||
DOIT(lambda_max);
|
||||
#undef DOIT
|
||||
}
|
||||
void read(const std::string &file){
|
||||
XmlReader rd(file);
|
||||
#define DOIT(A) rd.readDefault(#A, A)
|
||||
DOIT(load_config);
|
||||
DOIT(config_file);
|
||||
DOIT(mass);
|
||||
DOIT(outer_precon);
|
||||
DOIT(inner_precon);
|
||||
DOIT(Ls_outer);
|
||||
DOIT(b_plus_c_outer);
|
||||
DOIT(resid_outer);
|
||||
DOIT(Ls_inner);
|
||||
DOIT(b_plus_c_inner);
|
||||
DOIT(resid_inner);
|
||||
DOIT(zmobius_inner);
|
||||
DOIT(lambda_max);
|
||||
#undef DOIT
|
||||
}
|
||||
};
|
||||
|
||||
struct RunParamsPrecStd{
|
||||
typedef SchurRedBlackDiagMooeeSolve<LatticeFermionD> SchurSolverType;
|
||||
|
||||
template<typename Action>
|
||||
using HermOpType = SchurDiagMooeeOperator<Action, LatticeFermionD>;
|
||||
};
|
||||
|
||||
struct RunParamsPrecDiagTwo{
|
||||
typedef SchurRedBlackDiagTwoSolve<LatticeFermionD> SchurSolverType;
|
||||
|
||||
template<typename Action>
|
||||
using HermOpType = SchurDiagTwoOperator<Action, LatticeFermionD>;
|
||||
};
|
||||
|
||||
|
||||
struct CGincreaseTol : public MADWFinnerIterCallbackBase{
|
||||
ConjugateGradient<LatticeFermionD> &cg_inner;
|
||||
RealD outer_resid;
|
||||
|
||||
CGincreaseTol(ConjugateGradient<LatticeFermionD> &cg_inner,
|
||||
RealD outer_resid): cg_inner(cg_inner), outer_resid(outer_resid){}
|
||||
|
||||
void operator()(const RealD current_resid){
|
||||
std::cout << "CGincreaseTol with current residual " << current_resid << " changing inner tolerance " << cg_inner.Tolerance << " -> ";
|
||||
while(cg_inner.Tolerance < current_resid) cg_inner.Tolerance *= 2;
|
||||
//cg_inner.Tolerance = outer_resid/current_resid;
|
||||
std::cout << cg_inner.Tolerance << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename RunParamsOuter, typename RunParamsInner>
|
||||
void run(const TestParams ¶ms){
|
||||
RealD bmc = 1.0; //use Shamir kernel
|
||||
std::vector<ComplexD> gamma_inner;
|
||||
|
||||
std::cout << "Compute parameters" << std::endl;
|
||||
if(params.zmobius_inner){
|
||||
Approx::computeZmobiusGamma(gamma_inner, params.b_plus_c_inner, params.Ls_inner, params.b_plus_c_outer, params.Ls_outer, params.lambda_max);
|
||||
}else{
|
||||
Approx::zolotarev_data *zdata = Approx::higham(1.0,params.Ls_inner);
|
||||
gamma_inner.resize(params.Ls_inner);
|
||||
for(int s=0;s<params.Ls_inner;s++) gamma_inner[s] = zdata->gamma[s];
|
||||
Approx::zolotarev_free(zdata);
|
||||
}
|
||||
std::cout << "gamma:\n";
|
||||
for(int s=0;s<params.Ls_inner;s++) std::cout << s << " " << gamma_inner[s] << std::endl;
|
||||
|
||||
|
||||
GridCartesian* UGrid = SpaceTimeGrid::makeFourDimGrid(
|
||||
GridDefaultLatt(), GridDefaultSimd(Nd, vComplexD::Nsimd()),
|
||||
GridDefaultMpi());
|
||||
GridRedBlackCartesian* UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid);
|
||||
|
||||
|
||||
GridCartesian* FGrid_outer = SpaceTimeGrid::makeFiveDimGrid(params.Ls_outer, UGrid);
|
||||
GridCartesian* FGrid_inner = SpaceTimeGrid::makeFiveDimGrid(params.Ls_inner, UGrid);
|
||||
|
||||
GridRedBlackCartesian* FrbGrid_outer = SpaceTimeGrid::makeFiveDimRedBlackGrid(params.Ls_outer, UGrid);
|
||||
GridRedBlackCartesian* FrbGrid_inner = SpaceTimeGrid::makeFiveDimRedBlackGrid(params.Ls_inner, UGrid);
|
||||
|
||||
|
||||
std::vector<int> seeds4({1, 2, 3, 4});
|
||||
std::vector<int> seeds5({5, 6, 7, 8});
|
||||
|
||||
GridParallelRNG RNG5_outer(FGrid_outer);
|
||||
RNG5_outer.SeedFixedIntegers(seeds5);
|
||||
|
||||
GridParallelRNG RNG4(UGrid);
|
||||
RNG4.SeedFixedIntegers(seeds4);
|
||||
|
||||
LatticeFermionD src4(UGrid); random(RNG4,src4);
|
||||
|
||||
LatticeFermionD result_outer(FGrid_outer);
|
||||
result_outer = Zero();
|
||||
LatticeGaugeFieldD Umu(UGrid);
|
||||
|
||||
if(params.load_config){
|
||||
FieldMetaData header;
|
||||
NerscIO::readConfiguration(Umu, header, params.config_file);
|
||||
|
||||
for(int i=0;i<Nd;i++){
|
||||
assert(header.dimension[i] == GridDefaultLatt()[i]);
|
||||
}
|
||||
}else{
|
||||
SU3::HotConfiguration(RNG4, Umu);
|
||||
}
|
||||
|
||||
std::cout << GridLogMessage << "Lattice dimensions: " << GridDefaultLatt()
|
||||
<< " Ls: " << params.Ls_outer << std::endl;
|
||||
|
||||
RealD M5 = 1.8;
|
||||
|
||||
RealD b_outer = (params.b_plus_c_outer + bmc)/2.;
|
||||
RealD c_outer = (params.b_plus_c_outer - bmc)/2.;
|
||||
|
||||
RealD b_inner = (params.b_plus_c_inner + bmc)/2.;
|
||||
RealD c_inner = (params.b_plus_c_inner - bmc)/2.;
|
||||
|
||||
MobiusFermionD D_outer(Umu, *FGrid_outer, *FrbGrid_outer, *UGrid, *UrbGrid, params.mass, M5, b_outer, c_outer);
|
||||
ZMobiusFermionD D_inner(Umu, *FGrid_inner, *FrbGrid_inner, *UGrid, *UrbGrid, params.mass, M5, gamma_inner, b_inner, c_inner);
|
||||
|
||||
LatticeFermionD src_outer(FGrid_outer);
|
||||
D_outer.ImportPhysicalFermionSource(src4,src_outer); //applies D_-
|
||||
|
||||
//Solve using a regular even-odd preconditioned CG for the Hermitian operator
|
||||
//M y = x
|
||||
//Mprec y'_o = x'_o where Mprec = Doo - Doe Dee^-1 Deo and x'_o = -Doe Dee^-1 x_e + x_o
|
||||
//y_o = y'_o
|
||||
|
||||
//(Mprec^dag Mprec) y'_o = Mprec^dag x'_o
|
||||
//y'_o = (Mprec^dag Mprec)^-1 Mprec^dag x'_o
|
||||
|
||||
//We can get Mprec^dag x'_o from x_o from SchurRedBlackDiagMooeeSolve::RedBlackSource
|
||||
ConjugateGradient<LatticeFermionD> CG_outer(params.resid_outer, 10000);
|
||||
typename RunParamsOuter::SchurSolverType SchurSolver_outer(CG_outer);
|
||||
|
||||
LatticeFermionD tmp_e_outer(FrbGrid_outer);
|
||||
LatticeFermionD src_o_outer(FrbGrid_outer);
|
||||
SchurSolver_outer.RedBlackSource(D_outer, src_outer, tmp_e_outer, src_o_outer);
|
||||
|
||||
LatticeFermionD result_o_outer(FrbGrid_outer);
|
||||
result_o_outer = Zero();
|
||||
|
||||
GridStopWatch CGTimer;
|
||||
|
||||
typename RunParamsOuter::HermOpType<MobiusFermionD> HermOpEO_outer(D_outer);
|
||||
|
||||
CGTimer.Start();
|
||||
CG_outer(HermOpEO_outer, src_o_outer, result_o_outer);
|
||||
CGTimer.Stop();
|
||||
|
||||
std::cout << GridLogMessage << "Total outer CG time : " << CGTimer.Elapsed()
|
||||
<< std::endl;
|
||||
|
||||
CGTimer.Reset();
|
||||
|
||||
//Solve for y using MADWF with internal preconditioning
|
||||
|
||||
//typedef PauliVillarsSolverRBprec<LatticeFermionD, typename RunParamsOuter::SchurSolverType> PVtype;
|
||||
//PVtype PV_outer(SchurSolver_outer);
|
||||
|
||||
typedef PauliVillarsSolverFourierAccel<LatticeFermionD, LatticeGaugeFieldD> PVtype;
|
||||
PVtype PV_outer(Umu, CG_outer);
|
||||
|
||||
ConjugateGradient<LatticeFermionD> CG_inner(params.resid_inner, 10000, 0);
|
||||
|
||||
CGincreaseTol update(CG_inner, params.resid_outer);
|
||||
|
||||
typename RunParamsInner::SchurSolverType SchurSolver_inner(CG_inner);
|
||||
|
||||
ZeroGuesser<LatticeFermion> Guess;
|
||||
MADWF<MobiusFermionD, ZMobiusFermionD, PVtype, typename RunParamsInner::SchurSolverType, ZeroGuesser<LatticeFermion> > madwf(D_outer, D_inner, PV_outer, SchurSolver_inner, Guess, params.resid_outer, 100, &update);
|
||||
|
||||
LatticeFermionD result_MADWF(FGrid_outer);
|
||||
result_MADWF = Zero();
|
||||
|
||||
CGTimer.Start();
|
||||
madwf(src4, result_MADWF);
|
||||
CGTimer.Stop();
|
||||
|
||||
LatticeFermionD result_o_MADWF(FrbGrid_outer);
|
||||
pickCheckerboard(Odd, result_o_MADWF, result_MADWF);
|
||||
|
||||
std::cout << GridLogMessage << "Total MADWF time : " << CGTimer.Elapsed()
|
||||
<< std::endl;
|
||||
|
||||
LatticeFermionD diff = result_o_MADWF - result_o_outer;
|
||||
std::cout <<GridLogMessage<< "Odd-parity MADWF result norm " << norm2(result_o_MADWF)
|
||||
<< " Regular result norm " << norm2(result_o_outer)
|
||||
<< " Norm of diff " << norm2(diff)<<std::endl;
|
||||
|
||||
|
||||
//std::cout << GridLogMessage << "######## Dhop calls summary" << std::endl;
|
||||
//D_outer.Report();
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
std::cout << "Init" << std::endl;
|
||||
Grid_init(&argc, &argv);
|
||||
|
||||
TestParams params;
|
||||
|
||||
if( GridCmdOptionExists(argv,argv+argc,"--params") ){
|
||||
std::string pfile = GridCmdOptionPayload(argv,argv+argc,"--params");
|
||||
if(pfile == "TEMPLATE"){
|
||||
params.write("params.templ");
|
||||
return 0;
|
||||
}else{
|
||||
params.read(pfile);
|
||||
}
|
||||
}
|
||||
|
||||
if(params.outer_precon == "Standard" && params.inner_precon == "Standard" ){
|
||||
run<RunParamsPrecStd, RunParamsPrecStd>(params);
|
||||
}else if(params.outer_precon == "DiagTwo" && params.inner_precon == "Standard"){
|
||||
run<RunParamsPrecDiagTwo, RunParamsPrecStd>(params);
|
||||
}else if(params.outer_precon == "Standard" && params.inner_precon == "DiagTwo"){
|
||||
run<RunParamsPrecStd, RunParamsPrecDiagTwo>(params);
|
||||
}else if(params.outer_precon == "DiagTwo" && params.inner_precon == "DiagTwo"){
|
||||
run<RunParamsPrecDiagTwo, RunParamsPrecDiagTwo>(params);
|
||||
}else assert(0);
|
||||
|
||||
Grid_finalize();
|
||||
}
|
Reference in New Issue
Block a user