mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-11 14:40:46 +01:00
Merge branch 'feature/qed-fvol' of https://github.com/paboyle/Grid into feature/qed-fvol
# Conflicts: # lib/qcd/action/fermion/Fermion.h
This commit is contained in:
commit
888988ad37
@ -66,7 +66,8 @@ int main (int argc, char ** argv)
|
|||||||
|
|
||||||
Vec tsum; tsum = zero;
|
Vec tsum; tsum = zero;
|
||||||
|
|
||||||
GridParallelRNG pRNG(&Grid); pRNG.SeedRandomDevice();
|
GridParallelRNG pRNG(&Grid);
|
||||||
|
pRNG.SeedFixedIntegers(std::vector<int>({56,17,89,101}));
|
||||||
|
|
||||||
std::vector<double> stop(threads);
|
std::vector<double> stop(threads);
|
||||||
Vector<Vec> sum(threads);
|
Vector<Vec> sum(threads);
|
||||||
|
@ -65,7 +65,7 @@ int main (int argc, char ** argv)
|
|||||||
|
|
||||||
uint64_t Nloop=NLOOP;
|
uint64_t Nloop=NLOOP;
|
||||||
|
|
||||||
// GridParallelRNG pRNG(&Grid); pRNG.SeedRandomDevice();
|
// GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9});
|
||||||
|
|
||||||
LatticeVec z(&Grid); //random(pRNG,z);
|
LatticeVec z(&Grid); //random(pRNG,z);
|
||||||
LatticeVec x(&Grid); //random(pRNG,x);
|
LatticeVec x(&Grid); //random(pRNG,x);
|
||||||
@ -100,7 +100,7 @@ int main (int argc, char ** argv)
|
|||||||
int vol = latt_size[0]*latt_size[1]*latt_size[2]*latt_size[3];
|
int vol = latt_size[0]*latt_size[1]*latt_size[2]*latt_size[3];
|
||||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||||
|
|
||||||
// GridParallelRNG pRNG(&Grid); pRNG.SeedRandomDevice();
|
// GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9});
|
||||||
|
|
||||||
LatticeVec z(&Grid); //random(pRNG,z);
|
LatticeVec z(&Grid); //random(pRNG,z);
|
||||||
LatticeVec x(&Grid); //random(pRNG,x);
|
LatticeVec x(&Grid); //random(pRNG,x);
|
||||||
@ -138,7 +138,7 @@ int main (int argc, char ** argv)
|
|||||||
|
|
||||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||||
|
|
||||||
// GridParallelRNG pRNG(&Grid); pRNG.SeedRandomDevice();
|
// GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9});
|
||||||
|
|
||||||
LatticeVec z(&Grid); //random(pRNG,z);
|
LatticeVec z(&Grid); //random(pRNG,z);
|
||||||
LatticeVec x(&Grid); //random(pRNG,x);
|
LatticeVec x(&Grid); //random(pRNG,x);
|
||||||
@ -173,7 +173,7 @@ int main (int argc, char ** argv)
|
|||||||
uint64_t Nloop=NLOOP;
|
uint64_t Nloop=NLOOP;
|
||||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||||
|
|
||||||
// GridParallelRNG pRNG(&Grid); pRNG.SeedRandomDevice();
|
// GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9});
|
||||||
LatticeVec z(&Grid); //random(pRNG,z);
|
LatticeVec z(&Grid); //random(pRNG,z);
|
||||||
LatticeVec x(&Grid); //random(pRNG,x);
|
LatticeVec x(&Grid); //random(pRNG,x);
|
||||||
LatticeVec y(&Grid); //random(pRNG,y);
|
LatticeVec y(&Grid); //random(pRNG,y);
|
||||||
|
@ -51,7 +51,7 @@ int main (int argc, char ** argv)
|
|||||||
std::vector<int> seeds({1,2,3,4});
|
std::vector<int> seeds({1,2,3,4});
|
||||||
GridParallelRNG pRNG(&Grid);
|
GridParallelRNG pRNG(&Grid);
|
||||||
pRNG.SeedFixedIntegers(seeds);
|
pRNG.SeedFixedIntegers(seeds);
|
||||||
// pRNG.SeedRandomDevice();
|
// pRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9});
|
||||||
|
|
||||||
typedef typename ImprovedStaggeredFermionR::FermionField FermionField;
|
typedef typename ImprovedStaggeredFermionR::FermionField FermionField;
|
||||||
typename ImprovedStaggeredFermionR::ImplParams params;
|
typename ImprovedStaggeredFermionR::ImplParams params;
|
||||||
|
@ -55,7 +55,7 @@ int main (int argc, char ** argv)
|
|||||||
std::vector<int> latt_size ({lat*mpi_layout[0],lat*mpi_layout[1],lat*mpi_layout[2],lat*mpi_layout[3]});
|
std::vector<int> latt_size ({lat*mpi_layout[0],lat*mpi_layout[1],lat*mpi_layout[2],lat*mpi_layout[3]});
|
||||||
int vol = latt_size[0]*latt_size[1]*latt_size[2]*latt_size[3];
|
int vol = latt_size[0]*latt_size[1]*latt_size[2]*latt_size[3];
|
||||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||||
// GridParallelRNG pRNG(&Grid); pRNG.SeedRandomDevice();
|
// GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9});
|
||||||
|
|
||||||
LatticeColourMatrix z(&Grid);// random(pRNG,z);
|
LatticeColourMatrix z(&Grid);// random(pRNG,z);
|
||||||
LatticeColourMatrix x(&Grid);// random(pRNG,x);
|
LatticeColourMatrix x(&Grid);// random(pRNG,x);
|
||||||
@ -88,7 +88,7 @@ int main (int argc, char ** argv)
|
|||||||
int vol = latt_size[0]*latt_size[1]*latt_size[2]*latt_size[3];
|
int vol = latt_size[0]*latt_size[1]*latt_size[2]*latt_size[3];
|
||||||
|
|
||||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||||
// GridParallelRNG pRNG(&Grid); pRNG.SeedRandomDevice();
|
// GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9});
|
||||||
|
|
||||||
LatticeColourMatrix z(&Grid); //random(pRNG,z);
|
LatticeColourMatrix z(&Grid); //random(pRNG,z);
|
||||||
LatticeColourMatrix x(&Grid); //random(pRNG,x);
|
LatticeColourMatrix x(&Grid); //random(pRNG,x);
|
||||||
@ -119,7 +119,7 @@ int main (int argc, char ** argv)
|
|||||||
int vol = latt_size[0]*latt_size[1]*latt_size[2]*latt_size[3];
|
int vol = latt_size[0]*latt_size[1]*latt_size[2]*latt_size[3];
|
||||||
|
|
||||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||||
// GridParallelRNG pRNG(&Grid); pRNG.SeedRandomDevice();
|
// GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9});
|
||||||
|
|
||||||
LatticeColourMatrix z(&Grid); //random(pRNG,z);
|
LatticeColourMatrix z(&Grid); //random(pRNG,z);
|
||||||
LatticeColourMatrix x(&Grid); //random(pRNG,x);
|
LatticeColourMatrix x(&Grid); //random(pRNG,x);
|
||||||
@ -150,7 +150,7 @@ int main (int argc, char ** argv)
|
|||||||
int vol = latt_size[0]*latt_size[1]*latt_size[2]*latt_size[3];
|
int vol = latt_size[0]*latt_size[1]*latt_size[2]*latt_size[3];
|
||||||
|
|
||||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||||
// GridParallelRNG pRNG(&Grid); pRNG.SeedRandomDevice();
|
// GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9});
|
||||||
|
|
||||||
LatticeColourMatrix z(&Grid); //random(pRNG,z);
|
LatticeColourMatrix z(&Grid); //random(pRNG,z);
|
||||||
LatticeColourMatrix x(&Grid); //random(pRNG,x);
|
LatticeColourMatrix x(&Grid); //random(pRNG,x);
|
||||||
|
@ -69,7 +69,7 @@ int main (int argc, char ** argv)
|
|||||||
std::vector<int> seeds({1,2,3,4});
|
std::vector<int> seeds({1,2,3,4});
|
||||||
GridParallelRNG pRNG(&Grid);
|
GridParallelRNG pRNG(&Grid);
|
||||||
pRNG.SeedFixedIntegers(seeds);
|
pRNG.SeedFixedIntegers(seeds);
|
||||||
// pRNG.SeedRandomDevice();
|
// pRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9});
|
||||||
|
|
||||||
LatticeFermion src (&Grid); random(pRNG,src);
|
LatticeFermion src (&Grid); random(pRNG,src);
|
||||||
LatticeFermion result(&Grid); result=zero;
|
LatticeFermion result(&Grid); result=zero;
|
||||||
|
@ -321,7 +321,7 @@ AM_CONDITIONAL(BUILD_COMMS_NONE, [ test "${comms_type}X" == "noneX" ])
|
|||||||
############### RNG selection
|
############### RNG selection
|
||||||
AC_ARG_ENABLE([rng],[AC_HELP_STRING([--enable-rng=ranlux48|mt19937|sitmo],\
|
AC_ARG_ENABLE([rng],[AC_HELP_STRING([--enable-rng=ranlux48|mt19937|sitmo],\
|
||||||
[Select Random Number Generator to be used])],\
|
[Select Random Number Generator to be used])],\
|
||||||
[ac_RNG=${enable_rng}],[ac_RNG=ranlux48])
|
[ac_RNG=${enable_rng}],[ac_RNG=sitmo])
|
||||||
|
|
||||||
case ${ac_RNG} in
|
case ${ac_RNG} in
|
||||||
ranlux48)
|
ranlux48)
|
||||||
@ -401,6 +401,7 @@ AC_CONFIG_FILES(tests/hadrons/Makefile)
|
|||||||
AC_CONFIG_FILES(tests/hmc/Makefile)
|
AC_CONFIG_FILES(tests/hmc/Makefile)
|
||||||
AC_CONFIG_FILES(tests/solver/Makefile)
|
AC_CONFIG_FILES(tests/solver/Makefile)
|
||||||
AC_CONFIG_FILES(tests/qdpxx/Makefile)
|
AC_CONFIG_FILES(tests/qdpxx/Makefile)
|
||||||
|
AC_CONFIG_FILES(tests/testu01/Makefile)
|
||||||
AC_CONFIG_FILES(benchmarks/Makefile)
|
AC_CONFIG_FILES(benchmarks/Makefile)
|
||||||
AC_CONFIG_FILES(extras/Makefile)
|
AC_CONFIG_FILES(extras/Makefile)
|
||||||
AC_CONFIG_FILES(extras/Hadrons/Makefile)
|
AC_CONFIG_FILES(extras/Hadrons/Makefile)
|
||||||
|
@ -2,10 +2,14 @@
|
|||||||
#include <Grid/Hadrons/Modules/MAction/Wilson.hpp>
|
#include <Grid/Hadrons/Modules/MAction/Wilson.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MContraction/Baryon.hpp>
|
#include <Grid/Hadrons/Modules/MContraction/Baryon.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MContraction/Meson.hpp>
|
#include <Grid/Hadrons/Modules/MContraction/Meson.hpp>
|
||||||
|
#include <Grid/Hadrons/Modules/MContraction/WeakHamiltonian.hpp>
|
||||||
|
#include <Grid/Hadrons/Modules/MContraction/WeakHamiltonianEye.hpp>
|
||||||
|
#include <Grid/Hadrons/Modules/MContraction/WeakHamiltonianNonEye.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MGauge/Load.hpp>
|
#include <Grid/Hadrons/Modules/MGauge/Load.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MGauge/Random.hpp>
|
#include <Grid/Hadrons/Modules/MGauge/Random.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MGauge/StochEm.hpp>
|
#include <Grid/Hadrons/Modules/MGauge/StochEm.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MGauge/Unit.hpp>
|
#include <Grid/Hadrons/Modules/MGauge/Unit.hpp>
|
||||||
|
#include <Grid/Hadrons/Modules/MLoop/NoiseLoop.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MScalar/ChargedProp.hpp>
|
#include <Grid/Hadrons/Modules/MScalar/ChargedProp.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MScalar/FreeProp.hpp>
|
#include <Grid/Hadrons/Modules/MScalar/FreeProp.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MScalar/Scalar.hpp>
|
#include <Grid/Hadrons/Modules/MScalar/Scalar.hpp>
|
||||||
@ -13,5 +17,6 @@
|
|||||||
#include <Grid/Hadrons/Modules/MSolver/RBPrecCG.hpp>
|
#include <Grid/Hadrons/Modules/MSolver/RBPrecCG.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MSource/Point.hpp>
|
#include <Grid/Hadrons/Modules/MSource/Point.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MSource/SeqGamma.hpp>
|
#include <Grid/Hadrons/Modules/MSource/SeqGamma.hpp>
|
||||||
|
#include <Grid/Hadrons/Modules/MSource/Wall.hpp>
|
||||||
#include <Grid/Hadrons/Modules/MSource/Z2.hpp>
|
#include <Grid/Hadrons/Modules/MSource/Z2.hpp>
|
||||||
#include <Grid/Hadrons/Modules/Quark.hpp>
|
#include <Grid/Hadrons/Modules/Quark.hpp>
|
||||||
|
@ -112,7 +112,7 @@ void TBaryon<FImpl1, FImpl2, FImpl3>::execute(void)
|
|||||||
<< " quarks '" << par().q1 << "', '" << par().q2 << "', and '"
|
<< " quarks '" << par().q1 << "', '" << par().q2 << "', and '"
|
||||||
<< par().q3 << "'" << std::endl;
|
<< par().q3 << "'" << std::endl;
|
||||||
|
|
||||||
XmlWriter writer(par().output);
|
CorrWriter writer(par().output);
|
||||||
PropagatorField1 &q1 = *env().template getObject<PropagatorField1>(par().q1);
|
PropagatorField1 &q1 = *env().template getObject<PropagatorField1>(par().q1);
|
||||||
PropagatorField2 &q2 = *env().template getObject<PropagatorField2>(par().q2);
|
PropagatorField2 &q2 = *env().template getObject<PropagatorField2>(par().q2);
|
||||||
PropagatorField3 &q3 = *env().template getObject<PropagatorField3>(par().q2);
|
PropagatorField3 &q3 = *env().template getObject<PropagatorField3>(par().q2);
|
||||||
|
@ -6,8 +6,10 @@ Source file: extras/Hadrons/Modules/MContraction/Meson.hpp
|
|||||||
|
|
||||||
Copyright (C) 2015
|
Copyright (C) 2015
|
||||||
Copyright (C) 2016
|
Copyright (C) 2016
|
||||||
|
Copyright (C) 2017
|
||||||
|
|
||||||
Author: Antonin Portelli <antonin.portelli@me.com>
|
Author: Antonin Portelli <antonin.portelli@me.com>
|
||||||
|
Andrew Lawson <andrew.lawson1991@gmail.com>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -36,20 +38,39 @@ See the full license in the file "LICENSE" in the top level distribution directo
|
|||||||
|
|
||||||
BEGIN_HADRONS_NAMESPACE
|
BEGIN_HADRONS_NAMESPACE
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
Meson contractions
|
||||||
|
-----------------------------
|
||||||
|
|
||||||
|
* options:
|
||||||
|
- q1: input propagator 1 (string)
|
||||||
|
- q2: input propagator 2 (string)
|
||||||
|
- gammas: gamma products to insert at sink & source, pairs of gamma matrices
|
||||||
|
(space-separated strings) in angled brackets (i.e. <g_sink g_src>),
|
||||||
|
in a sequence (e.g. "<Gamma5 Gamma5><Gamma5 GammaT>").
|
||||||
|
|
||||||
|
Special values: "all" - perform all possible contractions.
|
||||||
|
- mom: momentum insertion, space-separated float sequence (e.g ".1 .2 1. 0."),
|
||||||
|
given as multiples of (2*pi) / L.
|
||||||
|
*/
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TMeson *
|
* TMeson *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
BEGIN_MODULE_NAMESPACE(MContraction)
|
BEGIN_MODULE_NAMESPACE(MContraction)
|
||||||
|
|
||||||
|
typedef std::pair<Gamma::Algebra, Gamma::Algebra> GammaPair;
|
||||||
|
|
||||||
class MesonPar: Serializable
|
class MesonPar: Serializable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GRID_SERIALIZABLE_CLASS_MEMBERS(MesonPar,
|
GRID_SERIALIZABLE_CLASS_MEMBERS(MesonPar,
|
||||||
std::string, q1,
|
std::string, q1,
|
||||||
std::string, q2,
|
std::string, q2,
|
||||||
std::string, output,
|
std::string, gammas,
|
||||||
Gamma::Algebra, gammaSource,
|
std::string, mom,
|
||||||
Gamma::Algebra, gammaSink);
|
std::string, output);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename FImpl1, typename FImpl2>
|
template <typename FImpl1, typename FImpl2>
|
||||||
@ -61,7 +82,10 @@ public:
|
|||||||
class Result: Serializable
|
class Result: Serializable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GRID_SERIALIZABLE_CLASS_MEMBERS(Result, std::vector<Complex>, corr);
|
GRID_SERIALIZABLE_CLASS_MEMBERS(Result,
|
||||||
|
Gamma::Algebra, gamma_snk,
|
||||||
|
Gamma::Algebra, gamma_src,
|
||||||
|
std::vector<Complex>, corr);
|
||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
@ -71,6 +95,7 @@ public:
|
|||||||
// dependencies/products
|
// dependencies/products
|
||||||
virtual std::vector<std::string> getInput(void);
|
virtual std::vector<std::string> getInput(void);
|
||||||
virtual std::vector<std::string> getOutput(void);
|
virtual std::vector<std::string> getOutput(void);
|
||||||
|
virtual void parseGammaString(std::vector<GammaPair> &gammaList);
|
||||||
// execution
|
// execution
|
||||||
virtual void execute(void);
|
virtual void execute(void);
|
||||||
};
|
};
|
||||||
@ -103,6 +128,32 @@ std::vector<std::string> TMeson<FImpl1, FImpl2>::getOutput(void)
|
|||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename FImpl1, typename FImpl2>
|
||||||
|
void TMeson<FImpl1, FImpl2>::parseGammaString(std::vector<GammaPair> &gammaList)
|
||||||
|
{
|
||||||
|
// Determine gamma matrices to insert at source/sink.
|
||||||
|
if (par().gammas.compare("all") == 0)
|
||||||
|
{
|
||||||
|
// Do all contractions.
|
||||||
|
unsigned int n_gam = Ns * Ns;
|
||||||
|
gammaList.resize(n_gam*n_gam);
|
||||||
|
for (unsigned int i = 1; i < Gamma::nGamma; i += 2)
|
||||||
|
{
|
||||||
|
for (unsigned int j = 1; j < Gamma::nGamma; j += 2)
|
||||||
|
{
|
||||||
|
gammaList.push_back(std::make_pair((Gamma::Algebra)i,
|
||||||
|
(Gamma::Algebra)j));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Parse individual contractions from input string.
|
||||||
|
gammaList = strToVec<GammaPair>(par().gammas);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// execution ///////////////////////////////////////////////////////////////////
|
// execution ///////////////////////////////////////////////////////////////////
|
||||||
template <typename FImpl1, typename FImpl2>
|
template <typename FImpl1, typename FImpl2>
|
||||||
void TMeson<FImpl1, FImpl2>::execute(void)
|
void TMeson<FImpl1, FImpl2>::execute(void)
|
||||||
@ -111,21 +162,44 @@ void TMeson<FImpl1, FImpl2>::execute(void)
|
|||||||
<< " quarks '" << par().q1 << "' and '" << par().q2 << "'"
|
<< " quarks '" << par().q1 << "' and '" << par().q2 << "'"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
XmlWriter writer(par().output);
|
CorrWriter writer(par().output);
|
||||||
PropagatorField1 &q1 = *env().template getObject<PropagatorField1>(par().q1);
|
PropagatorField1 &q1 = *env().template getObject<PropagatorField1>(par().q1);
|
||||||
PropagatorField2 &q2 = *env().template getObject<PropagatorField2>(par().q2);
|
PropagatorField2 &q2 = *env().template getObject<PropagatorField2>(par().q2);
|
||||||
LatticeComplex c(env().getGrid());
|
LatticeComplex c(env().getGrid());
|
||||||
Gamma gSrc(par().gammaSource), gSnk(par().gammaSink);
|
Gamma g5(Gamma::Algebra::Gamma5);
|
||||||
Gamma g5(Gamma::Algebra::Gamma5);
|
std::vector<GammaPair> gammaList;
|
||||||
std::vector<TComplex> buf;
|
std::vector<TComplex> buf;
|
||||||
Result result;
|
std::vector<Result> result;
|
||||||
|
std::vector<Real> p;
|
||||||
c = trace(gSnk*q1*adj(gSrc)*g5*adj(q2)*g5);
|
|
||||||
sliceSum(c, buf, Tp);
|
p = strToVec<Real>(par().mom);
|
||||||
result.corr.resize(buf.size());
|
LatticeComplex ph(env().getGrid()), coor(env().getGrid());
|
||||||
for (unsigned int t = 0; t < buf.size(); ++t)
|
Complex i(0.0,1.0);
|
||||||
|
ph = zero;
|
||||||
|
for(unsigned int mu = 0; mu < env().getNd(); mu++)
|
||||||
{
|
{
|
||||||
result.corr[t] = TensorRemove(buf[t]);
|
LatticeCoordinate(coor, mu);
|
||||||
|
ph = ph + p[mu]*coor*((1./(env().getGrid()->_fdimensions[mu])));
|
||||||
|
}
|
||||||
|
ph = exp((Real)(2*M_PI)*i*ph);
|
||||||
|
|
||||||
|
parseGammaString(gammaList);
|
||||||
|
|
||||||
|
result.resize(gammaList.size());
|
||||||
|
for (unsigned int i = 0; i < result.size(); ++i)
|
||||||
|
{
|
||||||
|
Gamma gSnk(gammaList[i].first);
|
||||||
|
Gamma gSrc(gammaList[i].second);
|
||||||
|
c = trace((g5*gSnk)*q1*(adj(gSrc)*g5)*adj(q2))*ph;
|
||||||
|
sliceSum(c, buf, Tp);
|
||||||
|
|
||||||
|
result[i].gamma_snk = gammaList[i].first;
|
||||||
|
result[i].gamma_src = gammaList[i].second;
|
||||||
|
result[i].corr.resize(buf.size());
|
||||||
|
for (unsigned int t = 0; t < buf.size(); ++t)
|
||||||
|
{
|
||||||
|
result[i].corr[t] = TensorRemove(buf[t]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
write(writer, "meson", result);
|
write(writer, "meson", result);
|
||||||
}
|
}
|
||||||
|
86
extras/Hadrons/Modules/MContraction/WeakHamiltonian.hpp
Normal file
86
extras/Hadrons/Modules/MContraction/WeakHamiltonian.hpp
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
/*************************************************************************************
|
||||||
|
|
||||||
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
|
Source file: extras/Hadrons/Modules/MContraction/WeakHamiltonian.hpp
|
||||||
|
|
||||||
|
Copyright (C) 2017
|
||||||
|
|
||||||
|
Author: Andrew Lawson <andrew.lawson1991@gmail.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 */
|
||||||
|
|
||||||
|
#ifndef Hadrons_WeakHamiltonian_hpp_
|
||||||
|
#define Hadrons_WeakHamiltonian_hpp_
|
||||||
|
|
||||||
|
#include <Grid/Hadrons/Global.hpp>
|
||||||
|
#include <Grid/Hadrons/Module.hpp>
|
||||||
|
#include <Grid/Hadrons/ModuleFactory.hpp>
|
||||||
|
|
||||||
|
BEGIN_HADRONS_NAMESPACE
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* WeakHamiltonian *
|
||||||
|
******************************************************************************/
|
||||||
|
BEGIN_MODULE_NAMESPACE(MContraction)
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
* Utilities for contractions involving the Weak Hamiltonian.
|
||||||
|
******************************************************************************/
|
||||||
|
//// Sum and store correlator.
|
||||||
|
#define MAKE_DIAG(exp, buf, res, n)\
|
||||||
|
sliceSum(exp, buf, Tp);\
|
||||||
|
res.name = (n);\
|
||||||
|
res.corr.resize(buf.size());\
|
||||||
|
for (unsigned int t = 0; t < buf.size(); ++t)\
|
||||||
|
{\
|
||||||
|
res.corr[t] = TensorRemove(buf[t]);\
|
||||||
|
}
|
||||||
|
|
||||||
|
//// Contraction of mu index: use 'mu' variable in exp.
|
||||||
|
#define SUM_MU(buf,exp)\
|
||||||
|
buf = zero;\
|
||||||
|
for (unsigned int mu = 0; mu < ndim; ++mu)\
|
||||||
|
{\
|
||||||
|
buf += exp;\
|
||||||
|
}
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
i_V = 0,
|
||||||
|
i_A = 1,
|
||||||
|
n_i = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
class WeakHamiltonianPar: Serializable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GRID_SERIALIZABLE_CLASS_MEMBERS(WeakHamiltonianPar,
|
||||||
|
std::string, q1,
|
||||||
|
std::string, q2,
|
||||||
|
std::string, q3,
|
||||||
|
std::string, q4,
|
||||||
|
std::string, output);
|
||||||
|
};
|
||||||
|
|
||||||
|
END_MODULE_NAMESPACE
|
||||||
|
|
||||||
|
END_HADRONS_NAMESPACE
|
||||||
|
|
||||||
|
#endif // Hadrons_WeakHamiltonian_hpp_
|
137
extras/Hadrons/Modules/MContraction/WeakHamiltonianEye.cc
Normal file
137
extras/Hadrons/Modules/MContraction/WeakHamiltonianEye.cc
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
/*************************************************************************************
|
||||||
|
|
||||||
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
|
Source file: extras/Hadrons/Modules/MContraction/WeakHamiltonianEye.cc
|
||||||
|
|
||||||
|
Copyright (C) 2017
|
||||||
|
|
||||||
|
Author: Andrew Lawson <andrew.lawson1991@gmail.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 <Grid/Hadrons/Modules/MContraction/WeakHamiltonianEye.hpp>
|
||||||
|
|
||||||
|
using namespace Grid;
|
||||||
|
using namespace Hadrons;
|
||||||
|
using namespace MContraction;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Weak Hamiltonian current-current contractions, Eye-type.
|
||||||
|
*
|
||||||
|
* These contractions are generated by the Q1 and Q2 operators in the physical
|
||||||
|
* basis (see e.g. Fig 3 of arXiv:1507.03094).
|
||||||
|
*
|
||||||
|
* Schematics: q4 |
|
||||||
|
* /-<-¬ |
|
||||||
|
* / \ | q2 q3
|
||||||
|
* \ / | /----<------*------<----¬
|
||||||
|
* q2 \ / q3 | / /-*-¬ \
|
||||||
|
* /-----<-----* *-----<----¬ | / / \ \
|
||||||
|
* i * H_W * f | i * \ / q4 * f
|
||||||
|
* \ / | \ \->-/ /
|
||||||
|
* \ / | \ /
|
||||||
|
* \---------->---------/ | \----------->----------/
|
||||||
|
* q1 | q1
|
||||||
|
* |
|
||||||
|
* Saucer (S) | Eye (E)
|
||||||
|
*
|
||||||
|
* S: trace(q3*g5*q1*adj(q2)*g5*gL[mu][p_1]*q4*gL[mu][p_2])
|
||||||
|
* E: trace(q3*g5*q1*adj(q2)*g5*gL[mu][p_1])*trace(q4*gL[mu][p_2])
|
||||||
|
*/
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* TWeakHamiltonianEye implementation *
|
||||||
|
******************************************************************************/
|
||||||
|
// constructor /////////////////////////////////////////////////////////////////
|
||||||
|
TWeakHamiltonianEye::TWeakHamiltonianEye(const std::string name)
|
||||||
|
: Module<WeakHamiltonianPar>(name)
|
||||||
|
{}
|
||||||
|
|
||||||
|
// dependencies/products ///////////////////////////////////////////////////////
|
||||||
|
std::vector<std::string> TWeakHamiltonianEye::getInput(void)
|
||||||
|
{
|
||||||
|
std::vector<std::string> in = {par().q1, par().q2, par().q3, par().q4};
|
||||||
|
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> TWeakHamiltonianEye::getOutput(void)
|
||||||
|
{
|
||||||
|
std::vector<std::string> out = {getName()};
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
// setup ///////////////////////////////////////////////////////////////////////
|
||||||
|
void TWeakHamiltonianEye::setup(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// execution ///////////////////////////////////////////////////////////////////
|
||||||
|
void TWeakHamiltonianEye::execute(void)
|
||||||
|
{
|
||||||
|
LOG(Message) << "Computing Weak Hamiltonian (Eye type) contractions '"
|
||||||
|
<< getName() << "' using quarks '" << par().q1 << "', '"
|
||||||
|
<< par().q2 << ", '" << par().q3 << "' and '" << par().q4
|
||||||
|
<< "'." << std::endl;
|
||||||
|
|
||||||
|
CorrWriter writer(par().output);
|
||||||
|
PropagatorField &q1 = *env().template getObject<PropagatorField>(par().q1);
|
||||||
|
PropagatorField &q2 = *env().template getObject<PropagatorField>(par().q2);
|
||||||
|
PropagatorField &q3 = *env().template getObject<PropagatorField>(par().q3);
|
||||||
|
PropagatorField &q4 = *env().template getObject<PropagatorField>(par().q4);
|
||||||
|
Gamma g5 = Gamma(Gamma::Algebra::Gamma5);
|
||||||
|
LatticeComplex expbuf(env().getGrid());
|
||||||
|
std::vector<TComplex> corrbuf;
|
||||||
|
std::vector<Result> result(n_eye_diag);
|
||||||
|
unsigned int ndim = env().getNd();
|
||||||
|
|
||||||
|
PropagatorField tmp1(env().getGrid());
|
||||||
|
LatticeComplex tmp2(env().getGrid());
|
||||||
|
std::vector<PropagatorField> S_body(ndim, tmp1);
|
||||||
|
std::vector<PropagatorField> S_loop(ndim, tmp1);
|
||||||
|
std::vector<LatticeComplex> E_body(ndim, tmp2);
|
||||||
|
std::vector<LatticeComplex> E_loop(ndim, tmp2);
|
||||||
|
|
||||||
|
// Setup for S-type contractions.
|
||||||
|
for (int mu = 0; mu < ndim; ++mu)
|
||||||
|
{
|
||||||
|
S_body[mu] = MAKE_SE_BODY(q1, q2, q3, GammaL(Gamma::gmu[mu]));
|
||||||
|
S_loop[mu] = MAKE_SE_LOOP(q4, GammaL(Gamma::gmu[mu]));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perform S-type contractions.
|
||||||
|
SUM_MU(expbuf, trace(S_body[mu]*S_loop[mu]))
|
||||||
|
MAKE_DIAG(expbuf, corrbuf, result[S_diag], "HW_S")
|
||||||
|
|
||||||
|
// Recycle sub-expressions for E-type contractions.
|
||||||
|
for (unsigned int mu = 0; mu < ndim; ++mu)
|
||||||
|
{
|
||||||
|
E_body[mu] = trace(S_body[mu]);
|
||||||
|
E_loop[mu] = trace(S_loop[mu]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perform E-type contractions.
|
||||||
|
SUM_MU(expbuf, E_body[mu]*E_loop[mu])
|
||||||
|
MAKE_DIAG(expbuf, corrbuf, result[E_diag], "HW_E")
|
||||||
|
|
||||||
|
write(writer, "HW_Eye", result);
|
||||||
|
}
|
83
extras/Hadrons/Modules/MContraction/WeakHamiltonianEye.hpp
Normal file
83
extras/Hadrons/Modules/MContraction/WeakHamiltonianEye.hpp
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
/*************************************************************************************
|
||||||
|
|
||||||
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
|
Source file: extras/Hadrons/Modules/MContraction/WeakHamiltonianEye.hpp
|
||||||
|
|
||||||
|
Copyright (C) 2017
|
||||||
|
|
||||||
|
Author: Andrew Lawson <andrew.lawson1991@gmail.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 */
|
||||||
|
|
||||||
|
#ifndef Hadrons_WeakHamiltonianEye_hpp_
|
||||||
|
#define Hadrons_WeakHamiltonianEye_hpp_
|
||||||
|
|
||||||
|
#include <Grid/Hadrons/Modules/MContraction/WeakHamiltonian.hpp>
|
||||||
|
|
||||||
|
BEGIN_HADRONS_NAMESPACE
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* WeakHamiltonianEye *
|
||||||
|
******************************************************************************/
|
||||||
|
BEGIN_MODULE_NAMESPACE(MContraction)
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
S_diag = 0,
|
||||||
|
E_diag = 1,
|
||||||
|
n_eye_diag = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
// Saucer and Eye subdiagram contractions.
|
||||||
|
#define MAKE_SE_BODY(Q_1, Q_2, Q_3, gamma) (Q_3*g5*Q_1*adj(Q_2)*g5*gamma)
|
||||||
|
#define MAKE_SE_LOOP(Q_loop, gamma) (Q_loop*gamma)
|
||||||
|
|
||||||
|
class TWeakHamiltonianEye: public Module<WeakHamiltonianPar>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TYPE_ALIASES(FIMPL,)
|
||||||
|
class Result: Serializable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GRID_SERIALIZABLE_CLASS_MEMBERS(Result,
|
||||||
|
std::string, name,
|
||||||
|
std::vector<Complex>, corr);
|
||||||
|
};
|
||||||
|
public:
|
||||||
|
// constructor
|
||||||
|
TWeakHamiltonianEye(const std::string name);
|
||||||
|
// destructor
|
||||||
|
virtual ~TWeakHamiltonianEye(void) = default;
|
||||||
|
// dependency relation
|
||||||
|
virtual std::vector<std::string> getInput(void);
|
||||||
|
virtual std::vector<std::string> getOutput(void);
|
||||||
|
// setup
|
||||||
|
virtual void setup(void);
|
||||||
|
// execution
|
||||||
|
virtual void execute(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
MODULE_REGISTER_NS(WeakHamiltonianEye, TWeakHamiltonianEye, MContraction);
|
||||||
|
|
||||||
|
END_MODULE_NAMESPACE
|
||||||
|
|
||||||
|
END_HADRONS_NAMESPACE
|
||||||
|
|
||||||
|
#endif // Hadrons_WeakHamiltonianEye_hpp_
|
139
extras/Hadrons/Modules/MContraction/WeakHamiltonianNonEye.cc
Normal file
139
extras/Hadrons/Modules/MContraction/WeakHamiltonianNonEye.cc
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
/*************************************************************************************
|
||||||
|
|
||||||
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
|
Source file: extras/Hadrons/Modules/MContraction/WeakHamiltonianNonEye.cc
|
||||||
|
|
||||||
|
Copyright (C) 2017
|
||||||
|
|
||||||
|
Author: Andrew Lawson <andrew.lawson1991@gmail.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 <Grid/Hadrons/Modules/MContraction/WeakHamiltonianNonEye.hpp>
|
||||||
|
|
||||||
|
using namespace Grid;
|
||||||
|
using namespace Hadrons;
|
||||||
|
using namespace MContraction;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Weak Hamiltonian current-current contractions, Non-Eye-type.
|
||||||
|
*
|
||||||
|
* These contractions are generated by the Q1 and Q2 operators in the physical
|
||||||
|
* basis (see e.g. Fig 3 of arXiv:1507.03094).
|
||||||
|
*
|
||||||
|
* Schematic:
|
||||||
|
* q2 q3 | q2 q3
|
||||||
|
* /--<--¬ /--<--¬ | /--<--¬ /--<--¬
|
||||||
|
* / \ / \ | / \ / \
|
||||||
|
* / \ / \ | / \ / \
|
||||||
|
* / \ / \ | / \ / \
|
||||||
|
* i * * H_W * f | i * * * H_W * f
|
||||||
|
* \ * | | \ / \ /
|
||||||
|
* \ / \ / | \ / \ /
|
||||||
|
* \ / \ / | \ / \ /
|
||||||
|
* \ / \ / | \-->--/ \-->--/
|
||||||
|
* \-->--/ \-->--/ | q1 q4
|
||||||
|
* q1 q4 |
|
||||||
|
* Connected (C) | Wing (W)
|
||||||
|
*
|
||||||
|
* C: trace(q1*adj(q2)*g5*gL[mu]*q3*adj(q4)*g5*gL[mu])
|
||||||
|
* W: trace(q1*adj(q2)*g5*gL[mu])*trace(q3*adj(q4)*g5*gL[mu])
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* TWeakHamiltonianNonEye implementation *
|
||||||
|
******************************************************************************/
|
||||||
|
// constructor /////////////////////////////////////////////////////////////////
|
||||||
|
TWeakHamiltonianNonEye::TWeakHamiltonianNonEye(const std::string name)
|
||||||
|
: Module<WeakHamiltonianPar>(name)
|
||||||
|
{}
|
||||||
|
|
||||||
|
// dependencies/products ///////////////////////////////////////////////////////
|
||||||
|
std::vector<std::string> TWeakHamiltonianNonEye::getInput(void)
|
||||||
|
{
|
||||||
|
std::vector<std::string> in = {par().q1, par().q2, par().q3, par().q4};
|
||||||
|
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> TWeakHamiltonianNonEye::getOutput(void)
|
||||||
|
{
|
||||||
|
std::vector<std::string> out = {getName()};
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
// setup ///////////////////////////////////////////////////////////////////////
|
||||||
|
void TWeakHamiltonianNonEye::setup(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// execution ///////////////////////////////////////////////////////////////////
|
||||||
|
void TWeakHamiltonianNonEye::execute(void)
|
||||||
|
{
|
||||||
|
LOG(Message) << "Computing Weak Hamiltonian (Non-Eye type) contractions '"
|
||||||
|
<< getName() << "' using quarks '" << par().q1 << "', '"
|
||||||
|
<< par().q2 << ", '" << par().q3 << "' and '" << par().q4
|
||||||
|
<< "'." << std::endl;
|
||||||
|
|
||||||
|
CorrWriter writer(par().output);
|
||||||
|
PropagatorField &q1 = *env().template getObject<PropagatorField>(par().q1);
|
||||||
|
PropagatorField &q2 = *env().template getObject<PropagatorField>(par().q2);
|
||||||
|
PropagatorField &q3 = *env().template getObject<PropagatorField>(par().q3);
|
||||||
|
PropagatorField &q4 = *env().template getObject<PropagatorField>(par().q4);
|
||||||
|
Gamma g5 = Gamma(Gamma::Algebra::Gamma5);
|
||||||
|
LatticeComplex expbuf(env().getGrid());
|
||||||
|
std::vector<TComplex> corrbuf;
|
||||||
|
std::vector<Result> result(n_noneye_diag);
|
||||||
|
unsigned int ndim = env().getNd();
|
||||||
|
|
||||||
|
PropagatorField tmp1(env().getGrid());
|
||||||
|
LatticeComplex tmp2(env().getGrid());
|
||||||
|
std::vector<PropagatorField> C_i_side_loop(ndim, tmp1);
|
||||||
|
std::vector<PropagatorField> C_f_side_loop(ndim, tmp1);
|
||||||
|
std::vector<LatticeComplex> W_i_side_loop(ndim, tmp2);
|
||||||
|
std::vector<LatticeComplex> W_f_side_loop(ndim, tmp2);
|
||||||
|
|
||||||
|
// Setup for C-type contractions.
|
||||||
|
for (int mu = 0; mu < ndim; ++mu)
|
||||||
|
{
|
||||||
|
C_i_side_loop[mu] = MAKE_CW_SUBDIAG(q1, q2, GammaL(Gamma::gmu[mu]));
|
||||||
|
C_f_side_loop[mu] = MAKE_CW_SUBDIAG(q3, q4, GammaL(Gamma::gmu[mu]));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perform C-type contractions.
|
||||||
|
SUM_MU(expbuf, trace(C_i_side_loop[mu]*C_f_side_loop[mu]))
|
||||||
|
MAKE_DIAG(expbuf, corrbuf, result[C_diag], "HW_C")
|
||||||
|
|
||||||
|
// Recycle sub-expressions for W-type contractions.
|
||||||
|
for (unsigned int mu = 0; mu < ndim; ++mu)
|
||||||
|
{
|
||||||
|
W_i_side_loop[mu] = trace(C_i_side_loop[mu]);
|
||||||
|
W_f_side_loop[mu] = trace(C_f_side_loop[mu]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perform W-type contractions.
|
||||||
|
SUM_MU(expbuf, W_i_side_loop[mu]*W_f_side_loop[mu])
|
||||||
|
MAKE_DIAG(expbuf, corrbuf, result[W_diag], "HW_W")
|
||||||
|
|
||||||
|
write(writer, "HW_NonEye", result);
|
||||||
|
}
|
@ -0,0 +1,82 @@
|
|||||||
|
/*************************************************************************************
|
||||||
|
|
||||||
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
|
Source file: extras/Hadrons/Modules/MContraction/WeakHamiltonianNonEye.hpp
|
||||||
|
|
||||||
|
Copyright (C) 2017
|
||||||
|
|
||||||
|
Author: Andrew Lawson <andrew.lawson1991@gmail.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 */
|
||||||
|
|
||||||
|
#ifndef Hadrons_WeakHamiltonianNonEye_hpp_
|
||||||
|
#define Hadrons_WeakHamiltonianNonEye_hpp_
|
||||||
|
|
||||||
|
#include <Grid/Hadrons/Modules/MContraction/WeakHamiltonian.hpp>
|
||||||
|
|
||||||
|
BEGIN_HADRONS_NAMESPACE
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* WeakHamiltonianNonEye *
|
||||||
|
******************************************************************************/
|
||||||
|
BEGIN_MODULE_NAMESPACE(MContraction)
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
W_diag = 0,
|
||||||
|
C_diag = 1,
|
||||||
|
n_noneye_diag = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
// Wing and Connected subdiagram contractions
|
||||||
|
#define MAKE_CW_SUBDIAG(Q_1, Q_2, gamma) (Q_1*adj(Q_2)*g5*gamma)
|
||||||
|
|
||||||
|
class TWeakHamiltonianNonEye: public Module<WeakHamiltonianPar>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TYPE_ALIASES(FIMPL,)
|
||||||
|
class Result: Serializable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GRID_SERIALIZABLE_CLASS_MEMBERS(Result,
|
||||||
|
std::string, name,
|
||||||
|
std::vector<Complex>, corr);
|
||||||
|
};
|
||||||
|
public:
|
||||||
|
// constructor
|
||||||
|
TWeakHamiltonianNonEye(const std::string name);
|
||||||
|
// destructor
|
||||||
|
virtual ~TWeakHamiltonianNonEye(void) = default;
|
||||||
|
// dependency relation
|
||||||
|
virtual std::vector<std::string> getInput(void);
|
||||||
|
virtual std::vector<std::string> getOutput(void);
|
||||||
|
// setup
|
||||||
|
virtual void setup(void);
|
||||||
|
// execution
|
||||||
|
virtual void execute(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
MODULE_REGISTER_NS(WeakHamiltonianNonEye, TWeakHamiltonianNonEye, MContraction);
|
||||||
|
|
||||||
|
END_MODULE_NAMESPACE
|
||||||
|
|
||||||
|
END_HADRONS_NAMESPACE
|
||||||
|
|
||||||
|
#endif // Hadrons_WeakHamiltonianNonEye_hpp_
|
132
extras/Hadrons/Modules/MLoop/NoiseLoop.hpp
Normal file
132
extras/Hadrons/Modules/MLoop/NoiseLoop.hpp
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
/*************************************************************************************
|
||||||
|
|
||||||
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
|
Source file: extras/Hadrons/Modules/MLoop/NoiseLoop.hpp
|
||||||
|
|
||||||
|
Copyright (C) 2016
|
||||||
|
|
||||||
|
Author: Andrew Lawson <andrew.lawson1991@gmail.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 */
|
||||||
|
|
||||||
|
#ifndef Hadrons_NoiseLoop_hpp_
|
||||||
|
#define Hadrons_NoiseLoop_hpp_
|
||||||
|
|
||||||
|
#include <Grid/Hadrons/Global.hpp>
|
||||||
|
#include <Grid/Hadrons/Module.hpp>
|
||||||
|
#include <Grid/Hadrons/ModuleFactory.hpp>
|
||||||
|
|
||||||
|
BEGIN_HADRONS_NAMESPACE
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
Noise loop propagator
|
||||||
|
-----------------------------
|
||||||
|
* loop_x = q_x * adj(eta_x)
|
||||||
|
|
||||||
|
* options:
|
||||||
|
- q = Result of inversion on noise source.
|
||||||
|
- eta = noise source.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* NoiseLoop *
|
||||||
|
******************************************************************************/
|
||||||
|
BEGIN_MODULE_NAMESPACE(MLoop)
|
||||||
|
|
||||||
|
class NoiseLoopPar: Serializable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GRID_SERIALIZABLE_CLASS_MEMBERS(NoiseLoopPar,
|
||||||
|
std::string, q,
|
||||||
|
std::string, eta);
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename FImpl>
|
||||||
|
class TNoiseLoop: public Module<NoiseLoopPar>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TYPE_ALIASES(FImpl,);
|
||||||
|
public:
|
||||||
|
// constructor
|
||||||
|
TNoiseLoop(const std::string name);
|
||||||
|
// destructor
|
||||||
|
virtual ~TNoiseLoop(void) = default;
|
||||||
|
// dependency relation
|
||||||
|
virtual std::vector<std::string> getInput(void);
|
||||||
|
virtual std::vector<std::string> getOutput(void);
|
||||||
|
// setup
|
||||||
|
virtual void setup(void);
|
||||||
|
// execution
|
||||||
|
virtual void execute(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
MODULE_REGISTER_NS(NoiseLoop, TNoiseLoop<FIMPL>, MLoop);
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* TNoiseLoop implementation *
|
||||||
|
******************************************************************************/
|
||||||
|
// constructor /////////////////////////////////////////////////////////////////
|
||||||
|
template <typename FImpl>
|
||||||
|
TNoiseLoop<FImpl>::TNoiseLoop(const std::string name)
|
||||||
|
: Module<NoiseLoopPar>(name)
|
||||||
|
{}
|
||||||
|
|
||||||
|
// dependencies/products ///////////////////////////////////////////////////////
|
||||||
|
template <typename FImpl>
|
||||||
|
std::vector<std::string> TNoiseLoop<FImpl>::getInput(void)
|
||||||
|
{
|
||||||
|
std::vector<std::string> in = {par().q, par().eta};
|
||||||
|
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FImpl>
|
||||||
|
std::vector<std::string> TNoiseLoop<FImpl>::getOutput(void)
|
||||||
|
{
|
||||||
|
std::vector<std::string> out = {getName()};
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
// setup ///////////////////////////////////////////////////////////////////////
|
||||||
|
template <typename FImpl>
|
||||||
|
void TNoiseLoop<FImpl>::setup(void)
|
||||||
|
{
|
||||||
|
env().template registerLattice<PropagatorField>(getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
// execution ///////////////////////////////////////////////////////////////////
|
||||||
|
template <typename FImpl>
|
||||||
|
void TNoiseLoop<FImpl>::execute(void)
|
||||||
|
{
|
||||||
|
PropagatorField &loop = *env().template createLattice<PropagatorField>(getName());
|
||||||
|
PropagatorField &q = *env().template getObject<PropagatorField>(par().q);
|
||||||
|
PropagatorField &eta = *env().template getObject<PropagatorField>(par().eta);
|
||||||
|
loop = q*adj(eta);
|
||||||
|
}
|
||||||
|
|
||||||
|
END_MODULE_NAMESPACE
|
||||||
|
|
||||||
|
END_HADRONS_NAMESPACE
|
||||||
|
|
||||||
|
#endif // Hadrons_NoiseLoop_hpp_
|
@ -6,6 +6,7 @@ Source file: extras/Hadrons/Modules/MSource/SeqGamma.hpp
|
|||||||
|
|
||||||
Copyright (C) 2015
|
Copyright (C) 2015
|
||||||
Copyright (C) 2016
|
Copyright (C) 2016
|
||||||
|
Copyright (C) 2017
|
||||||
|
|
||||||
Author: Antonin Portelli <antonin.portelli@me.com>
|
Author: Antonin Portelli <antonin.portelli@me.com>
|
||||||
|
|
||||||
@ -149,9 +150,9 @@ void TSeqGamma<FImpl>::execute(void)
|
|||||||
for(unsigned int mu = 0; mu < env().getNd(); mu++)
|
for(unsigned int mu = 0; mu < env().getNd(); mu++)
|
||||||
{
|
{
|
||||||
LatticeCoordinate(coor, mu);
|
LatticeCoordinate(coor, mu);
|
||||||
ph = ph + p[mu]*coor;
|
ph = ph + p[mu]*coor*((1./(env().getGrid()->_fdimensions[mu])));
|
||||||
}
|
}
|
||||||
ph = exp(i*ph);
|
ph = exp((Real)(2*M_PI)*i*ph);
|
||||||
LatticeCoordinate(t, Tp);
|
LatticeCoordinate(t, Tp);
|
||||||
src = where((t >= par().tA) and (t <= par().tB), ph*(g*q), 0.*q);
|
src = where((t >= par().tA) and (t <= par().tB), ph*(g*q), 0.*q);
|
||||||
}
|
}
|
||||||
|
147
extras/Hadrons/Modules/MSource/Wall.hpp
Normal file
147
extras/Hadrons/Modules/MSource/Wall.hpp
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
/*************************************************************************************
|
||||||
|
|
||||||
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
|
Source file: extras/Hadrons/Modules/MSource/Wall.hpp
|
||||||
|
|
||||||
|
Copyright (C) 2017
|
||||||
|
|
||||||
|
Author: Andrew Lawson <andrew.lawson1991@gmail.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 */
|
||||||
|
|
||||||
|
#ifndef Hadrons_WallSource_hpp_
|
||||||
|
#define Hadrons_WallSource_hpp_
|
||||||
|
|
||||||
|
#include <Grid/Hadrons/Global.hpp>
|
||||||
|
#include <Grid/Hadrons/Module.hpp>
|
||||||
|
#include <Grid/Hadrons/ModuleFactory.hpp>
|
||||||
|
|
||||||
|
BEGIN_HADRONS_NAMESPACE
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
Wall source
|
||||||
|
-----------------------------
|
||||||
|
* src_x = delta(x_3 - tW) * exp(i x.mom)
|
||||||
|
|
||||||
|
* options:
|
||||||
|
- tW: source timeslice (integer)
|
||||||
|
- mom: momentum insertion, space-separated float sequence (e.g ".1 .2 1. 0.")
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* Wall *
|
||||||
|
******************************************************************************/
|
||||||
|
BEGIN_MODULE_NAMESPACE(MSource)
|
||||||
|
|
||||||
|
class WallPar: Serializable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GRID_SERIALIZABLE_CLASS_MEMBERS(WallPar,
|
||||||
|
unsigned int, tW,
|
||||||
|
std::string, mom);
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename FImpl>
|
||||||
|
class TWall: public Module<WallPar>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TYPE_ALIASES(FImpl,);
|
||||||
|
public:
|
||||||
|
// constructor
|
||||||
|
TWall(const std::string name);
|
||||||
|
// destructor
|
||||||
|
virtual ~TWall(void) = default;
|
||||||
|
// dependency relation
|
||||||
|
virtual std::vector<std::string> getInput(void);
|
||||||
|
virtual std::vector<std::string> getOutput(void);
|
||||||
|
// setup
|
||||||
|
virtual void setup(void);
|
||||||
|
// execution
|
||||||
|
virtual void execute(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
MODULE_REGISTER_NS(Wall, TWall<FIMPL>, MSource);
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* TWall implementation *
|
||||||
|
******************************************************************************/
|
||||||
|
// constructor /////////////////////////////////////////////////////////////////
|
||||||
|
template <typename FImpl>
|
||||||
|
TWall<FImpl>::TWall(const std::string name)
|
||||||
|
: Module<WallPar>(name)
|
||||||
|
{}
|
||||||
|
|
||||||
|
// dependencies/products ///////////////////////////////////////////////////////
|
||||||
|
template <typename FImpl>
|
||||||
|
std::vector<std::string> TWall<FImpl>::getInput(void)
|
||||||
|
{
|
||||||
|
std::vector<std::string> in;
|
||||||
|
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FImpl>
|
||||||
|
std::vector<std::string> TWall<FImpl>::getOutput(void)
|
||||||
|
{
|
||||||
|
std::vector<std::string> out = {getName()};
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
// setup ///////////////////////////////////////////////////////////////////////
|
||||||
|
template <typename FImpl>
|
||||||
|
void TWall<FImpl>::setup(void)
|
||||||
|
{
|
||||||
|
env().template registerLattice<PropagatorField>(getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
// execution ///////////////////////////////////////////////////////////////////
|
||||||
|
template <typename FImpl>
|
||||||
|
void TWall<FImpl>::execute(void)
|
||||||
|
{
|
||||||
|
LOG(Message) << "Generating wall source at t = " << par().tW
|
||||||
|
<< " with momentum " << par().mom << std::endl;
|
||||||
|
|
||||||
|
PropagatorField &src = *env().template createLattice<PropagatorField>(getName());
|
||||||
|
Lattice<iScalar<vInteger>> t(env().getGrid());
|
||||||
|
LatticeComplex ph(env().getGrid()), coor(env().getGrid());
|
||||||
|
std::vector<Real> p;
|
||||||
|
Complex i(0.0,1.0);
|
||||||
|
|
||||||
|
p = strToVec<Real>(par().mom);
|
||||||
|
ph = zero;
|
||||||
|
for(unsigned int mu = 0; mu < Nd; mu++)
|
||||||
|
{
|
||||||
|
LatticeCoordinate(coor, mu);
|
||||||
|
ph = ph + p[mu]*coor*((1./(env().getGrid()->_fdimensions[mu])));
|
||||||
|
}
|
||||||
|
ph = exp((Real)(2*M_PI)*i*ph);
|
||||||
|
LatticeCoordinate(t, Tp);
|
||||||
|
src = 1.;
|
||||||
|
src = where((t == par().tW), src*ph, 0.*src);
|
||||||
|
}
|
||||||
|
|
||||||
|
END_MODULE_NAMESPACE
|
||||||
|
|
||||||
|
END_HADRONS_NAMESPACE
|
||||||
|
|
||||||
|
#endif // Hadrons_WallSource_hpp_
|
@ -1,4 +1,6 @@
|
|||||||
modules_cc =\
|
modules_cc =\
|
||||||
|
Modules/MContraction/WeakHamiltonianEye.cc \
|
||||||
|
Modules/MContraction/WeakHamiltonianNonEye.cc \
|
||||||
Modules/MGauge/Load.cc \
|
Modules/MGauge/Load.cc \
|
||||||
Modules/MGauge/Random.cc \
|
Modules/MGauge/Random.cc \
|
||||||
Modules/MGauge/StochEm.cc \
|
Modules/MGauge/StochEm.cc \
|
||||||
@ -12,10 +14,14 @@ modules_hpp =\
|
|||||||
Modules/MAction/Wilson.hpp \
|
Modules/MAction/Wilson.hpp \
|
||||||
Modules/MContraction/Baryon.hpp \
|
Modules/MContraction/Baryon.hpp \
|
||||||
Modules/MContraction/Meson.hpp \
|
Modules/MContraction/Meson.hpp \
|
||||||
|
Modules/MContraction/WeakHamiltonian.hpp \
|
||||||
|
Modules/MContraction/WeakHamiltonianEye.hpp \
|
||||||
|
Modules/MContraction/WeakHamiltonianNonEye.hpp \
|
||||||
Modules/MGauge/Load.hpp \
|
Modules/MGauge/Load.hpp \
|
||||||
Modules/MGauge/Random.hpp \
|
Modules/MGauge/Random.hpp \
|
||||||
Modules/MGauge/StochEm.hpp \
|
Modules/MGauge/StochEm.hpp \
|
||||||
Modules/MGauge/Unit.hpp \
|
Modules/MGauge/Unit.hpp \
|
||||||
|
Modules/MLoop/NoiseLoop.hpp \
|
||||||
Modules/MScalar/ChargedProp.hpp \
|
Modules/MScalar/ChargedProp.hpp \
|
||||||
Modules/MScalar/FreeProp.hpp \
|
Modules/MScalar/FreeProp.hpp \
|
||||||
Modules/MScalar/Scalar.hpp \
|
Modules/MScalar/Scalar.hpp \
|
||||||
@ -23,6 +29,7 @@ modules_hpp =\
|
|||||||
Modules/MSolver/RBPrecCG.hpp \
|
Modules/MSolver/RBPrecCG.hpp \
|
||||||
Modules/MSource/Point.hpp \
|
Modules/MSource/Point.hpp \
|
||||||
Modules/MSource/SeqGamma.hpp \
|
Modules/MSource/SeqGamma.hpp \
|
||||||
|
Modules/MSource/Wall.hpp \
|
||||||
Modules/MSource/Z2.hpp \
|
Modules/MSource/Z2.hpp \
|
||||||
Modules/Quark.hpp
|
Modules/Quark.hpp
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
SUBDIRS = Hadrons qed-fvol
|
SUBDIRS = Hadrons
|
@ -425,7 +425,7 @@ namespace Grid {
|
|||||||
A[p]=zero;
|
A[p]=zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
GridParallelRNG RNG(Grid()); RNG.SeedRandomDevice();
|
GridParallelRNG RNG(Grid()); RNG.SeedFixedIntegers(std::vector<int>({55,72,19,17,34}));
|
||||||
Lattice<iScalar<CComplex> > val(Grid()); random(RNG,val);
|
Lattice<iScalar<CComplex> > val(Grid()); random(RNG,val);
|
||||||
|
|
||||||
Complex one(1.0);
|
Complex one(1.0);
|
||||||
|
@ -177,9 +177,11 @@ public:
|
|||||||
// Global addressing
|
// Global addressing
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
void GlobalIndexToGlobalCoor(int gidx,std::vector<int> &gcoor){
|
void GlobalIndexToGlobalCoor(int gidx,std::vector<int> &gcoor){
|
||||||
|
assert(gidx< gSites());
|
||||||
Lexicographic::CoorFromIndex(gcoor,gidx,_gdimensions);
|
Lexicographic::CoorFromIndex(gcoor,gidx,_gdimensions);
|
||||||
}
|
}
|
||||||
void LocalIndexToLocalCoor(int lidx,std::vector<int> &lcoor){
|
void LocalIndexToLocalCoor(int lidx,std::vector<int> &lcoor){
|
||||||
|
assert(lidx<lSites());
|
||||||
Lexicographic::CoorFromIndex(lcoor,lidx,_ldimensions);
|
Lexicographic::CoorFromIndex(lcoor,lidx,_ldimensions);
|
||||||
}
|
}
|
||||||
void GlobalCoorToGlobalIndex(const std::vector<int> & gcoor,int & gidx){
|
void GlobalCoorToGlobalIndex(const std::vector<int> & gcoor,int & gidx){
|
||||||
|
@ -206,7 +206,7 @@ void CartesianCommunicator::Init(int *argc, char ***argv) {
|
|||||||
sprintf(shm_name,"/Grid_mpi3_shm_%d_%d",GroupRank,r);
|
sprintf(shm_name,"/Grid_mpi3_shm_%d_%d",GroupRank,r);
|
||||||
|
|
||||||
shm_unlink(shm_name);
|
shm_unlink(shm_name);
|
||||||
int fd=shm_open(shm_name,O_RDWR|O_CREAT,0660);
|
int fd=shm_open(shm_name,O_RDWR|O_CREAT,0666);
|
||||||
if ( fd < 0 ) { perror("failed shm_open"); assert(0); }
|
if ( fd < 0 ) { perror("failed shm_open"); assert(0); }
|
||||||
ftruncate(fd, size);
|
ftruncate(fd, size);
|
||||||
|
|
||||||
@ -226,7 +226,7 @@ void CartesianCommunicator::Init(int *argc, char ***argv) {
|
|||||||
|
|
||||||
sprintf(shm_name,"/Grid_mpi3_shm_%d_%d",GroupRank,r);
|
sprintf(shm_name,"/Grid_mpi3_shm_%d_%d",GroupRank,r);
|
||||||
|
|
||||||
int fd=shm_open(shm_name,O_RDWR,0660);
|
int fd=shm_open(shm_name,O_RDWR,0666);
|
||||||
if ( fd<0 ) { perror("failed shm_open"); assert(0); }
|
if ( fd<0 ) { perror("failed shm_open"); assert(0); }
|
||||||
|
|
||||||
void * ptr = mmap(NULL,size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
void * ptr = mmap(NULL,size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||||
|
@ -30,12 +30,19 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
|
|||||||
#define GRID_LATTICE_RNG_H
|
#define GRID_LATTICE_RNG_H
|
||||||
|
|
||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
|
#ifdef RNG_SITMO
|
||||||
#include <Grid/sitmo_rng/sitmo_prng_engine.hpp>
|
#include <Grid/sitmo_rng/sitmo_prng_engine.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(RNG_SITMO)
|
||||||
|
#define RNG_FAST_DISCARD
|
||||||
|
#else
|
||||||
|
#undef RNG_FAST_DISCARD
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Grid {
|
namespace Grid {
|
||||||
|
|
||||||
//http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-90Ar1.pdf ?
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
// Allow the RNG state to be less dense than the fine grid
|
// Allow the RNG state to be less dense than the fine grid
|
||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
@ -65,120 +72,139 @@ namespace Grid {
|
|||||||
|
|
||||||
multiplicity = multiplicity *fine->_rdimensions[fd] / coarse->_rdimensions[d];
|
multiplicity = multiplicity *fine->_rdimensions[fd] / coarse->_rdimensions[d];
|
||||||
}
|
}
|
||||||
|
|
||||||
return multiplicity;
|
return multiplicity;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wrap seed_seq to give common interface with random_device
|
|
||||||
// Should rather wrap random_device and have a generate
|
|
||||||
class fixedSeed {
|
|
||||||
public:
|
|
||||||
|
|
||||||
typedef std::seed_seq::result_type result_type;
|
|
||||||
|
|
||||||
std::seed_seq src;
|
|
||||||
|
|
||||||
template<class int_type> fixedSeed(const std::vector<int_type> &seeds) : src(seeds.begin(),seeds.end()) {};
|
|
||||||
|
|
||||||
template< class RandomIt > void generate( RandomIt begin, RandomIt end ) {
|
|
||||||
src.generate(begin,end);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class deviceSeed {
|
|
||||||
public:
|
|
||||||
|
|
||||||
std::random_device rd;
|
|
||||||
|
|
||||||
typedef std::random_device::result_type result_type;
|
|
||||||
|
|
||||||
deviceSeed(void) : rd(){};
|
|
||||||
|
|
||||||
template< class RandomIt > void generate( RandomIt begin, RandomIt end ) {
|
|
||||||
for(RandomIt it=begin; it!=end;it++){
|
|
||||||
*it = rd();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// real scalars are one component
|
// real scalars are one component
|
||||||
template<class scalar,class distribution,class generator> void fillScalar(scalar &s,distribution &dist,generator & gen)
|
template<class scalar,class distribution,class generator>
|
||||||
|
void fillScalar(scalar &s,distribution &dist,generator & gen)
|
||||||
{
|
{
|
||||||
s=dist(gen);
|
s=dist(gen);
|
||||||
}
|
}
|
||||||
template<class distribution,class generator> void fillScalar(ComplexF &s,distribution &dist, generator &gen)
|
template<class distribution,class generator>
|
||||||
|
void fillScalar(ComplexF &s,distribution &dist, generator &gen)
|
||||||
{
|
{
|
||||||
s=ComplexF(dist(gen),dist(gen));
|
s=ComplexF(dist(gen),dist(gen));
|
||||||
}
|
}
|
||||||
template<class distribution,class generator> void fillScalar(ComplexD &s,distribution &dist,generator &gen)
|
template<class distribution,class generator>
|
||||||
|
void fillScalar(ComplexD &s,distribution &dist,generator &gen)
|
||||||
{
|
{
|
||||||
s=ComplexD(dist(gen),dist(gen));
|
s=ComplexD(dist(gen),dist(gen));
|
||||||
}
|
}
|
||||||
|
|
||||||
class GridRNGbase {
|
class GridRNGbase {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
int _seeded;
|
|
||||||
// One generator per site.
|
// One generator per site.
|
||||||
// Uniform and Gaussian distributions from these generators.
|
// Uniform and Gaussian distributions from these generators.
|
||||||
#ifdef RNG_RANLUX
|
#ifdef RNG_RANLUX
|
||||||
typedef uint64_t RngStateType;
|
|
||||||
typedef std::ranlux48 RngEngine;
|
typedef std::ranlux48 RngEngine;
|
||||||
|
typedef uint64_t RngStateType;
|
||||||
static const int RngStateCount = 15;
|
static const int RngStateCount = 15;
|
||||||
#elif RNG_MT19937
|
#endif
|
||||||
|
#ifdef RNG_MT19937
|
||||||
typedef std::mt19937 RngEngine;
|
typedef std::mt19937 RngEngine;
|
||||||
typedef uint32_t RngStateType;
|
typedef uint32_t RngStateType;
|
||||||
static const int RngStateCount = std::mt19937::state_size;
|
static const int RngStateCount = std::mt19937::state_size;
|
||||||
#elif RNG_SITMO
|
#endif
|
||||||
|
#ifdef RNG_SITMO
|
||||||
typedef sitmo::prng_engine RngEngine;
|
typedef sitmo::prng_engine RngEngine;
|
||||||
typedef uint64_t RngStateType;
|
typedef uint64_t RngStateType;
|
||||||
static const int RngStateCount = 4;
|
static const int RngStateCount = 4;
|
||||||
#endif
|
#endif
|
||||||
std::vector<RngEngine> _generators;
|
|
||||||
std::vector<std::uniform_real_distribution<RealD>> _uniform;
|
|
||||||
std::vector<std::normal_distribution<RealD>> _gaussian;
|
|
||||||
std::vector<std::discrete_distribution<int32_t>> _bernoulli;
|
|
||||||
|
|
||||||
void GetState(std::vector<RngStateType> & saved,int gen) {
|
std::vector<RngEngine> _generators;
|
||||||
|
std::vector<std::uniform_real_distribution<RealD> > _uniform;
|
||||||
|
std::vector<std::normal_distribution<RealD> > _gaussian;
|
||||||
|
std::vector<std::discrete_distribution<int32_t> > _bernoulli;
|
||||||
|
std::vector<std::uniform_int_distribution<uint32_t> > _uid;
|
||||||
|
|
||||||
|
///////////////////////
|
||||||
|
// support for parallel init
|
||||||
|
///////////////////////
|
||||||
|
#ifdef RNG_FAST_DISCARD
|
||||||
|
static void Skip(RngEngine &eng)
|
||||||
|
{
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Skip by 2^40 elements between successive lattice sites
|
||||||
|
// This goes by 10^12.
|
||||||
|
// Consider quenched updating; likely never exceeding rate of 1000 sweeps
|
||||||
|
// per second on any machine. This gives us of order 10^9 seconds, or 100 years
|
||||||
|
// skip ahead.
|
||||||
|
// For HMC unlikely to go at faster than a solve per second, and
|
||||||
|
// tens of seconds per trajectory so this is clean in all reasonable cases,
|
||||||
|
// and margin of safety is orders of magnitude.
|
||||||
|
// We could hack Sitmo to skip in the higher order words of state if necessary
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
uint64_t skip = 0x1; skip = skip<<40;
|
||||||
|
eng.discard(skip);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
static RngEngine Reseed(RngEngine &eng)
|
||||||
|
{
|
||||||
|
std::vector<uint32_t> newseed;
|
||||||
|
std::uniform_int_distribution<uint32_t> uid;
|
||||||
|
return Reseed(eng,newseed,uid);
|
||||||
|
}
|
||||||
|
static RngEngine Reseed(RngEngine &eng,std::vector<uint32_t> & newseed,
|
||||||
|
std::uniform_int_distribution<uint32_t> &uid)
|
||||||
|
{
|
||||||
|
const int reseeds=4;
|
||||||
|
|
||||||
|
newseed.resize(reseeds);
|
||||||
|
for(int i=0;i<reseeds;i++){
|
||||||
|
newseed[i] = uid(eng);
|
||||||
|
}
|
||||||
|
std::seed_seq sseq(newseed.begin(),newseed.end());
|
||||||
|
return RngEngine(sseq);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GetState(std::vector<RngStateType> & saved,RngEngine &eng) {
|
||||||
saved.resize(RngStateCount);
|
saved.resize(RngStateCount);
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss<<_generators[gen];
|
ss<<eng;
|
||||||
ss.seekg(0,ss.beg);
|
ss.seekg(0,ss.beg);
|
||||||
for(int i=0;i<RngStateCount;i++){
|
for(int i=0;i<RngStateCount;i++){
|
||||||
ss>>saved[i];
|
ss>>saved[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void SetState(std::vector<RngStateType> & saved,int gen){
|
void GetState(std::vector<RngStateType> & saved,int gen) {
|
||||||
|
GetState(saved,_generators[gen]);
|
||||||
|
}
|
||||||
|
void SetState(std::vector<RngStateType> & saved,RngEngine &eng){
|
||||||
assert(saved.size()==RngStateCount);
|
assert(saved.size()==RngStateCount);
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
for(int i=0;i<RngStateCount;i++){
|
for(int i=0;i<RngStateCount;i++){
|
||||||
ss<< saved[i]<<" ";
|
ss<< saved[i]<<" ";
|
||||||
}
|
}
|
||||||
ss.seekg(0,ss.beg);
|
ss.seekg(0,ss.beg);
|
||||||
ss>>_generators[gen];
|
ss>>eng;
|
||||||
}
|
}
|
||||||
|
void SetState(std::vector<RngStateType> & saved,int gen){
|
||||||
|
SetState(saved,_generators[gen]);
|
||||||
|
}
|
||||||
|
void SetEngine(RngEngine &Eng, int gen){
|
||||||
|
_generators[gen]=Eng;
|
||||||
|
}
|
||||||
|
void GetEngine(RngEngine &Eng, int gen){
|
||||||
|
Eng=_generators[gen];
|
||||||
|
}
|
||||||
|
template<class source> void Seed(source &src, int gen)
|
||||||
|
{
|
||||||
|
_generators[gen] = RngEngine(src);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class GridSerialRNG : public GridRNGbase {
|
class GridSerialRNG : public GridRNGbase {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// FIXME ... do we require lockstep draws of randoms
|
|
||||||
// from all nodes keeping seeds consistent.
|
|
||||||
// place a barrier/broadcast in the fill routine
|
|
||||||
|
|
||||||
GridSerialRNG() : GridRNGbase() {
|
GridSerialRNG() : GridRNGbase() {
|
||||||
_generators.resize(1);
|
_generators.resize(1);
|
||||||
_uniform.resize(1,std::uniform_real_distribution<RealD>{0,1});
|
_uniform.resize(1,std::uniform_real_distribution<RealD>{0,1});
|
||||||
_gaussian.resize(1,std::normal_distribution<RealD>(0.0,1.0) );
|
_gaussian.resize(1,std::normal_distribution<RealD>(0.0,1.0) );
|
||||||
_bernoulli.resize(1,std::discrete_distribution<int32_t>{1,1});
|
_bernoulli.resize(1,std::discrete_distribution<int32_t>{1,1});
|
||||||
_seeded=0;
|
_uid.resize(1,std::uniform_int_distribution<uint32_t>() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <class sobj,class distribution> inline void fill(sobj &l,std::vector<distribution> &dist){
|
template <class sobj,class distribution> inline void fill(sobj &l,std::vector<distribution> &dist){
|
||||||
|
|
||||||
typedef typename sobj::scalar_type scalar_type;
|
typedef typename sobj::scalar_type scalar_type;
|
||||||
@ -191,7 +217,7 @@ namespace Grid {
|
|||||||
for(int idx=0;idx<words;idx++){
|
for(int idx=0;idx<words;idx++){
|
||||||
fillScalar(buf[idx],dist[0],_generators[0]);
|
fillScalar(buf[idx],dist[0],_generators[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
CartesianCommunicator::BroadcastWorld(0,(void *)&l,sizeof(l));
|
CartesianCommunicator::BroadcastWorld(0,(void *)&l,sizeof(l));
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -250,28 +276,18 @@ namespace Grid {
|
|||||||
CartesianCommunicator::BroadcastWorld(0,(void *)&l,sizeof(l));
|
CartesianCommunicator::BroadcastWorld(0,(void *)&l,sizeof(l));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class source> void Seed(source &src)
|
|
||||||
{
|
|
||||||
_generators[0] = RngEngine(src);
|
|
||||||
_seeded=1;
|
|
||||||
}
|
|
||||||
void SeedRandomDevice(void){
|
|
||||||
deviceSeed src;
|
|
||||||
Seed(src);
|
|
||||||
}
|
|
||||||
void SeedFixedIntegers(const std::vector<int> &seeds){
|
void SeedFixedIntegers(const std::vector<int> &seeds){
|
||||||
CartesianCommunicator::BroadcastWorld(0,(void *)&seeds[0],sizeof(int)*seeds.size());
|
CartesianCommunicator::BroadcastWorld(0,(void *)&seeds[0],sizeof(int)*seeds.size());
|
||||||
fixedSeed src(seeds);
|
std::seed_seq src(seeds.begin(),seeds.end());
|
||||||
Seed(src);
|
Seed(src,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class GridParallelRNG : public GridRNGbase {
|
class GridParallelRNG : public GridRNGbase {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
GridBase *_grid;
|
GridBase *_grid;
|
||||||
int _vol;
|
int _vol;
|
||||||
|
public:
|
||||||
|
|
||||||
int generator_idx(int os,int is){
|
int generator_idx(int os,int is){
|
||||||
return is*_grid->oSites()+os;
|
return is*_grid->oSites()+os;
|
||||||
@ -285,15 +301,9 @@ namespace Grid {
|
|||||||
_uniform.resize(_vol,std::uniform_real_distribution<RealD>{0,1});
|
_uniform.resize(_vol,std::uniform_real_distribution<RealD>{0,1});
|
||||||
_gaussian.resize(_vol,std::normal_distribution<RealD>(0.0,1.0) );
|
_gaussian.resize(_vol,std::normal_distribution<RealD>(0.0,1.0) );
|
||||||
_bernoulli.resize(_vol,std::discrete_distribution<int32_t>{1,1});
|
_bernoulli.resize(_vol,std::discrete_distribution<int32_t>{1,1});
|
||||||
_seeded=0;
|
_uid.resize(_vol,std::uniform_int_distribution<uint32_t>() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//FIXME implement generic IO and create state save/restore
|
|
||||||
//void SaveState(const std::string<char> &file);
|
|
||||||
//void LoadState(const std::string<char> &file);
|
|
||||||
|
|
||||||
template <class vobj,class distribution> inline void fill(Lattice<vobj> &l,std::vector<distribution> &dist){
|
template <class vobj,class distribution> inline void fill(Lattice<vobj> &l,std::vector<distribution> &dist){
|
||||||
|
|
||||||
typedef typename vobj::scalar_object scalar_object;
|
typedef typename vobj::scalar_object scalar_object;
|
||||||
@ -306,7 +316,6 @@ namespace Grid {
|
|||||||
int osites=_grid->oSites();
|
int osites=_grid->oSites();
|
||||||
int words=sizeof(scalar_object)/sizeof(scalar_type);
|
int words=sizeof(scalar_object)/sizeof(scalar_type);
|
||||||
|
|
||||||
|
|
||||||
parallel_for(int ss=0;ss<osites;ss++){
|
parallel_for(int ss=0;ss<osites;ss++){
|
||||||
|
|
||||||
std::vector<scalar_object> buf(Nsimd);
|
std::vector<scalar_object> buf(Nsimd);
|
||||||
@ -329,104 +338,114 @@ namespace Grid {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// This loop could be made faster to avoid the Ahmdahl by
|
void SeedFixedIntegers(const std::vector<int> &seeds){
|
||||||
// i) seed generators on each timeslice, for x=y=z=0;
|
|
||||||
// ii) seed generators on each z for x=y=0
|
|
||||||
// iii)seed generators on each y,z for x=0
|
|
||||||
// iv) seed generators on each y,z,x
|
|
||||||
// made possible by physical indexing.
|
|
||||||
template<class source> void Seed(source &src)
|
|
||||||
{
|
|
||||||
|
|
||||||
typedef typename source::result_type seed_t;
|
// Everyone generates the same seed_seq based on input seeds
|
||||||
std::uniform_int_distribution<seed_t> uid;
|
CartesianCommunicator::BroadcastWorld(0,(void *)&seeds[0],sizeof(int)*seeds.size());
|
||||||
|
|
||||||
int numseed=4;
|
std::seed_seq source(seeds.begin(),seeds.end());
|
||||||
int gsites = _grid->_gsites;
|
|
||||||
std::vector<seed_t> site_init(numseed);
|
RngEngine master_engine(source);
|
||||||
|
|
||||||
|
#ifdef RNG_FAST_DISCARD
|
||||||
|
////////////////////////////////////////////////
|
||||||
|
// Skip ahead through a single stream.
|
||||||
|
// Applicable to SITMO and other has based/crypto RNGs
|
||||||
|
// Should be applicable to Mersenne Twister, but the C++11
|
||||||
|
// MT implementation does not implement fast discard even though
|
||||||
|
// in principle this is possible
|
||||||
|
////////////////////////////////////////////////
|
||||||
std::vector<int> gcoor;
|
std::vector<int> gcoor;
|
||||||
|
int rank,o_idx,i_idx;
|
||||||
|
|
||||||
|
// Everybody loops over global volume.
|
||||||
|
for(int gidx=0;gidx<_grid->_gsites;gidx++){
|
||||||
|
|
||||||
// Master RngEngine
|
Skip(master_engine); // Skip to next RNG sequence
|
||||||
std::vector<seed_t> master_init(numseed); src.generate(master_init.begin(),master_init.end());
|
|
||||||
_grid->Broadcast(0,(void *)&master_init[0],sizeof(seed_t)*numseed);
|
|
||||||
fixedSeed master_seed(master_init);
|
|
||||||
RngEngine master_engine(master_seed);
|
|
||||||
|
|
||||||
// Per node RngEngine
|
|
||||||
std::vector<seed_t> node_init(numseed);
|
|
||||||
for(int r=0;r<_grid->ProcessorCount();r++) {
|
|
||||||
|
|
||||||
std::vector<seed_t> rank_init(numseed);
|
|
||||||
for(int i=0;i<numseed;i++) rank_init[i] = uid(master_engine);
|
|
||||||
|
|
||||||
std::cout << GridLogMessage << "SeedSeq for rank "<<r;
|
|
||||||
for(int i=0;i<numseed;i++) std::cout<<" "<<rank_init[i];
|
|
||||||
std::cout <<std::endl;
|
|
||||||
|
|
||||||
if ( r==_grid->ThisRank() ) {
|
|
||||||
for(int i=0;i<numseed;i++) node_init[i] = rank_init[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////
|
|
||||||
// Set up a seed_seq wrapper with these 8 words
|
|
||||||
// and draw for each site within node.
|
|
||||||
////////////////////////////////////////////////////
|
|
||||||
fixedSeed node_seed(node_init);
|
|
||||||
RngEngine node_engine(node_seed);
|
|
||||||
|
|
||||||
for(int gidx=0;gidx<gsites;gidx++){
|
|
||||||
int rank,o_idx,i_idx;
|
|
||||||
|
|
||||||
|
// Where is it?
|
||||||
_grid->GlobalIndexToGlobalCoor(gidx,gcoor);
|
_grid->GlobalIndexToGlobalCoor(gidx,gcoor);
|
||||||
_grid->GlobalCoorToRankIndex(rank,o_idx,i_idx,gcoor);
|
_grid->GlobalCoorToRankIndex(rank,o_idx,i_idx,gcoor);
|
||||||
|
|
||||||
|
// If this is one of mine we take it
|
||||||
if( rank == _grid->ThisRank() ){
|
if( rank == _grid->ThisRank() ){
|
||||||
int l_idx=generator_idx(o_idx,i_idx);
|
int l_idx=generator_idx(o_idx,i_idx);
|
||||||
for(int i=0;i<numseed;i++) site_init[i] = uid(node_engine);
|
_generators[l_idx] = master_engine;
|
||||||
fixedSeed site_seed(site_init);
|
}
|
||||||
_generators[l_idx] = RngEngine(site_seed);
|
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
////////////////////////////////////////////////////////////////
|
||||||
|
// Machine and thread decomposition dependent seeding is efficient
|
||||||
|
// and maximally parallel; but NOT reproducible from machine to machine.
|
||||||
|
// Not ideal, but fastest way to reseed all nodes.
|
||||||
|
////////////////////////////////////////////////////////////////
|
||||||
|
{
|
||||||
|
// Obtain one Reseed per processor
|
||||||
|
int Nproc = _grid->ProcessorCount();
|
||||||
|
std::vector<RngEngine> seeders(Nproc);
|
||||||
|
int me= _grid->ThisRank();
|
||||||
|
for(int p=0;p<Nproc;p++){
|
||||||
|
seeders[p] = Reseed(master_engine);
|
||||||
|
}
|
||||||
|
master_engine = seeders[me];
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// Obtain one reseeded generator per thread
|
||||||
|
int Nthread = GridThread::GetThreads();
|
||||||
|
std::vector<RngEngine> seeders(Nthread);
|
||||||
|
for(int t=0;t<Nthread;t++){
|
||||||
|
seeders[t] = Reseed(master_engine);
|
||||||
|
}
|
||||||
|
|
||||||
|
parallel_for(int t=0;t<Nthread;t++) {
|
||||||
|
// set up one per local site in threaded fashion
|
||||||
|
std::vector<uint32_t> newseeds;
|
||||||
|
std::uniform_int_distribution<uint32_t> uid;
|
||||||
|
for(int l=0;l<_grid->lSites();l++) {
|
||||||
|
if ( (l%Nthread)==t ) {
|
||||||
|
_generators[l] = Reseed(seeders[t],newseeds,uid);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_seeded=1;
|
#endif
|
||||||
}
|
|
||||||
void SeedRandomDevice(void){
|
|
||||||
deviceSeed src;
|
|
||||||
Seed(src);
|
|
||||||
}
|
}
|
||||||
void SeedFixedIntegers(const std::vector<int> &seeds){
|
////////////////////////////////////////////////////////////////////////
|
||||||
CartesianCommunicator::BroadcastWorld(0,(void *)&seeds[0],sizeof(int)*seeds.size());
|
// Support for rigorous test of RNG's
|
||||||
fixedSeed src(seeds);
|
// Return uniform random uint32_t from requested site generator
|
||||||
Seed(src);
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
uint32_t GlobalU01(int gsite){
|
||||||
|
|
||||||
|
uint32_t the_number;
|
||||||
|
|
||||||
|
// who
|
||||||
|
std::vector<int> gcoor;
|
||||||
|
int rank,o_idx,i_idx;
|
||||||
|
_grid->GlobalIndexToGlobalCoor(gsite,gcoor);
|
||||||
|
_grid->GlobalCoorToRankIndex(rank,o_idx,i_idx,gcoor);
|
||||||
|
|
||||||
|
// draw
|
||||||
|
int l_idx=generator_idx(o_idx,i_idx);
|
||||||
|
if( rank == _grid->ThisRank() ){
|
||||||
|
the_number = _uid[l_idx](_generators[l_idx]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// share & return
|
||||||
|
_grid->Broadcast(rank,(void *)&the_number,sizeof(the_number));
|
||||||
|
return the_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class vobj> inline void random(GridParallelRNG &rng,Lattice<vobj> &l){
|
template <class vobj> inline void random(GridParallelRNG &rng,Lattice<vobj> &l) { rng.fill(l,rng._uniform); }
|
||||||
rng.fill(l,rng._uniform);
|
template <class vobj> inline void gaussian(GridParallelRNG &rng,Lattice<vobj> &l) { rng.fill(l,rng._gaussian); }
|
||||||
}
|
template <class vobj> inline void bernoulli(GridParallelRNG &rng,Lattice<vobj> &l){ rng.fill(l,rng._bernoulli);}
|
||||||
|
|
||||||
template <class vobj> inline void gaussian(GridParallelRNG &rng,Lattice<vobj> &l){
|
template <class sobj> inline void random(GridSerialRNG &rng,sobj &l) { rng.fill(l,rng._uniform ); }
|
||||||
rng.fill(l,rng._gaussian);
|
template <class sobj> inline void gaussian(GridSerialRNG &rng,sobj &l) { rng.fill(l,rng._gaussian ); }
|
||||||
}
|
template <class sobj> inline void bernoulli(GridSerialRNG &rng,sobj &l){ rng.fill(l,rng._bernoulli); }
|
||||||
|
|
||||||
template <class vobj> inline void bernoulli(GridParallelRNG &rng,Lattice<vobj> &l){
|
|
||||||
rng.fill(l,rng._bernoulli);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class sobj> inline void random(GridSerialRNG &rng,sobj &l){
|
|
||||||
rng.fill(l,rng._uniform);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class sobj> inline void gaussian(GridSerialRNG &rng,sobj &l){
|
|
||||||
rng.fill(l,rng._gaussian);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class sobj> inline void bernoulli(GridSerialRNG &rng,sobj &l){
|
|
||||||
rng.fill(l,rng._bernoulli);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -491,10 +491,15 @@ static inline void writeRNGState(GridSerialRNG &serial,GridParallelRNG ¶llel
|
|||||||
#ifdef RNG_RANLUX
|
#ifdef RNG_RANLUX
|
||||||
header.floating_point = std::string("UINT64");
|
header.floating_point = std::string("UINT64");
|
||||||
header.data_type = std::string("RANLUX48");
|
header.data_type = std::string("RANLUX48");
|
||||||
#else
|
#endif
|
||||||
|
#ifdef RNG_MT19937
|
||||||
header.floating_point = std::string("UINT32");
|
header.floating_point = std::string("UINT32");
|
||||||
header.data_type = std::string("MT19937");
|
header.data_type = std::string("MT19937");
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef RNG_SITMO
|
||||||
|
header.floating_point = std::string("UINT64");
|
||||||
|
header.data_type = std::string("SITMO");
|
||||||
|
#endif
|
||||||
|
|
||||||
truncate(file);
|
truncate(file);
|
||||||
offset = writeHeader(header,file);
|
offset = writeHeader(header,file);
|
||||||
@ -522,10 +527,15 @@ static inline void readRNGState(GridSerialRNG &serial,GridParallelRNG & parallel
|
|||||||
#ifdef RNG_RANLUX
|
#ifdef RNG_RANLUX
|
||||||
assert(format == std::string("UINT64"));
|
assert(format == std::string("UINT64"));
|
||||||
assert(data_type == std::string("RANLUX48"));
|
assert(data_type == std::string("RANLUX48"));
|
||||||
#else
|
#endif
|
||||||
|
#ifdef RNG_MT19937
|
||||||
assert(format == std::string("UINT32"));
|
assert(format == std::string("UINT32"));
|
||||||
assert(data_type == std::string("MT19937"));
|
assert(data_type == std::string("MT19937"));
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef RNG_SITMO
|
||||||
|
assert(format == std::string("UINT64"));
|
||||||
|
assert(data_type == std::string("SITMO"));
|
||||||
|
#endif
|
||||||
|
|
||||||
// depending on datatype, set up munger;
|
// depending on datatype, set up munger;
|
||||||
// munger is a function of <floating point, Real, data_type>
|
// munger is a function of <floating point, Real, data_type>
|
||||||
|
@ -28,66 +28,6 @@ Author: Peter Boyle <pabobyle@ph.ed.ac.uk>
|
|||||||
#ifndef GRID_QCD_FERMION_H
|
#ifndef GRID_QCD_FERMION_H
|
||||||
#define GRID_QCD_FERMION_H
|
#define GRID_QCD_FERMION_H
|
||||||
|
|
||||||
// * Linear operators (Hermitian and non-hermitian) .. my LinearOperator
|
|
||||||
// * System solvers (Hermitian and non-hermitian) .. my OperatorFunction
|
|
||||||
// * MultiShift System solvers (Hermitian and non-hermitian) .. my OperatorFunction
|
|
||||||
|
|
||||||
////////////////////////////////////////////
|
|
||||||
// Abstract base interface
|
|
||||||
////////////////////////////////////////////
|
|
||||||
#include <Grid/qcd/action/ActionBase.h>
|
|
||||||
#include <Grid/qcd/action/ActionParams.h>
|
|
||||||
|
|
||||||
////////////////////////////////////////////
|
|
||||||
// Utility functions
|
|
||||||
////////////////////////////////////////////
|
|
||||||
#include <Grid/qcd/action/gauge/GaugeImpl.h>
|
|
||||||
#include <Grid/qcd/utils/WilsonLoops.h>
|
|
||||||
|
|
||||||
#include <Grid/qcd/action/fermion/WilsonCompressor.h> //used by all wilson type fermions
|
|
||||||
#include <Grid/qcd/action/fermion/FermionOperatorImpl.h>
|
|
||||||
#include <Grid/qcd/action/fermion/FermionOperator.h>
|
|
||||||
#include <Grid/qcd/action/fermion/WilsonKernels.h> //used by all wilson type fermions
|
|
||||||
|
|
||||||
////////////////////////////////////////////
|
|
||||||
// Gauge Actions
|
|
||||||
////////////////////////////////////////////
|
|
||||||
#include <Grid/qcd/action/gauge/Photon.h>
|
|
||||||
#include <Grid/qcd/action/gauge/WilsonGaugeAction.h>
|
|
||||||
#include <Grid/qcd/action/gauge/PlaqPlusRectangleAction.h>
|
|
||||||
|
|
||||||
namespace Grid {
|
|
||||||
namespace QCD {
|
|
||||||
|
|
||||||
typedef WilsonGaugeAction<PeriodicGimplR> WilsonGaugeActionR;
|
|
||||||
typedef WilsonGaugeAction<PeriodicGimplF> WilsonGaugeActionF;
|
|
||||||
typedef WilsonGaugeAction<PeriodicGimplD> WilsonGaugeActionD;
|
|
||||||
typedef PlaqPlusRectangleAction<PeriodicGimplR> PlaqPlusRectangleActionR;
|
|
||||||
typedef PlaqPlusRectangleAction<PeriodicGimplF> PlaqPlusRectangleActionF;
|
|
||||||
typedef PlaqPlusRectangleAction<PeriodicGimplD> PlaqPlusRectangleActionD;
|
|
||||||
typedef IwasakiGaugeAction<PeriodicGimplR> IwasakiGaugeActionR;
|
|
||||||
typedef IwasakiGaugeAction<PeriodicGimplF> IwasakiGaugeActionF;
|
|
||||||
typedef IwasakiGaugeAction<PeriodicGimplD> IwasakiGaugeActionD;
|
|
||||||
typedef SymanzikGaugeAction<PeriodicGimplR> SymanzikGaugeActionR;
|
|
||||||
typedef SymanzikGaugeAction<PeriodicGimplF> SymanzikGaugeActionF;
|
|
||||||
typedef SymanzikGaugeAction<PeriodicGimplD> SymanzikGaugeActionD;
|
|
||||||
|
|
||||||
|
|
||||||
typedef WilsonGaugeAction<ConjugateGimplR> ConjugateWilsonGaugeActionR;
|
|
||||||
typedef WilsonGaugeAction<ConjugateGimplF> ConjugateWilsonGaugeActionF;
|
|
||||||
typedef WilsonGaugeAction<ConjugateGimplD> ConjugateWilsonGaugeActionD;
|
|
||||||
typedef PlaqPlusRectangleAction<ConjugateGimplR> ConjugatePlaqPlusRectangleActionR;
|
|
||||||
typedef PlaqPlusRectangleAction<ConjugateGimplF> ConjugatePlaqPlusRectangleActionF;
|
|
||||||
typedef PlaqPlusRectangleAction<ConjugateGimplD> ConjugatePlaqPlusRectangleActionD;
|
|
||||||
typedef IwasakiGaugeAction<ConjugateGimplR> ConjugateIwasakiGaugeActionR;
|
|
||||||
typedef IwasakiGaugeAction<ConjugateGimplF> ConjugateIwasakiGaugeActionF;
|
|
||||||
typedef IwasakiGaugeAction<ConjugateGimplD> ConjugateIwasakiGaugeActionD;
|
|
||||||
typedef SymanzikGaugeAction<ConjugateGimplR> ConjugateSymanzikGaugeActionR;
|
|
||||||
typedef SymanzikGaugeAction<ConjugateGimplF> ConjugateSymanzikGaugeActionF;
|
|
||||||
typedef SymanzikGaugeAction<ConjugateGimplD> ConjugateSymanzikGaugeActionD;
|
|
||||||
|
|
||||||
}}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Explicit explicit template instantiation is still required in the .cc files
|
// Explicit explicit template instantiation is still required in the .cc files
|
||||||
//
|
//
|
||||||
@ -118,6 +58,7 @@ typedef SymanzikGaugeAction<ConjugateGimplD> ConjugateSymanzikGaugeAction
|
|||||||
#include <Grid/qcd/action/fermion/DomainWallFermion.h>
|
#include <Grid/qcd/action/fermion/DomainWallFermion.h>
|
||||||
#include <Grid/qcd/action/fermion/MobiusFermion.h>
|
#include <Grid/qcd/action/fermion/MobiusFermion.h>
|
||||||
#include <Grid/qcd/action/fermion/ZMobiusFermion.h>
|
#include <Grid/qcd/action/fermion/ZMobiusFermion.h>
|
||||||
|
#include <Grid/qcd/action/fermion/SchurDiagTwoKappa.h>
|
||||||
#include <Grid/qcd/action/fermion/ScaledShamirFermion.h>
|
#include <Grid/qcd/action/fermion/ScaledShamirFermion.h>
|
||||||
#include <Grid/qcd/action/fermion/MobiusZolotarevFermion.h>
|
#include <Grid/qcd/action/fermion/MobiusZolotarevFermion.h>
|
||||||
#include <Grid/qcd/action/fermion/ShamirZolotarevFermion.h>
|
#include <Grid/qcd/action/fermion/ShamirZolotarevFermion.h>
|
||||||
@ -251,14 +192,11 @@ typedef ImprovedStaggeredFermion5D<StaggeredVec5dImplD> ImprovedStaggeredFermion
|
|||||||
|
|
||||||
}}
|
}}
|
||||||
|
|
||||||
#include <Grid/qcd/action/pseudofermion/OneFlavourRational.h>
|
|
||||||
#include <Grid/qcd/action/pseudofermion/OneFlavourRationalRatio.h>
|
|
||||||
#include <Grid/qcd/action/pseudofermion/OneFlavourEvenOddRational.h>
|
|
||||||
#include <Grid/qcd/action/pseudofermion/OneFlavourEvenOddRationalRatio.h>
|
|
||||||
|
|
||||||
////////////////////
|
////////////////////
|
||||||
// Scalar actions
|
// Scalar QED actions
|
||||||
|
// TODO: this needs to move to another header after rename to Fermion.h
|
||||||
////////////////////
|
////////////////////
|
||||||
#include <Grid/qcd/action/scalar/Scalar.h>
|
#include <Grid/qcd/action/scalar/Scalar.h>
|
||||||
|
#include <Grid/qcd/action/gauge/Photon.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
102
lib/qcd/action/fermion/SchurDiagTwoKappa.h
Normal file
102
lib/qcd/action/fermion/SchurDiagTwoKappa.h
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
/*************************************************************************************
|
||||||
|
|
||||||
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
|
Source file: SchurDiagTwoKappa.h
|
||||||
|
|
||||||
|
Copyright (C) 2017
|
||||||
|
|
||||||
|
Author: Christoph Lehner
|
||||||
|
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 */
|
||||||
|
#ifndef _SCHUR_DIAG_TWO_KAPPA_H
|
||||||
|
#define _SCHUR_DIAG_TWO_KAPPA_H
|
||||||
|
|
||||||
|
namespace Grid {
|
||||||
|
|
||||||
|
// This is specific to (Z)mobius fermions
|
||||||
|
template<class Matrix, class Field>
|
||||||
|
class KappaSimilarityTransform {
|
||||||
|
public:
|
||||||
|
INHERIT_IMPL_TYPES(Matrix);
|
||||||
|
std::vector<Coeff_t> kappa, kappaDag, kappaInv, kappaInvDag;
|
||||||
|
|
||||||
|
KappaSimilarityTransform (Matrix &zmob) {
|
||||||
|
for (int i=0;i<(int)zmob.bs.size();i++) {
|
||||||
|
Coeff_t k = 1.0 / ( 2.0 * (zmob.bs[i] *(4 - zmob.M5) + 1.0) );
|
||||||
|
kappa.push_back( k );
|
||||||
|
kappaDag.push_back( conj(k) );
|
||||||
|
kappaInv.push_back( 1.0 / k );
|
||||||
|
kappaInvDag.push_back( 1.0 / conj(k) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename vobj>
|
||||||
|
void sscale(const Lattice<vobj>& in, Lattice<vobj>& out, Coeff_t* s) {
|
||||||
|
GridBase *grid=out._grid;
|
||||||
|
out.checkerboard = in.checkerboard;
|
||||||
|
assert(grid->_simd_layout[0] == 1); // should be fine for ZMobius for now
|
||||||
|
int Ls = grid->_rdimensions[0];
|
||||||
|
parallel_for(int ss=0;ss<grid->oSites();ss++){
|
||||||
|
vobj tmp = s[ss % Ls]*in._odata[ss];
|
||||||
|
vstream(out._odata[ss],tmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RealD sscale_norm(const Field& in, Field& out, Coeff_t* s) {
|
||||||
|
sscale(in,out,s);
|
||||||
|
return norm2(out);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual RealD M (const Field& in, Field& out) { return sscale_norm(in,out,&kappa[0]); }
|
||||||
|
virtual RealD MDag (const Field& in, Field& out) { return sscale_norm(in,out,&kappaDag[0]);}
|
||||||
|
virtual RealD MInv (const Field& in, Field& out) { return sscale_norm(in,out,&kappaInv[0]);}
|
||||||
|
virtual RealD MInvDag (const Field& in, Field& out) { return sscale_norm(in,out,&kappaInvDag[0]);}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class Matrix,class Field>
|
||||||
|
class SchurDiagTwoKappaOperator : public SchurOperatorBase<Field> {
|
||||||
|
public:
|
||||||
|
KappaSimilarityTransform<Matrix, Field> _S;
|
||||||
|
SchurDiagTwoOperator<Matrix, Field> _Mat;
|
||||||
|
|
||||||
|
SchurDiagTwoKappaOperator (Matrix &Mat): _S(Mat), _Mat(Mat) {};
|
||||||
|
|
||||||
|
virtual RealD Mpc (const Field &in, Field &out) {
|
||||||
|
Field tmp(in._grid);
|
||||||
|
|
||||||
|
_S.MInv(in,out);
|
||||||
|
_Mat.Mpc(out,tmp);
|
||||||
|
return _S.M(tmp,out);
|
||||||
|
|
||||||
|
}
|
||||||
|
virtual RealD MpcDag (const Field &in, Field &out){
|
||||||
|
Field tmp(in._grid);
|
||||||
|
|
||||||
|
_S.MDag(in,out);
|
||||||
|
_Mat.MpcDag(out,tmp);
|
||||||
|
return _S.MInvDag(tmp,out);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -138,6 +138,54 @@ namespace Grid {
|
|||||||
unsigned int dimInd_{0};
|
unsigned int dimInd_{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Pair IO utilities /////////////////////////////////////////////////////////
|
||||||
|
// helper function to parse input in the format "<obj1 obj2>"
|
||||||
|
template <typename T1, typename T2>
|
||||||
|
inline std::istream & operator>>(std::istream &is, std::pair<T1, T2> &buf)
|
||||||
|
{
|
||||||
|
T1 buf1;
|
||||||
|
T2 buf2;
|
||||||
|
char c;
|
||||||
|
|
||||||
|
// Search for "pair" delimiters.
|
||||||
|
do
|
||||||
|
{
|
||||||
|
is.get(c);
|
||||||
|
} while (c != '<' && !is.eof());
|
||||||
|
if (c == '<')
|
||||||
|
{
|
||||||
|
int start = is.tellg();
|
||||||
|
do
|
||||||
|
{
|
||||||
|
is.get(c);
|
||||||
|
} while (c != '>' && !is.eof());
|
||||||
|
if (c == '>')
|
||||||
|
{
|
||||||
|
int end = is.tellg();
|
||||||
|
int psize = end - start - 1;
|
||||||
|
|
||||||
|
// Only read data between pair limiters.
|
||||||
|
is.seekg(start);
|
||||||
|
std::string tmpstr(psize, ' ');
|
||||||
|
is.read(&tmpstr[0], psize);
|
||||||
|
std::istringstream temp(tmpstr);
|
||||||
|
temp >> buf1 >> buf2;
|
||||||
|
buf = std::make_pair(buf1, buf2);
|
||||||
|
is.seekg(end);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
is.peek();
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
|
||||||
|
// output to streams for pairs
|
||||||
|
template <class T1, class T2>
|
||||||
|
inline std::ostream & operator<<(std::ostream &os, const std::pair<T1, T2> &p)
|
||||||
|
{
|
||||||
|
os << "<" << p.first << " " << p.second << ">";
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
// Abstract writer/reader classes ////////////////////////////////////////////
|
// Abstract writer/reader classes ////////////////////////////////////////////
|
||||||
// static polymorphism implemented using CRTP idiom
|
// static polymorphism implemented using CRTP idiom
|
||||||
class Serializable;
|
class Serializable;
|
||||||
|
@ -54,7 +54,7 @@ THE SOFTWARE.
|
|||||||
|
|
||||||
#define GRID_MACRO_EMPTY()
|
#define GRID_MACRO_EMPTY()
|
||||||
|
|
||||||
#define GRID_MACRO_EVAL(...) GRID_MACRO_EVAL1024(__VA_ARGS__)
|
#define GRID_MACRO_EVAL(...) GRID_MACRO_EVAL64(__VA_ARGS__)
|
||||||
#define GRID_MACRO_EVAL1024(...) GRID_MACRO_EVAL512(GRID_MACRO_EVAL512(__VA_ARGS__))
|
#define GRID_MACRO_EVAL1024(...) GRID_MACRO_EVAL512(GRID_MACRO_EVAL512(__VA_ARGS__))
|
||||||
#define GRID_MACRO_EVAL512(...) GRID_MACRO_EVAL256(GRID_MACRO_EVAL256(__VA_ARGS__))
|
#define GRID_MACRO_EVAL512(...) GRID_MACRO_EVAL256(GRID_MACRO_EVAL256(__VA_ARGS__))
|
||||||
#define GRID_MACRO_EVAL256(...) GRID_MACRO_EVAL128(GRID_MACRO_EVAL128(__VA_ARGS__))
|
#define GRID_MACRO_EVAL256(...) GRID_MACRO_EVAL128(GRID_MACRO_EVAL128(__VA_ARGS__))
|
||||||
|
@ -54,8 +54,8 @@ int main (int argc, char ** argv)
|
|||||||
GridSerialRNG sRNGa;
|
GridSerialRNG sRNGa;
|
||||||
GridSerialRNG sRNGb;
|
GridSerialRNG sRNGb;
|
||||||
|
|
||||||
pRNGa.SeedRandomDevice();
|
pRNGa.SeedFixedIntegers(std::vector<int>({45,12,81,9});
|
||||||
sRNGa.SeedRandomDevice();
|
sRNGa.SeedFixedIntegers(std::vector<int>({45,12,81,9});
|
||||||
|
|
||||||
std::string rfile("./ckpoint_rng.4000");
|
std::string rfile("./ckpoint_rng.4000");
|
||||||
NerscIO::writeRNGState(sRNGa,pRNGa,rfile);
|
NerscIO::writeRNGState(sRNGa,pRNGa,rfile);
|
||||||
|
@ -113,6 +113,7 @@ int main(int argc,char **argv)
|
|||||||
// test serializable class writing
|
// test serializable class writing
|
||||||
myclass obj(1234); // non-trivial constructor
|
myclass obj(1234); // non-trivial constructor
|
||||||
std::vector<myclass> vec;
|
std::vector<myclass> vec;
|
||||||
|
std::pair<myenum, myenum> pair;
|
||||||
|
|
||||||
std::cout << "-- serialisable class writing to 'bother.xml'..." << std::endl;
|
std::cout << "-- serialisable class writing to 'bother.xml'..." << std::endl;
|
||||||
write(WR,"obj",obj);
|
write(WR,"obj",obj);
|
||||||
@ -120,6 +121,8 @@ int main(int argc,char **argv)
|
|||||||
vec.push_back(myclass(1234));
|
vec.push_back(myclass(1234));
|
||||||
vec.push_back(myclass(5678));
|
vec.push_back(myclass(5678));
|
||||||
vec.push_back(myclass(3838));
|
vec.push_back(myclass(3838));
|
||||||
|
pair = std::make_pair(myenum::red, myenum::blue);
|
||||||
|
|
||||||
write(WR, "objvec", vec);
|
write(WR, "objvec", vec);
|
||||||
std::cout << "-- serialisable class writing to std::cout:" << std::endl;
|
std::cout << "-- serialisable class writing to std::cout:" << std::endl;
|
||||||
std::cout << obj << std::endl;
|
std::cout << obj << std::endl;
|
||||||
@ -127,21 +130,30 @@ int main(int argc,char **argv)
|
|||||||
std::cout << "vec[0] == obj: " << ((vec[0] == obj) ? "true" : "false") << std::endl;
|
std::cout << "vec[0] == obj: " << ((vec[0] == obj) ? "true" : "false") << std::endl;
|
||||||
std::cout << "vec[1] == obj: " << ((vec[1] == obj) ? "true" : "false") << std::endl;
|
std::cout << "vec[1] == obj: " << ((vec[1] == obj) ? "true" : "false") << std::endl;
|
||||||
|
|
||||||
|
write(WR, "objpair", pair);
|
||||||
|
std::cout << "-- pair writing to std::cout:" << std::endl;
|
||||||
|
std::cout << pair << std::endl;
|
||||||
|
|
||||||
// read tests
|
// read tests
|
||||||
std::cout << "\n==== IO self-consistency tests" << std::endl;
|
std::cout << "\n==== IO self-consistency tests" << std::endl;
|
||||||
//// XML
|
//// XML
|
||||||
ioTest<XmlWriter, XmlReader>("iotest.xml", obj, "XML (object) ");
|
ioTest<XmlWriter, XmlReader>("iotest.xml", obj, "XML (object) ");
|
||||||
ioTest<XmlWriter, XmlReader>("iotest.xml", vec, "XML (vector of objects)");
|
ioTest<XmlWriter, XmlReader>("iotest.xml", vec, "XML (vector of objects)");
|
||||||
|
ioTest<XmlWriter, XmlReader>("iotest.xml", pair, "XML (pair of objects)");
|
||||||
//// binary
|
//// binary
|
||||||
ioTest<BinaryWriter, BinaryReader>("iotest.bin", obj, "binary (object) ");
|
ioTest<BinaryWriter, BinaryReader>("iotest.bin", obj, "binary (object) ");
|
||||||
ioTest<BinaryWriter, BinaryReader>("iotest.bin", vec, "binary (vector of objects)");
|
ioTest<BinaryWriter, BinaryReader>("iotest.bin", vec, "binary (vector of objects)");
|
||||||
|
ioTest<BinaryWriter, BinaryReader>("iotest.bin", pair, "binary (pair of objects)");
|
||||||
//// text
|
//// text
|
||||||
ioTest<TextWriter, TextReader>("iotest.dat", obj, "text (object) ");
|
ioTest<TextWriter, TextReader>("iotest.dat", obj, "text (object) ");
|
||||||
ioTest<TextWriter, TextReader>("iotest.dat", vec, "text (vector of objects)");
|
ioTest<TextWriter, TextReader>("iotest.dat", vec, "text (vector of objects)");
|
||||||
|
ioTest<TextWriter, TextReader>("iotest.dat", pair, "text (pair of objects)");
|
||||||
//// HDF5
|
//// HDF5
|
||||||
|
#undef HAVE_HDF5
|
||||||
#ifdef HAVE_HDF5
|
#ifdef HAVE_HDF5
|
||||||
ioTest<Hdf5Writer, Hdf5Reader>("iotest.h5", obj, "HDF5 (object) ");
|
ioTest<Hdf5Writer, Hdf5Reader>("iotest.h5", obj, "HDF5 (object) ");
|
||||||
ioTest<Hdf5Writer, Hdf5Reader>("iotest.h5", vec, "HDF5 (vector of objects)");
|
ioTest<Hdf5Writer, Hdf5Reader>("iotest.h5", vec, "HDF5 (vector of objects)");
|
||||||
|
ioTest<Hdf5Writer, Hdf5Reader>("iotest.h5", pair, "HDF5 (pair of objects)");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::cout << "\n==== vector flattening/reconstruction" << std::endl;
|
std::cout << "\n==== vector flattening/reconstruction" << std::endl;
|
||||||
|
@ -41,7 +41,7 @@ int main (int argc, char ** argv)
|
|||||||
|
|
||||||
GridCartesian Fine(latt_size,simd_layout,mpi_layout);
|
GridCartesian Fine(latt_size,simd_layout,mpi_layout);
|
||||||
|
|
||||||
GridParallelRNG FineRNG(&Fine); FineRNG.SeedRandomDevice();
|
GridParallelRNG FineRNG(&Fine); FineRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||||
|
|
||||||
LatticeComplex U(&Fine);
|
LatticeComplex U(&Fine);
|
||||||
LatticeComplex ShiftU(&Fine);
|
LatticeComplex ShiftU(&Fine);
|
||||||
|
@ -125,7 +125,7 @@ template<class scal, class vec,class functor >
|
|||||||
void Tester(const functor &func)
|
void Tester(const functor &func)
|
||||||
{
|
{
|
||||||
GridSerialRNG sRNG;
|
GridSerialRNG sRNG;
|
||||||
sRNG.SeedRandomDevice();
|
sRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||||
|
|
||||||
int Nsimd = vec::Nsimd();
|
int Nsimd = vec::Nsimd();
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ void IntTester(const functor &func)
|
|||||||
typedef Integer scal;
|
typedef Integer scal;
|
||||||
typedef vInteger vec;
|
typedef vInteger vec;
|
||||||
GridSerialRNG sRNG;
|
GridSerialRNG sRNG;
|
||||||
sRNG.SeedRandomDevice();
|
sRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||||
|
|
||||||
int Nsimd = vec::Nsimd();
|
int Nsimd = vec::Nsimd();
|
||||||
|
|
||||||
@ -242,7 +242,7 @@ template<class reduced,class scal, class vec,class functor >
|
|||||||
void ReductionTester(const functor &func)
|
void ReductionTester(const functor &func)
|
||||||
{
|
{
|
||||||
GridSerialRNG sRNG;
|
GridSerialRNG sRNG;
|
||||||
sRNG.SeedRandomDevice();
|
sRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||||
|
|
||||||
int Nsimd = vec::Nsimd();
|
int Nsimd = vec::Nsimd();
|
||||||
|
|
||||||
@ -343,7 +343,7 @@ template<class scal, class vec,class functor >
|
|||||||
void PermTester(const functor &func)
|
void PermTester(const functor &func)
|
||||||
{
|
{
|
||||||
GridSerialRNG sRNG;
|
GridSerialRNG sRNG;
|
||||||
sRNG.SeedRandomDevice();
|
sRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||||
|
|
||||||
int Nsimd = vec::Nsimd();
|
int Nsimd = vec::Nsimd();
|
||||||
|
|
||||||
@ -409,7 +409,7 @@ template<class scal, class vec,class functor >
|
|||||||
void ExchangeTester(const functor &func)
|
void ExchangeTester(const functor &func)
|
||||||
{
|
{
|
||||||
GridSerialRNG sRNG;
|
GridSerialRNG sRNG;
|
||||||
sRNG.SeedRandomDevice();
|
sRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||||
|
|
||||||
int Nsimd = vec::Nsimd();
|
int Nsimd = vec::Nsimd();
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ int main (int argc, char ** argv)
|
|||||||
GridRedBlackCartesian rbFine(latt_size,simd_layout,mpi_layout);
|
GridRedBlackCartesian rbFine(latt_size,simd_layout,mpi_layout);
|
||||||
GridParallelRNG fRNG(&Fine);
|
GridParallelRNG fRNG(&Fine);
|
||||||
|
|
||||||
// fRNG.SeedRandomDevice();
|
// fRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9});
|
||||||
std::vector<int> seeds({1,2,3,4});
|
std::vector<int> seeds({1,2,3,4});
|
||||||
fRNG.SeedFixedIntegers(seeds);
|
fRNG.SeedFixedIntegers(seeds);
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ int main (int argc, char ** argv)
|
|||||||
GridCartesian Fine (latt_size,simd_layout,mpi_layout);
|
GridCartesian Fine (latt_size,simd_layout,mpi_layout);
|
||||||
GridRedBlackCartesian RBFine(latt_size,simd_layout,mpi_layout,mask,1);
|
GridRedBlackCartesian RBFine(latt_size,simd_layout,mpi_layout,mask,1);
|
||||||
|
|
||||||
GridParallelRNG FineRNG(&Fine); FineRNG.SeedRandomDevice();
|
GridParallelRNG FineRNG(&Fine); FineRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||||
|
|
||||||
LatticeComplex U(&Fine);
|
LatticeComplex U(&Fine);
|
||||||
LatticeComplex ShiftU(&Fine);
|
LatticeComplex ShiftU(&Fine);
|
||||||
|
@ -49,7 +49,7 @@ int main (int argc, char ** argv)
|
|||||||
GridCartesian Fine (latt_size,simd_layout,mpi_layout);
|
GridCartesian Fine (latt_size,simd_layout,mpi_layout);
|
||||||
GridRedBlackCartesian RBFine(latt_size,simd_layout,mpi_layout,mask,1);
|
GridRedBlackCartesian RBFine(latt_size,simd_layout,mpi_layout,mask,1);
|
||||||
|
|
||||||
GridParallelRNG FineRNG(&Fine); FineRNG.SeedRandomDevice();
|
GridParallelRNG FineRNG(&Fine); FineRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||||
|
|
||||||
LatticeComplex err(&Fine);
|
LatticeComplex err(&Fine);
|
||||||
LatticeComplex U(&Fine);
|
LatticeComplex U(&Fine);
|
||||||
|
@ -41,7 +41,7 @@ int main (int argc, char ** argv)
|
|||||||
|
|
||||||
GridCartesian Fine(latt_size,simd_layout,mpi_layout);
|
GridCartesian Fine(latt_size,simd_layout,mpi_layout);
|
||||||
|
|
||||||
GridParallelRNG FineRNG(&Fine); FineRNG.SeedRandomDevice();
|
GridParallelRNG FineRNG(&Fine); FineRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||||
|
|
||||||
LatticeComplex U(&Fine);
|
LatticeComplex U(&Fine);
|
||||||
LatticeComplex ShiftU(&Fine);
|
LatticeComplex ShiftU(&Fine);
|
||||||
|
@ -245,7 +245,7 @@ int main(int argc, char *argv[])
|
|||||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||||
GridSerialRNG sRNG;
|
GridSerialRNG sRNG;
|
||||||
|
|
||||||
sRNG.SeedRandomDevice();
|
sRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||||
|
|
||||||
std::cout << GridLogMessage << "======== Test algebra" << std::endl;
|
std::cout << GridLogMessage << "======== Test algebra" << std::endl;
|
||||||
createTestAlgebra();
|
createTestAlgebra();
|
||||||
|
@ -50,7 +50,7 @@ int main (int argc, char ** argv)
|
|||||||
GridParallelRNG pRNG(&Grid);
|
GridParallelRNG pRNG(&Grid);
|
||||||
// std::vector<int> seeds({1,2,3,4});
|
// std::vector<int> seeds({1,2,3,4});
|
||||||
// pRNG.SeedFixedIntegers(seeds);
|
// pRNG.SeedFixedIntegers(seeds);
|
||||||
pRNG.SeedRandomDevice();
|
pRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||||
|
|
||||||
typedef typename GparityWilsonFermionR::FermionField FermionField;
|
typedef typename GparityWilsonFermionR::FermionField FermionField;
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
// Projectors
|
// Projectors
|
||||||
GridParallelRNG gridRNG(grid);
|
GridParallelRNG gridRNG(grid);
|
||||||
gridRNG.SeedRandomDevice();
|
gridRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||||
SU3Adjoint::LatticeAdjMatrix Gauss(grid);
|
SU3Adjoint::LatticeAdjMatrix Gauss(grid);
|
||||||
SU3::LatticeAlgebraVector ha(grid);
|
SU3::LatticeAlgebraVector ha(grid);
|
||||||
SU3::LatticeAlgebraVector hb(grid);
|
SU3::LatticeAlgebraVector hb(grid);
|
||||||
|
@ -89,8 +89,8 @@ int main(int argc, char **argv) {
|
|||||||
GridSerialRNG SerialRNG;
|
GridSerialRNG SerialRNG;
|
||||||
GridSerialRNG SerialRNG1;
|
GridSerialRNG SerialRNG1;
|
||||||
|
|
||||||
FineRNG.SeedRandomDevice();
|
FineRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||||
SerialRNG.SeedRandomDevice();
|
SerialRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||||
|
|
||||||
std::cout << "SerialRNG" << SerialRNG._generators[0] << std::endl;
|
std::cout << "SerialRNG" << SerialRNG._generators[0] << std::endl;
|
||||||
|
|
||||||
|
@ -43,10 +43,10 @@ int main (int argc, char ** argv)
|
|||||||
|
|
||||||
std::vector<int> seeds({1,2,3,4});
|
std::vector<int> seeds({1,2,3,4});
|
||||||
|
|
||||||
GridSerialRNG sRNG; sRNG.SeedRandomDevice();
|
GridSerialRNG sRNG; sRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||||
GridSerialRNG fsRNG; fsRNG.SeedFixedIntegers(seeds);
|
GridSerialRNG fsRNG; fsRNG.SeedFixedIntegers(seeds);
|
||||||
|
|
||||||
GridParallelRNG pRNG(&Grid); pRNG.SeedRandomDevice();
|
GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||||
GridParallelRNG fpRNG(&Grid); fpRNG.SeedFixedIntegers(seeds);
|
GridParallelRNG fpRNG(&Grid); fpRNG.SeedFixedIntegers(seeds);
|
||||||
|
|
||||||
SpinMatrix rnd ;
|
SpinMatrix rnd ;
|
||||||
|
@ -51,7 +51,7 @@ int main (int argc, char ** argv)
|
|||||||
std::vector<int> seeds({1,2,3,4});
|
std::vector<int> seeds({1,2,3,4});
|
||||||
GridParallelRNG pRNG(&Grid);
|
GridParallelRNG pRNG(&Grid);
|
||||||
pRNG.SeedFixedIntegers(seeds);
|
pRNG.SeedFixedIntegers(seeds);
|
||||||
// pRNG.SeedRandomDevice();
|
// pRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9});
|
||||||
|
|
||||||
typedef typename ImprovedStaggeredFermionR::FermionField FermionField;
|
typedef typename ImprovedStaggeredFermionR::FermionField FermionField;
|
||||||
typedef typename ImprovedStaggeredFermionR::ComplexField ComplexField;
|
typedef typename ImprovedStaggeredFermionR::ComplexField ComplexField;
|
||||||
|
@ -2,11 +2,10 @@
|
|||||||
|
|
||||||
Grid physics library, www.github.com/paboyle/Grid
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
Source file: ./tests/Test_wilson_even_odd.cc
|
Source file: ./tests/Test_wilson_tm_even_odd.cc
|
||||||
|
|
||||||
Copyright (C) 2015
|
Copyright (C) 2015
|
||||||
|
|
||||||
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
|
||||||
Author: paboyle <paboyle@ph.ed.ac.uk>
|
Author: paboyle <paboyle@ph.ed.ac.uk>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
@ -62,7 +61,7 @@ int main (int argc, char ** argv)
|
|||||||
GridParallelRNG pRNG(&Grid);
|
GridParallelRNG pRNG(&Grid);
|
||||||
// std::vector<int> seeds({1,2,3,4});
|
// std::vector<int> seeds({1,2,3,4});
|
||||||
// pRNG.SeedFixedIntegers(seeds);
|
// pRNG.SeedFixedIntegers(seeds);
|
||||||
pRNG.SeedRandomDevice();
|
pRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||||
|
|
||||||
LatticeFermion src (&Grid); random(pRNG,src);
|
LatticeFermion src (&Grid); random(pRNG,src);
|
||||||
LatticeFermion phi (&Grid); random(pRNG,phi);
|
LatticeFermion phi (&Grid); random(pRNG,phi);
|
||||||
@ -89,8 +88,8 @@ int main (int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
RealD mass=0.1;
|
RealD mass=0.1;
|
||||||
RealD mu = 0.1;
|
|
||||||
WilsonTMFermionR Dw(Umu,Grid,RBGrid,mass,mu);
|
WilsonFermionR Dw(Umu,Grid,RBGrid,mass);
|
||||||
|
|
||||||
LatticeFermion src_e (&RBGrid);
|
LatticeFermion src_e (&RBGrid);
|
||||||
LatticeFermion src_o (&RBGrid);
|
LatticeFermion src_o (&RBGrid);
|
||||||
@ -207,7 +206,7 @@ int main (int argc, char ** argv)
|
|||||||
pickCheckerboard(Odd ,phi_o,phi);
|
pickCheckerboard(Odd ,phi_o,phi);
|
||||||
RealD t1,t2;
|
RealD t1,t2;
|
||||||
|
|
||||||
SchurDiagMooeeOperator<WilsonTMFermionR,LatticeFermion> HermOpEO(Dw);
|
SchurDiagMooeeOperator<WilsonFermionR,LatticeFermion> HermOpEO(Dw);
|
||||||
HermOpEO.MpcDagMpc(chi_e,dchi_e,t1,t2);
|
HermOpEO.MpcDagMpc(chi_e,dchi_e,t1,t2);
|
||||||
HermOpEO.MpcDagMpc(chi_o,dchi_o,t1,t2);
|
HermOpEO.MpcDagMpc(chi_o,dchi_o,t1,t2);
|
||||||
|
|
||||||
|
@ -2,10 +2,11 @@
|
|||||||
|
|
||||||
Grid physics library, www.github.com/paboyle/Grid
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
Source file: ./tests/Test_wilson_tm_even_odd.cc
|
Source file: ./tests/Test_wilson_even_odd.cc
|
||||||
|
|
||||||
Copyright (C) 2015
|
Copyright (C) 2015
|
||||||
|
|
||||||
|
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
||||||
Author: paboyle <paboyle@ph.ed.ac.uk>
|
Author: paboyle <paboyle@ph.ed.ac.uk>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
@ -61,7 +62,7 @@ int main (int argc, char ** argv)
|
|||||||
GridParallelRNG pRNG(&Grid);
|
GridParallelRNG pRNG(&Grid);
|
||||||
// std::vector<int> seeds({1,2,3,4});
|
// std::vector<int> seeds({1,2,3,4});
|
||||||
// pRNG.SeedFixedIntegers(seeds);
|
// pRNG.SeedFixedIntegers(seeds);
|
||||||
pRNG.SeedRandomDevice();
|
pRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||||
|
|
||||||
LatticeFermion src (&Grid); random(pRNG,src);
|
LatticeFermion src (&Grid); random(pRNG,src);
|
||||||
LatticeFermion phi (&Grid); random(pRNG,phi);
|
LatticeFermion phi (&Grid); random(pRNG,phi);
|
||||||
@ -88,8 +89,8 @@ int main (int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
RealD mass=0.1;
|
RealD mass=0.1;
|
||||||
|
RealD mu = 0.1;
|
||||||
WilsonFermionR Dw(Umu,Grid,RBGrid,mass);
|
WilsonTMFermionR Dw(Umu,Grid,RBGrid,mass,mu);
|
||||||
|
|
||||||
LatticeFermion src_e (&RBGrid);
|
LatticeFermion src_e (&RBGrid);
|
||||||
LatticeFermion src_o (&RBGrid);
|
LatticeFermion src_o (&RBGrid);
|
||||||
@ -206,7 +207,7 @@ int main (int argc, char ** argv)
|
|||||||
pickCheckerboard(Odd ,phi_o,phi);
|
pickCheckerboard(Odd ,phi_o,phi);
|
||||||
RealD t1,t2;
|
RealD t1,t2;
|
||||||
|
|
||||||
SchurDiagMooeeOperator<WilsonFermionR,LatticeFermion> HermOpEO(Dw);
|
SchurDiagMooeeOperator<WilsonTMFermionR,LatticeFermion> HermOpEO(Dw);
|
||||||
HermOpEO.MpcDagMpc(chi_e,dchi_e,t1,t2);
|
HermOpEO.MpcDagMpc(chi_e,dchi_e,t1,t2);
|
||||||
HermOpEO.MpcDagMpc(chi_o,dchi_o,t1,t2);
|
HermOpEO.MpcDagMpc(chi_o,dchi_o,t1,t2);
|
||||||
|
|
@ -53,7 +53,7 @@ int main (int argc, char ** argv)
|
|||||||
std::cout<<GridLogMessage << "Grid is setup to use "<<threads<<" threads"<<std::endl;
|
std::cout<<GridLogMessage << "Grid is setup to use "<<threads<<" threads"<<std::endl;
|
||||||
|
|
||||||
|
|
||||||
const int Ls=8;
|
const int Ls=10;
|
||||||
GridCartesian * UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi());
|
GridCartesian * UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi());
|
||||||
GridCartesian * FGrid = SpaceTimeGrid::makeFiveDimGrid(Ls,UGrid);
|
GridCartesian * FGrid = SpaceTimeGrid::makeFiveDimGrid(Ls,UGrid);
|
||||||
GridRedBlackCartesian * UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid);
|
GridRedBlackCartesian * UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid);
|
||||||
@ -87,13 +87,27 @@ int main (int argc, char ** argv)
|
|||||||
RealD mass=0.1;
|
RealD mass=0.1;
|
||||||
RealD M5 =1.8;
|
RealD M5 =1.8;
|
||||||
std::vector < std::complex<double> > omegas;
|
std::vector < std::complex<double> > omegas;
|
||||||
|
#if 0
|
||||||
for(int i=0;i<Ls;i++){
|
for(int i=0;i<Ls;i++){
|
||||||
double imag = 0.;
|
double imag = 0.;
|
||||||
if (i==0) imag=1.;
|
if (i==0) imag=1.;
|
||||||
if (i==Ls-1) imag=-1.;
|
if (i==Ls-1) imag=-1.;
|
||||||
std::complex<double> temp (0.25+0.01*i, imag*0.1);
|
std::complex<double> temp (0.25+0.01*i, imag*0.01);
|
||||||
omegas.push_back(temp);
|
omegas.push_back(temp);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
omegas.push_back( std::complex<double>(1.45806438985048,-0) );
|
||||||
|
omegas.push_back( std::complex<double>(1.18231318389348,-0) );
|
||||||
|
omegas.push_back( std::complex<double>(0.830951166685955,-0) );
|
||||||
|
omegas.push_back( std::complex<double>(0.542352409156791,-0) );
|
||||||
|
omegas.push_back( std::complex<double>(0.341985020453729,-0) );
|
||||||
|
omegas.push_back( std::complex<double>(0.21137902619029,-0) );
|
||||||
|
omegas.push_back( std::complex<double>(0.126074299502912,-0) );
|
||||||
|
omegas.push_back( std::complex<double>(0.0990136651962626,-0) );
|
||||||
|
omegas.push_back( std::complex<double>(0.0686324988446592,0.0550658530827402) );
|
||||||
|
omegas.push_back( std::complex<double>(0.0686324988446592,-0.0550658530827402) );
|
||||||
|
#endif
|
||||||
|
|
||||||
ZMobiusFermionR Ddwf(Umu, *FGrid, *FrbGrid, *UGrid, *UrbGrid, mass, M5, omegas,1.,0.);
|
ZMobiusFermionR Ddwf(Umu, *FGrid, *FrbGrid, *UGrid, *UrbGrid, mass, M5, omegas,1.,0.);
|
||||||
// DomainWallFermionR Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5);
|
// DomainWallFermionR Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5);
|
||||||
|
|
||||||
|
@ -54,8 +54,8 @@ int main (int argc, char ** argv)
|
|||||||
|
|
||||||
std::vector<int> seeds({1,2,3,4});
|
std::vector<int> seeds({1,2,3,4});
|
||||||
|
|
||||||
GridParallelRNG RNG5(FGrid); RNG5.SeedRandomDevice();
|
GridParallelRNG RNG5(FGrid); RNG5.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||||
GridParallelRNG RNG4(UGrid); RNG4.SeedRandomDevice();
|
GridParallelRNG RNG4(UGrid); RNG4.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||||
|
|
||||||
FermionField phi (FGrid); gaussian(RNG5,phi);
|
FermionField phi (FGrid); gaussian(RNG5,phi);
|
||||||
FermionField Mphi (FGrid);
|
FermionField Mphi (FGrid);
|
||||||
|
@ -50,7 +50,7 @@ int main (int argc, char ** argv)
|
|||||||
std::vector<int> seeds({1,2,3,4});
|
std::vector<int> seeds({1,2,3,4});
|
||||||
|
|
||||||
GridParallelRNG pRNG(&Grid);
|
GridParallelRNG pRNG(&Grid);
|
||||||
pRNG.SeedRandomDevice();
|
pRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||||
|
|
||||||
LatticeGaugeField U(&Grid);
|
LatticeGaugeField U(&Grid);
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ int main (int argc, char ** argv)
|
|||||||
std::vector<int> seeds({1,2,3,4});
|
std::vector<int> seeds({1,2,3,4});
|
||||||
|
|
||||||
GridParallelRNG pRNG(&Grid);
|
GridParallelRNG pRNG(&Grid);
|
||||||
pRNG.SeedRandomDevice();
|
pRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||||
|
|
||||||
LatticeGaugeField U(&Grid);
|
LatticeGaugeField U(&Grid);
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ int main (int argc, char ** argv)
|
|||||||
std::vector<int> seeds({1,2,3,4});
|
std::vector<int> seeds({1,2,3,4});
|
||||||
|
|
||||||
GridParallelRNG pRNG(&Grid);
|
GridParallelRNG pRNG(&Grid);
|
||||||
pRNG.SeedRandomDevice();
|
pRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||||
|
|
||||||
LatticeFermion phi (&Grid); gaussian(pRNG,phi);
|
LatticeFermion phi (&Grid); gaussian(pRNG,phi);
|
||||||
LatticeFermion Mphi (&Grid);
|
LatticeFermion Mphi (&Grid);
|
||||||
|
@ -50,7 +50,7 @@ int main (int argc, char ** argv)
|
|||||||
std::vector<int> seeds({1,2,3,4});
|
std::vector<int> seeds({1,2,3,4});
|
||||||
|
|
||||||
GridParallelRNG pRNG(&Grid);
|
GridParallelRNG pRNG(&Grid);
|
||||||
pRNG.SeedRandomDevice();
|
pRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||||
|
|
||||||
LatticeFermion phi (&Grid); gaussian(pRNG,phi);
|
LatticeFermion phi (&Grid); gaussian(pRNG,phi);
|
||||||
LatticeFermion Mphi (&Grid);
|
LatticeFermion Mphi (&Grid);
|
||||||
|
@ -50,7 +50,7 @@ int main (int argc, char ** argv)
|
|||||||
std::vector<int> seeds({1,2,3,4});
|
std::vector<int> seeds({1,2,3,4});
|
||||||
|
|
||||||
GridParallelRNG pRNG(&Grid);
|
GridParallelRNG pRNG(&Grid);
|
||||||
pRNG.SeedRandomDevice();
|
pRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||||
|
|
||||||
LatticeFermion phi (&Grid); gaussian(pRNG,phi);
|
LatticeFermion phi (&Grid); gaussian(pRNG,phi);
|
||||||
LatticeFermion Mphi (&Grid);
|
LatticeFermion Mphi (&Grid);
|
||||||
|
@ -30,14 +30,6 @@
|
|||||||
using namespace Grid;
|
using namespace Grid;
|
||||||
using namespace Hadrons;
|
using namespace Hadrons;
|
||||||
|
|
||||||
static Gamma::Algebra gmu[4] =
|
|
||||||
{
|
|
||||||
Gamma::Algebra::GammaX,
|
|
||||||
Gamma::Algebra::GammaY,
|
|
||||||
Gamma::Algebra::GammaZ,
|
|
||||||
Gamma::Algebra::GammaT
|
|
||||||
};
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
// initialization //////////////////////////////////////////////////////////
|
// initialization //////////////////////////////////////////////////////////
|
||||||
@ -110,7 +102,7 @@ int main(int argc, char *argv[])
|
|||||||
seqName.push_back(std::vector<std::string>(Nd));
|
seqName.push_back(std::vector<std::string>(Nd));
|
||||||
for (unsigned int mu = 0; mu < Nd; ++mu)
|
for (unsigned int mu = 0; mu < Nd; ++mu)
|
||||||
{
|
{
|
||||||
seqPar.gamma = gmu[mu];
|
seqPar.gamma = 0x1 << mu;
|
||||||
seqName[i][mu] = "G" + std::to_string(seqPar.gamma)
|
seqName[i][mu] = "G" + std::to_string(seqPar.gamma)
|
||||||
+ "_" + std::to_string(seqPar.tA) + "-"
|
+ "_" + std::to_string(seqPar.tA) + "-"
|
||||||
+ qName[i];
|
+ qName[i];
|
||||||
@ -135,11 +127,11 @@ int main(int argc, char *argv[])
|
|||||||
for (unsigned int i = 0; i < flavour.size(); ++i)
|
for (unsigned int i = 0; i < flavour.size(); ++i)
|
||||||
for (unsigned int j = i; j < flavour.size(); ++j)
|
for (unsigned int j = i; j < flavour.size(); ++j)
|
||||||
{
|
{
|
||||||
mesPar.output = "mesons/Z2_" + flavour[i] + flavour[j];
|
mesPar.output = "mesons/Z2_" + flavour[i] + flavour[j];
|
||||||
mesPar.q1 = qName[i];
|
mesPar.q1 = qName[i];
|
||||||
mesPar.q2 = qName[j];
|
mesPar.q2 = qName[j];
|
||||||
mesPar.gammaSource = Gamma::Algebra::Gamma5;
|
mesPar.gammas = "all";
|
||||||
mesPar.gammaSink = Gamma::Algebra::Gamma5;
|
mesPar.mom = "0. 0. 0. 0.";
|
||||||
application.createModule<MContraction::Meson>("meson_Z2_"
|
application.createModule<MContraction::Meson>("meson_Z2_"
|
||||||
+ std::to_string(t)
|
+ std::to_string(t)
|
||||||
+ "_"
|
+ "_"
|
||||||
@ -157,6 +149,8 @@ int main(int argc, char *argv[])
|
|||||||
+ std::to_string(mu);
|
+ std::to_string(mu);
|
||||||
mesPar.q1 = qName[i];
|
mesPar.q1 = qName[i];
|
||||||
mesPar.q2 = seqName[j][mu];
|
mesPar.q2 = seqName[j][mu];
|
||||||
|
mesPar.gammas = "all";
|
||||||
|
mesPar.mom = "0. 0. 0. 0.";
|
||||||
application.createModule<MContraction::Meson>("3pt_Z2_"
|
application.createModule<MContraction::Meson>("3pt_Z2_"
|
||||||
+ std::to_string(t)
|
+ std::to_string(t)
|
||||||
+ "_"
|
+ "_"
|
||||||
|
@ -96,12 +96,16 @@ int main(int argc, char *argv[])
|
|||||||
mesPar.output = "mesons/pt_" + flavour[i] + flavour[j];
|
mesPar.output = "mesons/pt_" + flavour[i] + flavour[j];
|
||||||
mesPar.q1 = "Qpt_" + flavour[i];
|
mesPar.q1 = "Qpt_" + flavour[i];
|
||||||
mesPar.q2 = "Qpt_" + flavour[j];
|
mesPar.q2 = "Qpt_" + flavour[j];
|
||||||
|
mesPar.gammas = "all";
|
||||||
|
mesPar.mom = "0. 0. 0. 0.";
|
||||||
application.createModule<MContraction::Meson>("meson_pt_"
|
application.createModule<MContraction::Meson>("meson_pt_"
|
||||||
+ flavour[i] + flavour[j],
|
+ flavour[i] + flavour[j],
|
||||||
mesPar);
|
mesPar);
|
||||||
mesPar.output = "mesons/Z2_" + flavour[i] + flavour[j];
|
mesPar.output = "mesons/Z2_" + flavour[i] + flavour[j];
|
||||||
mesPar.q1 = "QZ2_" + flavour[i];
|
mesPar.q1 = "QZ2_" + flavour[i];
|
||||||
mesPar.q2 = "QZ2_" + flavour[j];
|
mesPar.q2 = "QZ2_" + flavour[j];
|
||||||
|
mesPar.gammas = "all";
|
||||||
|
mesPar.mom = "0. 0. 0. 0.";
|
||||||
application.createModule<MContraction::Meson>("meson_Z2_"
|
application.createModule<MContraction::Meson>("meson_Z2_"
|
||||||
+ flavour[i] + flavour[j],
|
+ flavour[i] + flavour[j],
|
||||||
mesPar);
|
mesPar);
|
||||||
|
@ -43,7 +43,7 @@ Gamma::Algebra Gmu[] = {Gamma::Algebra::GammaX, Gamma::Algebra::GammaY, Gamma::A
|
|||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
Grid_init(&argc, &argv);
|
Grid_init(&argc, &argv);
|
||||||
|
|
||||||
const int Ls = 16;
|
const int Ls = 10;
|
||||||
|
|
||||||
GridCartesian* UGrid = SpaceTimeGrid::makeFourDimGrid(
|
GridCartesian* UGrid = SpaceTimeGrid::makeFourDimGrid(
|
||||||
GridDefaultLatt(), GridDefaultSimd(Nd, vComplex::Nsimd()),
|
GridDefaultLatt(), GridDefaultSimd(Nd, vComplex::Nsimd()),
|
||||||
@ -80,13 +80,27 @@ int main(int argc, char** argv) {
|
|||||||
RealD mass = 0.01;
|
RealD mass = 0.01;
|
||||||
RealD M5 = 1.8;
|
RealD M5 = 1.8;
|
||||||
std::vector < std::complex<double> > omegas;
|
std::vector < std::complex<double> > omegas;
|
||||||
|
#if 0
|
||||||
for(int i=0;i<Ls;i++){
|
for(int i=0;i<Ls;i++){
|
||||||
double imag = 0.;
|
double imag = 0.;
|
||||||
if (i==0) imag=1.;
|
if (i==0) imag=1.;
|
||||||
if (i==Ls-1) imag=-1.;
|
if (i==Ls-1) imag=-1.;
|
||||||
std::complex<double> temp (0.25+0.01*i, imag*0.01);
|
std::complex<double> temp (0.25+0.01*i, imag*0.01);
|
||||||
omegas.push_back(temp);
|
omegas.push_back(temp);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
omegas.push_back( std::complex<double>(1.45806438985048,-0) );
|
||||||
|
omegas.push_back( std::complex<double>(1.18231318389348,-0) );
|
||||||
|
omegas.push_back( std::complex<double>(0.830951166685955,-0) );
|
||||||
|
omegas.push_back( std::complex<double>(0.542352409156791,-0) );
|
||||||
|
omegas.push_back( std::complex<double>(0.341985020453729,-0) );
|
||||||
|
omegas.push_back( std::complex<double>(0.21137902619029,-0) );
|
||||||
|
omegas.push_back( std::complex<double>(0.126074299502912,-0) );
|
||||||
|
omegas.push_back( std::complex<double>(0.0990136651962626,-0) );
|
||||||
|
omegas.push_back( std::complex<double>(0.0686324988446592,0.0550658530827402) );
|
||||||
|
omegas.push_back( std::complex<double>(0.0686324988446592,-0.0550658530827402) );
|
||||||
|
#endif
|
||||||
|
|
||||||
ZMobiusFermionR Ddwf(Umu, *FGrid, *FrbGrid, *UGrid, *UrbGrid, mass, M5, omegas,1.,0.);
|
ZMobiusFermionR Ddwf(Umu, *FGrid, *FrbGrid, *UGrid, *UrbGrid, mass, M5, omegas,1.,0.);
|
||||||
|
|
||||||
LatticeFermion src_o(FrbGrid);
|
LatticeFermion src_o(FrbGrid);
|
||||||
|
3
tests/testu01/Makefile.am
Normal file
3
tests/testu01/Makefile.am
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
AM_LDFLAGS += -L$(LIBRARY_PATH) -ltestu01 -lprobdist -lmylib -lm
|
||||||
|
AM_CXXFLAGS += -I$(C_INCLUDE_PATH)
|
||||||
|
include Make.inc
|
175
tests/testu01/Test_smallcrush.cc
Normal file
175
tests/testu01/Test_smallcrush.cc
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
/*************************************************************************************
|
||||||
|
|
||||||
|
Grid physics library, www.github.com/paboyle/Grid
|
||||||
|
|
||||||
|
Source file: ./tests/Test_smallcrush.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;
|
||||||
|
using namespace Grid::QCD;
|
||||||
|
|
||||||
|
// Wrap Grid's parallel RNG for testU01
|
||||||
|
#undef BIG_CRUSH // Big crush enable (long running)
|
||||||
|
#define MIDDLE_CRUSH // Big crush enable (long running)
|
||||||
|
#undef SMALL_CRUSH // Big crush enable (long running)
|
||||||
|
#undef TEST_RNG_STANDALONE // Test serial RNGs in isolation
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#include "TestU01.h"
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::ranlux48> EngineRanlux;
|
||||||
|
std::vector<std::mt19937> EngineMT;
|
||||||
|
|
||||||
|
#include <Grid/sitmo_rng/sitmo_prng_engine.hpp>
|
||||||
|
std::vector<sitmo::prng_engine> EngineSitmo;
|
||||||
|
|
||||||
|
std::uniform_int_distribution<uint32_t> uid;
|
||||||
|
|
||||||
|
uint32_t GetU01Ranlux(void) {
|
||||||
|
return uid(EngineRanlux[0]);
|
||||||
|
};
|
||||||
|
uint32_t GetU01MT(void) {
|
||||||
|
return uid(EngineMT[0]);
|
||||||
|
};
|
||||||
|
uint32_t GetU01Sitmo(void) {
|
||||||
|
return uid(EngineSitmo[0]);
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef Grid::GridRNGbase::RngEngine RngEngine;
|
||||||
|
|
||||||
|
struct TestRNG {
|
||||||
|
public:
|
||||||
|
static GridParallelRNG *pRNG;
|
||||||
|
static GridSerialRNG *sRNG;
|
||||||
|
static GridBase *_grid;
|
||||||
|
static RngEngine Eng;
|
||||||
|
static uint64_t site;
|
||||||
|
static uint64_t gsites;
|
||||||
|
static char *name;
|
||||||
|
|
||||||
|
static void Init(GridParallelRNG *_pRNG,GridSerialRNG *_sRNG,GridBase *grid) {
|
||||||
|
pRNG = _pRNG;
|
||||||
|
sRNG = _sRNG;
|
||||||
|
_grid= grid;
|
||||||
|
gsites= grid->_gsites;
|
||||||
|
site = 0;
|
||||||
|
}
|
||||||
|
static uint32_t GetU01(void) {
|
||||||
|
uint32_t ret_val;
|
||||||
|
ret_val = pRNG->GlobalU01(site);
|
||||||
|
site=(site+1)%gsites;
|
||||||
|
return ret_val;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
GridParallelRNG *TestRNG::pRNG;
|
||||||
|
GridSerialRNG *TestRNG::sRNG;
|
||||||
|
GridBase *TestRNG::_grid;
|
||||||
|
RngEngine TestRNG::Eng;
|
||||||
|
uint64_t TestRNG::site;
|
||||||
|
uint64_t TestRNG::gsites;
|
||||||
|
|
||||||
|
#ifdef RNG_SITMO
|
||||||
|
char * TestRNG::name = (char *)"Grid_Sitmo";
|
||||||
|
#endif
|
||||||
|
#ifdef RNG_RANLUX
|
||||||
|
char * TestRNG::name = (char *)"Grid_ranlux48";
|
||||||
|
#endif
|
||||||
|
#ifdef RNG_MT19937
|
||||||
|
char * TestRNG::name = (char *)"Grid_mt19937";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int main (int argc, char ** argv)
|
||||||
|
{
|
||||||
|
Grid_init(&argc,&argv);
|
||||||
|
|
||||||
|
std::vector<int> latt_size = GridDefaultLatt();
|
||||||
|
std::vector<int> simd_layout = GridDefaultSimd(4,vComplex::Nsimd());
|
||||||
|
std::vector<int> mpi_layout = GridDefaultMpi();
|
||||||
|
|
||||||
|
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||||
|
|
||||||
|
std::vector<int> seeds({1,2,3,4});
|
||||||
|
std::seed_seq seq(seeds.begin(),seeds.end());
|
||||||
|
|
||||||
|
EngineRanlux.push_back(std::ranlux48(seq));
|
||||||
|
EngineMT.push_back(std::mt19937(seq));
|
||||||
|
EngineSitmo.push_back(sitmo::prng_engine(seq));
|
||||||
|
|
||||||
|
std::cout << GridLogMessage<< "Initialising Grid RNGs "<<std::endl;
|
||||||
|
GridParallelRNG pRNG(&Grid);
|
||||||
|
pRNG.SeedFixedIntegers(std::vector<int>({43,12,7019,9}));
|
||||||
|
GridSerialRNG sRNG;
|
||||||
|
sRNG.SeedFixedIntegers(std::vector<int>({102,12,99,15}));
|
||||||
|
std::cout << GridLogMessage<< "Initialised Grid RNGs "<<std::endl;
|
||||||
|
|
||||||
|
TestRNG::Init(&pRNG,&sRNG,&Grid);
|
||||||
|
std::cout << GridLogMessage<< "Grid RNG's are "<< std::string(TestRNG::name) <<std::endl;
|
||||||
|
|
||||||
|
unif01_Gen * gen;
|
||||||
|
|
||||||
|
#ifdef TEST_RNG_STANDALONE
|
||||||
|
std::cout << GridLogMessage<< "Testing Standalone Ranlux" <<std::endl;
|
||||||
|
gen = unif01_CreateExternGenBits ((char *)"GridRanlux",GetU01Ranlux);
|
||||||
|
bbattery_SmallCrush (gen);
|
||||||
|
unif01_DeleteExternGenBits(gen);
|
||||||
|
std::cout << GridLogMessage<< "Testing Standalone Ranlux is complete" <<std::endl;
|
||||||
|
|
||||||
|
std::cout << GridLogMessage<< "Testing Standalone Mersenne Twister" <<std::endl;
|
||||||
|
gen = unif01_CreateExternGenBits ((char *)"GridMT",GetU01MT);
|
||||||
|
bbattery_SmallCrush (gen);
|
||||||
|
unif01_DeleteExternGenBits(gen);
|
||||||
|
std::cout << GridLogMessage<< "Testing Standalone Mersenne Twister is complete" <<std::endl;
|
||||||
|
|
||||||
|
std::cout << GridLogMessage<< "Testing Standalone Sitmo" <<std::endl;
|
||||||
|
gen = unif01_CreateExternGenBits ((char *)"GridSitmo",GetU01Sitmo);
|
||||||
|
bbattery_SmallCrush (gen);
|
||||||
|
unif01_DeleteExternGenBits(gen);
|
||||||
|
std::cout << GridLogMessage<< "Testing Standalone Sitmo is complete" <<std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef BIG_CRUSH
|
||||||
|
std::cout << GridLogMessage<< "Testing Grid BigCrush for "<< std::string(TestRNG::name) <<std::endl;
|
||||||
|
gen = unif01_CreateExternGenBits(TestRNG::name,TestRNG::GetU01);
|
||||||
|
bbattery_BigCrush (gen);
|
||||||
|
std::cout << GridLogMessage<< "Testing Grid BigCrush "<< std::string(TestRNG::name)<<" is complete" <<std::endl;
|
||||||
|
#endif
|
||||||
|
#ifdef MIDDLE_CRUSH
|
||||||
|
std::cout << GridLogMessage<< "Testing Grid Crush for "<< std::string(TestRNG::name) <<std::endl;
|
||||||
|
gen = unif01_CreateExternGenBits(TestRNG::name,TestRNG::GetU01);
|
||||||
|
bbattery_Crush (gen);
|
||||||
|
std::cout << GridLogMessage<< "Testing Grid Crush "<< std::string(TestRNG::name)<<" is complete" <<std::endl;
|
||||||
|
#endif
|
||||||
|
#ifdef SMALL_CRUSH
|
||||||
|
std::cout << GridLogMessage<< "Testing Grid SmallCrush for "<< std::string(TestRNG::name) <<std::endl;
|
||||||
|
gen = unif01_CreateExternGenBits(TestRNG::name,TestRNG::GetU01);
|
||||||
|
bbattery_SmallCrush (gen);
|
||||||
|
std::cout << GridLogMessage<< "Testing Grid SmallCrush "<< std::string(TestRNG::name)<<" is complete" <<std::endl;
|
||||||
|
#endif
|
||||||
|
Grid_finalize();
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user