1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-04-07 04:35:56 +01:00

Cleaned up some stuff that was erroneously included in a previous "trash" commit. Leaving in the mySliceInnerProdct function for now as it speeds up mesonfield creation quite a lot for 24^3 tests

This commit is contained in:
fionnoh 2018-07-16 16:19:59 +01:00
parent 9deae8c962
commit d868a45120
3 changed files with 2 additions and 38 deletions

View File

@ -39,8 +39,7 @@ class TMesonFieldGamma : public Module<MesonFieldPar>
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(Result,
Gamma::Algebra, gamma,
std::vector<std::vector<std::vector<ComplexD>>>, MesonField,
ComplexD, last);
std::vector<std::vector<std::vector<ComplexD>>>, MesonField);
};
public:
@ -179,7 +178,6 @@ void TMesonFieldGamma<FImpl>::execute(void)
LOG(Message) << "MF for i = " << i << " of " << N << std::endl;
}
}
result[0].last = MesonField_ij[7];
saveResult(par().output, "meson", result);
}

View File

@ -41,7 +41,6 @@ template<class vobj> inline RealD norm2(const Lattice<vobj> &arg){
template<class vobj>
inline ComplexD innerProduct(const Lattice<vobj> &left,const Lattice<vobj> &right)
{
std::cout << GridLogMessage << "Start alloc innerProduct" << std::endl;
typedef typename vobj::scalar_type scalar_type;
typedef typename vobj::vector_typeD vector_type;
GridBase *grid = left._grid;
@ -50,8 +49,6 @@ inline ComplexD innerProduct(const Lattice<vobj> &left,const Lattice<vobj> &righ
ComplexD inner;
Vector<ComplexD> sumarray(grid->SumArraySize()*pad);
std::cout << GridLogMessage << "End alloc innerProduct" << std::endl;
std::cout << GridLogMessage << "Start parallel for innerProduct" << std::endl;
parallel_for(int thr=0;thr<grid->SumArraySize();thr++){
int nwork, mywork, myoff;
GridThread::GetWork(left._grid->oSites(),thr,mywork,myoff);
@ -65,18 +62,13 @@ inline ComplexD innerProduct(const Lattice<vobj> &left,const Lattice<vobj> &righ
ComplexD tmp = Reduce(TensorRemove(vinner)) ;
vstream(sumarray[thr*pad],tmp);
}
std::cout << GridLogMessage << "End parallel for innerProduct" << std::endl;
std::cout << GridLogMessage << "Start inner sum innerProduct" << std::endl;
inner=0.0;
for(int i=0;i<grid->SumArraySize();i++){
inner = inner+sumarray[i*pad];
}
right._grid->GlobalSum(inner);
return inner;
std::cout << GridLogMessage << "End inner sum innerProduct" << std::endl;
std::cout << GridLogMessage << "End innerProduct" << std::endl;
}
/////////////////////////
@ -339,7 +331,7 @@ static void localSliceInnerProductVector(std::vector<ComplexD> &result, const La
for(int n=0;n<e1;n++){
for(int b=0;b<e2;b++){
int ss = so + n * stride + b;
vv = TensorRemove(innerProduct(lhs._odata[ss]._internal, rhs._odata[ss]._internal));
vv = TensorRemove(innerProduct(lhs._odata[ss], rhs._odata[ss]));
lvSum[r] = lvSum[r] + vv;
}
}

View File

@ -106,7 +106,6 @@ inline vRealD innerProductD(const vRealF &l,const vRealF &r){
typedef decltype(innerProduct(lhs._internal[0],rhs._internal[0])) ret_t;
iScalar<ret_t> ret;
ret=zero;
// std::cout << GridLogMessage << "innerProduct iVector" << std::endl;
for(int c1=0;c1<N;c1++){
ret._internal += innerProduct(lhs._internal[c1],rhs._internal[c1]);
}
@ -130,34 +129,9 @@ inline vRealD innerProductD(const vRealF &l,const vRealF &r){
{
typedef decltype(innerProduct(lhs._internal,rhs._internal)) ret_t;
iScalar<ret_t> ret;
// std::cout << GridLogMessage << "innerProduct iScalar" << std::endl;
ret._internal = innerProduct(lhs._internal,rhs._internal);
return ret;
}
template<class l,class r,int N> inline
auto myInnerProduct (const iVector<l,N>& lhs,const iVector<r,N>& rhs) -> iScalar<decltype(innerProduct(lhs._internal[0],rhs._internal[0]))>
{
typedef decltype(innerProduct(lhs._internal[0],rhs._internal[0])) ret_t;
iScalar<ret_t> ret;
ret=zero;
std::cout << GridLogMessage << "myInnerProduct iVector, N = " << N << std::endl;
for(int c1=0;c1<N;c1++){
ret._internal += innerProduct(lhs._internal[c1],rhs._internal[c1]);
}
return ret;
}
template<class l,class r> inline
auto myInnerProduct (const iScalar<l>& lhs,const iScalar<r>& rhs) -> iScalar<decltype(innerProduct(lhs._internal,rhs._internal))>
{
typedef decltype(innerProduct(lhs._internal,rhs._internal)) ret_t;
iScalar<ret_t> ret;
std::cout << GridLogMessage << "myInnerProduct iScalar" << std::endl;
ret._internal = myInnerProduct(lhs._internal,rhs._internal);
return ret;
}
}
#endif