1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-06-17 15:27:06 +01:00

Zero changes, acceleartor on kernels and some thread loop changes

This commit is contained in:
paboyle
2018-01-27 23:47:38 +00:00
parent 45df59720e
commit 2d0bcc2606
40 changed files with 174 additions and 175 deletions

View File

@ -113,7 +113,7 @@ public:
GaugeLinkField sum(in.Grid());
for (int nu = 0; nu < Nd; nu++) {
sum = zero;
sum = Zero();
GaugeLinkField in_nu = PeekIndex<LorentzIndex>(in, nu);
GaugeLinkField out_nu(out.Grid());
for (int mu = 0; mu < Nd; mu++) {
@ -132,7 +132,7 @@ public:
for (int mu = 0; mu < Nd; mu++){
GaugeLinkField der_mu(der.Grid());
der_mu = zero;
der_mu = Zero();
for (int nu = 0; nu < Nd; nu++){
GaugeLinkField in_nu = PeekIndex<LorentzIndex>(in, nu);
der_mu += U[mu] * Cshift(in_nu, mu, 1) * adj(U[mu]) * in_nu;
@ -151,7 +151,7 @@ public:
for (int mu = 0; mu < Nd; mu++) {
GaugeLinkField der_mu(der.Grid());
der_mu = zero;
der_mu = Zero();
for (int nu = 0; nu < Nd; nu++) {
GaugeLinkField left_nu = PeekIndex<LorentzIndex>(left, nu);
GaugeLinkField right_nu = PeekIndex<LorentzIndex>(right, nu);

View File

@ -46,7 +46,7 @@ public:
}
}
static void DmuAmu(const std::vector<GaugeMat> &A,GaugeMat &dmuAmu) {
dmuAmu=zero;
dmuAmu=Zero();
for(int mu=0;mu<Nd;mu++){
dmuAmu = dmuAmu + A[mu] - Cshift(A[mu],mu,-1);
}
@ -123,7 +123,7 @@ public:
FFT theFFT((GridCartesian *)grid);
LatticeComplex Fp(grid);
LatticeComplex psq(grid); psq=zero;
LatticeComplex psq(grid); psq=Zero();
LatticeComplex pmu(grid);
LatticeComplex one(grid); one = Complex(1.0,0.0);

View File

@ -63,10 +63,10 @@ public:
// do nothing
}
virtual void MDeriv(const Field& in, Field& out){
out = zero;
out = Zero();
}
virtual void MDeriv(const Field& left, const Field& right, Field& out){
out = zero;
out = Zero();
}
};
@ -119,10 +119,10 @@ public:
// Correct
RealD MomentaAction(){
MomentaField inv(Mom.Grid());
inv = zero;
inv = Zero();
M.Minv(Mom, inv);
LatticeComplex Hloc(Mom.Grid());
Hloc = zero;
Hloc = Zero();
for (int mu = 0; mu < Nd; mu++) {
// This is not very general
// hide in the metric
@ -157,7 +157,7 @@ public:
// with respect to the gauge field
MomentaField MDer(in.Grid());
MomentaField X(in.Grid());
X = zero;
X = Zero();
M.Minv(in, X); // X = G in
M.MDeriv(X, MDer); // MDer = U * dS/dU
der = Implementation::projectForce(MDer); // Ta if gauge fields
@ -165,12 +165,12 @@ public:
}
void AuxiliaryFieldsDerivative(MomentaField& der){
der = zero;
der = Zero();
if (1){
// Auxiliary fields
MomentaField der_temp(der.Grid());
MomentaField X(der.Grid());
X=zero;
X=Zero();
//M.M(AuxMom, X); // X = M Aux
// Two derivative terms
// the Mderiv need separation of left and right terms
@ -185,7 +185,7 @@ public:
}
void DerivativeP(MomentaField& der){
der = zero;
der = Zero();
M.Minv(Mom, der);
// is the projection necessary here?
// no for fields in the algebra

View File

@ -162,7 +162,7 @@ public:
template <class cplx>
static void generatorSigmaY(int su2Index, iSUnMatrix<cplx> &ta) {
ta = zero;
ta = Zero();
int i1, i2;
su2SubGroupIndex(i1, i2, su2Index);
ta()()(i1, i2) = 1.0;
@ -172,7 +172,7 @@ public:
template <class cplx>
static void generatorSigmaX(int su2Index, iSUnMatrix<cplx> &ta) {
ta = zero;
ta = Zero();
cplx i(0.0, 1.0);
int i1, i2;
su2SubGroupIndex(i1, i2, su2Index);
@ -184,7 +184,7 @@ public:
template <class cplx>
static void generatorDiagonal(int diagIndex, iSUnMatrix<cplx> &ta) {
// diag ({1, 1, ..., 1}(k-times), -k, 0, 0, ...)
ta = zero;
ta = Zero();
int k = diagIndex + 1; // diagIndex starts from 0
for (int i = 0; i <= diagIndex; i++) { // k iterations
ta()()(i, i) = 1.0;
@ -299,11 +299,11 @@ public:
LatticeComplex ones(grid);
ones = 1.0;
LatticeComplex zeros(grid);
zeros = zero;
zeros = Zero();
LatticeReal rones(grid);
rones = 1.0;
LatticeReal rzeros(grid);
rzeros = zero;
rzeros = Zero();
LatticeComplex udet(grid); // determinant of real(staple)
LatticeInteger mask_true(grid);
mask_true = 1;
@ -432,13 +432,13 @@ public:
RealD numSites = sum(rtmp);
RealD numAccepted;
LatticeInteger Accepted(grid);
Accepted = zero;
Accepted = Zero();
LatticeInteger newlyAccepted(grid);
std::vector<LatticeReal> xr(4, grid);
std::vector<LatticeReal> a(4, grid);
LatticeReal d(grid);
d = zero;
d = Zero();
LatticeReal alpha(grid);
// std::cout<<GridLogMessage<<"xi "<<xi <<std::endl;
@ -475,7 +475,7 @@ public:
LatticeInteger ione(grid);
ione = 1;
LatticeInteger izero(grid);
izero = zero;
izero = Zero();
newlyAccepted = where(xrsq < thresh, ione, izero);
Accepted = where(newlyAccepted, newlyAccepted, Accepted);
@ -490,7 +490,7 @@ public:
} while ((numAccepted < numSites) && (hit < nheatbath));
// G. Set a0 = 1 - d;
a[0] = zero;
a[0] = Zero();
a[0] = where(wheremask, 1.0 - d, a[0]);
//////////////////////////////////////////
@ -528,7 +528,7 @@ public:
// Debug Checks
// SU2 check
LatticeSU2Matrix check(grid); // rotated matrix after hb
u = zero;
u = Zero();
check = ua * adj(ua) - 1.0;
check = where(Accepted, check, u);
assert(norm2(check) < 1.0e-4);
@ -538,7 +538,7 @@ public:
assert(norm2(check) < 1.0e-4);
LatticeMatrix Vcheck(grid);
Vcheck = zero;
Vcheck = Zero();
Vcheck = where(Accepted, V * adj(V) - 1.0, Vcheck);
// std::cout<<GridLogMessage << "SU3 check " <<norm2(Vcheck)<<std::endl;
assert(norm2(Vcheck) < 1.0e-4);
@ -622,7 +622,7 @@ public:
ComplexD cone(1.0, 0.0);
MatrixType ta;
lie = zero;
lie = Zero();
for (int a = 0; a < AdjointDimension; a++) {
random(pRNG, ca);
@ -647,7 +647,7 @@ public:
Complex ci(0.0, scale);
Matrix ta;
out = zero;
out = Zero();
for (int a = 0; a < AdjointDimension; a++) {
gaussian(pRNG, ca);
generator(a, ta);
@ -665,7 +665,7 @@ public:
LatticeMatrix la(grid);
Matrix ta;
out = zero;
out = Zero();
for (int a = 0; a < AdjointDimension; a++) {
generator(a, ta);
la = peekColour(h, a) * timesI(ta) * scale;
@ -708,7 +708,7 @@ public:
// inverse operation: FundamentalLieAlgebraMatrix
static void projectOnAlgebra(LatticeAlgebraVector &h_out, const LatticeMatrix &in, Real scale = 1.0) {
conformable(h_out, in);
h_out = zero;
h_out = Zero();
Matrix Ta;
for (int a = 0; a < AdjointDimension; a++) {

View File

@ -61,7 +61,7 @@ public:
static void generator(int Index, iSUnAdjointMatrix<cplx> &iAdjTa) {
// returns i(T_Adj)^index necessary for the projectors
// see definitions above
iAdjTa = zero;
iAdjTa = Zero();
Vector<typename SU<ncolour>::template iSUnMatrix<cplx> > ta(ncolour * ncolour - 1);
typename SU<ncolour>::template iSUnMatrix<cplx> tmp;
@ -118,7 +118,7 @@ public:
LatticeAdjMatrix la(grid);
AMatrix iTa;
out = zero;
out = Zero();
for (int a = 0; a < Dimension; a++) {
generator(a, iTa);
la = peekColour(h, a) * iTa;
@ -130,7 +130,7 @@ public:
// Projects the algebra components a lattice matrix (of dimension ncol*ncol -1 )
static void projectOnAlgebra(typename SU<ncolour>::LatticeAlgebraVector &h_out, const LatticeAdjMatrix &in, Real scale = 1.0) {
conformable(h_out, in);
h_out = zero;
h_out = Zero();
AMatrix iTa;
Real coefficient = - 1.0/(ncolour) * scale;// 1/Nc for the normalization of the trace in the adj rep
@ -145,7 +145,7 @@ public:
static void projector(typename SU<ncolour>::LatticeAlgebraVector &h_out, const LatticeAdjMatrix &in, Real scale = 1.0) {
conformable(h_out, in);
static std::vector<AMatrix> iTa(Dimension); // to store the generators
h_out = zero;
h_out = Zero();
static bool precalculated = false;
if (!precalculated){
precalculated = true;

View File

@ -71,7 +71,7 @@ public:
static void base(int Index, iSUnMatrix<cplx> &eij) {
// returns (e)^(ij)_{kl} necessary for change of base U_F -> U_R
assert(Index < NumGenerators);
eij = zero;
eij = Zero();
// for the linearisation of the 2 indexes
static int a[ncolour * (ncolour - 1) / 2][2]; // store the a <-> i,j
@ -97,14 +97,14 @@ public:
template <class cplx>
static void baseDiagonal(int Index, iSUnMatrix<cplx> &eij) {
eij = zero;
eij = Zero();
eij()()(Index - ncolour * (ncolour - 1) / 2,
Index - ncolour * (ncolour - 1) / 2) = 1.0;
}
template <class cplx>
static void baseOffDiagonal(int i, int j, iSUnMatrix<cplx> &eij) {
eij = zero;
eij = Zero();
for (int k = 0; k < ncolour; k++)
for (int l = 0; l < ncolour; l++)
eij()()(l, k) = delta(i, k) * delta(j, l) +
@ -130,7 +130,7 @@ public:
ncolour * ncolour - 1);
Vector<typename SU<ncolour>::template iSUnMatrix<cplx> > eij(Dimension);
typename SU<ncolour>::template iSUnMatrix<cplx> tmp;
i2indTa = zero;
i2indTa = Zero();
for (int a = 0; a < ncolour * ncolour - 1; a++)
SU<ncolour>::generator(a, ta[a]);
@ -203,7 +203,7 @@ public:
LatticeTwoIndexMatrix la(grid);
TIMatrix i2indTa;
out = zero;
out = Zero();
for (int a = 0; a < ncolour * ncolour - 1; a++) {
generator(a, i2indTa);
la = peekColour(h, a) * i2indTa;
@ -218,7 +218,7 @@ public:
typename SU<ncolour>::LatticeAlgebraVector &h_out,
const LatticeTwoIndexMatrix &in, Real scale = 1.0) {
conformable(h_out, in);
h_out = zero;
h_out = Zero();
TIMatrix i2indTa;
Real coefficient = -2.0 / (ncolour + 2 * S) * scale;
// 2/(Nc +/- 2) for the normalization of the trace in the two index rep
@ -236,7 +236,7 @@ public:
conformable(h_out, in);
// to store the generators
static std::vector<TIMatrix> i2indTa(ncolour * ncolour -1);
h_out = zero;
h_out = Zero();
static bool precalculated = false;
if (!precalculated) {
precalculated = true;

View File

@ -86,7 +86,7 @@ public:
static void sitePlaquette(ComplexField &Plaq,
const std::vector<GaugeMat> &U) {
ComplexField sitePlaq(U[0].Grid());
Plaq = zero;
Plaq = Zero();
for (int mu = 1; mu < Nd; mu++) {
for (int nu = 0; nu < mu; nu++) {
traceDirPlaquette(sitePlaq, U, mu, nu);
@ -130,7 +130,7 @@ public:
std::vector<GaugeMat> U(Nd, Umu.Grid());
ComplexField Tr(Umu.Grid());
Tr = zero;
Tr = Zero();
for (int mu = 0; mu < Nd; mu++) {
U[mu] = PeekIndex<LorentzIndex>(Umu, mu);
Tr = Tr + trace(U[mu]);
@ -156,7 +156,7 @@ public:
for (int d = 0; d < Nd; d++) {
U[d] = PeekIndex<LorentzIndex>(Umu, d);
}
staple = zero;
staple = Zero();
if (nu != mu) {
@ -197,7 +197,7 @@ public:
// this operation is taking too much time
U[d] = PeekIndex<LorentzIndex>(Umu, d);
}
staple = zero;
staple = Zero();
GaugeMat tmp1(grid);
GaugeMat tmp2(grid);
@ -225,7 +225,7 @@ public:
for (int d = 0; d < Nd; d++) {
U[d] = PeekIndex<LorentzIndex>(Umu, d);
}
staple = zero;
staple = Zero();
for (int nu = 0; nu < Nd; nu++) {
@ -385,7 +385,7 @@ public:
static void siteRectangle(ComplexField &Rect,
const std::vector<GaugeMat> &U) {
ComplexField siteRect(U[0].Grid());
Rect = zero;
Rect = Zero();
for (int mu = 1; mu < Nd; mu++) {
for (int nu = 0; nu < mu; nu++) {
traceDirRectangle(siteRect, U, mu, nu);
@ -443,7 +443,7 @@ public:
static void RectStapleOptimised(GaugeMat &Stap, std::vector<GaugeMat> &U2,
std::vector<GaugeMat> &U, int mu) {
Stap = zero;
Stap = Zero();
GridBase *grid = U[0].Grid();
@ -529,7 +529,7 @@ public:
U[d] = PeekIndex<LorentzIndex>(Umu, d);
}
Stap = zero;
Stap = Zero();
for (int nu = 0; nu < Nd; nu++) {
if (nu != mu) {