2017-06-19 14:04:21 +01:00
|
|
|
/*************************************************************************************
|
2016-01-02 14:51:32 +00:00
|
|
|
Grid physics library, www.github.com/paboyle/Grid
|
|
|
|
Source file: ./lib/lattice/Lattice_reduction.h
|
|
|
|
Copyright (C) 2015
|
|
|
|
Author: Azusa Yamaguchi <ayamaguc@staffmail.ed.ac.uk>
|
|
|
|
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
|
|
|
|
Author: paboyle <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
|
2018-01-14 23:56:33 +00:00
|
|
|
*************************************************************************************/
|
|
|
|
/* END LEGAL */
|
2015-04-18 20:44:19 +01:00
|
|
|
#ifndef GRID_LATTICE_REDUCTION_H
|
|
|
|
#define GRID_LATTICE_REDUCTION_H
|
|
|
|
|
2015-04-24 18:40:44 +01:00
|
|
|
#ifdef GRID_WARN_SUBOPTIMAL
|
|
|
|
#warning "Optimisation alert all these reduction loops are NOT threaded "
|
|
|
|
#endif
|
2015-04-18 20:44:19 +01:00
|
|
|
|
2018-01-14 23:56:33 +00:00
|
|
|
NAMESPACE_BEGIN(Grid);
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Deterministic Reduction operations
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
2017-04-15 10:57:21 +01:00
|
|
|
template<class vobj> inline RealD norm2(const Lattice<vobj> &arg){
|
|
|
|
ComplexD nrm = innerProduct(arg,arg);
|
2018-01-24 13:38:13 +00:00
|
|
|
return real(nrm);
|
2017-04-15 10:57:21 +01:00
|
|
|
}
|
2017-04-18 10:51:55 +01:00
|
|
|
|
2017-04-15 12:27:28 +01:00
|
|
|
// Double inner product
|
2017-04-15 10:57:21 +01:00
|
|
|
template<class vobj>
|
|
|
|
inline ComplexD innerProduct(const Lattice<vobj> &left,const Lattice<vobj> &right)
|
|
|
|
{
|
|
|
|
typedef typename vobj::scalar_type scalar_type;
|
|
|
|
typedef typename vobj::vector_typeD vector_type;
|
|
|
|
scalar_type nrm;
|
2017-04-05 14:41:04 +01:00
|
|
|
|
2018-01-27 00:04:12 +00:00
|
|
|
GridBase *grid = left.Grid();
|
2017-04-15 10:57:21 +01:00
|
|
|
|
|
|
|
std::vector<vector_type,alignedAllocator<vector_type> > sumarray(grid->SumArraySize());
|
|
|
|
|
2018-01-28 01:01:14 +00:00
|
|
|
thread_loop( (int thr=0;thr<grid->SumArraySize();thr++),{
|
2018-01-24 13:38:13 +00:00
|
|
|
int mywork, myoff;
|
2018-01-27 00:04:12 +00:00
|
|
|
GridThread::GetWork(left.Grid()->oSites(),thr,mywork,myoff);
|
2017-04-05 14:41:04 +01:00
|
|
|
|
2018-01-27 23:50:17 +00:00
|
|
|
decltype(innerProductD(left[0],right[0])) vnrm=Zero(); // private to thread; sub summation
|
2017-04-15 10:57:21 +01:00
|
|
|
for(int ss=myoff;ss<mywork+myoff; ss++){
|
2018-01-26 23:06:03 +00:00
|
|
|
vnrm = vnrm + innerProductD(left[ss],right[ss]);
|
2015-04-18 20:44:19 +01:00
|
|
|
}
|
2017-04-15 10:57:21 +01:00
|
|
|
sumarray[thr]=TensorRemove(vnrm) ;
|
2018-01-28 01:01:14 +00:00
|
|
|
});
|
2017-04-15 10:57:21 +01:00
|
|
|
|
2018-01-27 23:50:17 +00:00
|
|
|
vector_type vvnrm; vvnrm=Zero(); // sum across threads
|
2017-04-15 10:57:21 +01:00
|
|
|
for(int i=0;i<grid->SumArraySize();i++){
|
|
|
|
vvnrm = vvnrm+sumarray[i];
|
|
|
|
}
|
|
|
|
nrm = Reduce(vvnrm);// sum across simd
|
2018-01-27 00:04:12 +00:00
|
|
|
right.Grid()->GlobalSum(nrm);
|
2017-04-15 10:57:21 +01:00
|
|
|
return nrm;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<class Op,class T1>
|
|
|
|
inline auto sum(const LatticeUnaryExpression<Op,T1> & expr)
|
|
|
|
->typename decltype(expr.first.func(eval(0,std::get<0>(expr.second))))::scalar_object
|
|
|
|
{
|
|
|
|
return sum(closure(expr));
|
|
|
|
}
|
2015-06-14 01:03:28 +01:00
|
|
|
|
2017-04-15 10:57:21 +01:00
|
|
|
template<class Op,class T1,class T2>
|
|
|
|
inline auto sum(const LatticeBinaryExpression<Op,T1,T2> & expr)
|
2018-01-14 23:56:33 +00:00
|
|
|
->typename decltype(expr.first.func(eval(0,std::get<0>(expr.second)),eval(0,std::get<1>(expr.second))))::scalar_object
|
2017-04-15 10:57:21 +01:00
|
|
|
{
|
|
|
|
return sum(closure(expr));
|
|
|
|
}
|
2015-06-14 01:03:28 +01:00
|
|
|
|
|
|
|
|
2017-04-15 10:57:21 +01:00
|
|
|
template<class Op,class T1,class T2,class T3>
|
|
|
|
inline auto sum(const LatticeTrinaryExpression<Op,T1,T2,T3> & expr)
|
|
|
|
->typename decltype(expr.first.func(eval(0,std::get<0>(expr.second)),
|
|
|
|
eval(0,std::get<1>(expr.second)),
|
|
|
|
eval(0,std::get<2>(expr.second))
|
|
|
|
))::scalar_object
|
|
|
|
{
|
|
|
|
return sum(closure(expr));
|
|
|
|
}
|
2015-06-14 01:03:28 +01:00
|
|
|
|
2017-04-15 10:57:21 +01:00
|
|
|
template<class vobj>
|
|
|
|
inline typename vobj::scalar_object sum(const Lattice<vobj> &arg)
|
|
|
|
{
|
2018-01-27 00:04:12 +00:00
|
|
|
GridBase *grid=arg.Grid();
|
2017-04-15 10:57:21 +01:00
|
|
|
int Nsimd = grid->Nsimd();
|
|
|
|
|
|
|
|
std::vector<vobj,alignedAllocator<vobj> > sumarray(grid->SumArraySize());
|
|
|
|
for(int i=0;i<grid->SumArraySize();i++){
|
2018-01-27 23:50:17 +00:00
|
|
|
sumarray[i]=Zero();
|
2017-04-15 10:57:21 +01:00
|
|
|
}
|
|
|
|
|
2018-01-28 01:01:14 +00:00
|
|
|
thread_loop( (int thr=0;thr<grid->SumArraySize();thr++),{
|
2018-01-24 13:38:13 +00:00
|
|
|
int mywork, myoff;
|
2017-04-15 10:57:21 +01:00
|
|
|
GridThread::GetWork(grid->oSites(),thr,mywork,myoff);
|
2017-04-05 14:41:04 +01:00
|
|
|
|
2018-01-27 23:50:17 +00:00
|
|
|
vobj vvsum=Zero();
|
2017-04-15 10:57:21 +01:00
|
|
|
for(int ss=myoff;ss<mywork+myoff; ss++){
|
2018-01-26 23:06:03 +00:00
|
|
|
vvsum = vvsum + arg[ss];
|
2015-04-22 22:46:48 +01:00
|
|
|
}
|
2017-04-15 10:57:21 +01:00
|
|
|
sumarray[thr]=vvsum;
|
2018-01-28 01:01:14 +00:00
|
|
|
});
|
2017-04-15 10:57:21 +01:00
|
|
|
|
2018-01-27 23:50:17 +00:00
|
|
|
vobj vsum=Zero(); // sum across threads
|
2017-04-15 10:57:21 +01:00
|
|
|
for(int i=0;i<grid->SumArraySize();i++){
|
|
|
|
vsum = vsum+sumarray[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef typename vobj::scalar_object sobj;
|
2018-01-24 13:38:13 +00:00
|
|
|
sobj ssum; zeroit(ssum);
|
2017-04-15 10:57:21 +01:00
|
|
|
|
|
|
|
std::vector<sobj> buf(Nsimd);
|
|
|
|
extract(vsum,buf);
|
|
|
|
|
|
|
|
for(int i=0;i<Nsimd;i++) ssum = ssum + buf[i];
|
2018-01-27 00:04:12 +00:00
|
|
|
arg.Grid()->GlobalSum(ssum);
|
2017-04-15 10:57:21 +01:00
|
|
|
|
|
|
|
return ssum;
|
|
|
|
}
|
2015-04-24 18:40:44 +01:00
|
|
|
|
2017-04-18 10:51:55 +01:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// sliceSum, sliceInnerProduct, sliceAxpy, sliceNorm etc...
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2015-04-24 18:40:44 +01:00
|
|
|
template<class vobj> inline void sliceSum(const Lattice<vobj> &Data,std::vector<typename vobj::scalar_object> &result,int orthogdim)
|
|
|
|
{
|
2017-04-18 10:51:55 +01:00
|
|
|
///////////////////////////////////////////////////////
|
|
|
|
// FIXME precision promoted summation
|
|
|
|
// may be important for correlation functions
|
|
|
|
// But easily avoided by using double precision fields
|
|
|
|
///////////////////////////////////////////////////////
|
2015-04-24 18:40:44 +01:00
|
|
|
typedef typename vobj::scalar_object sobj;
|
2018-01-27 00:04:12 +00:00
|
|
|
GridBase *grid = Data.Grid();
|
2015-05-10 15:24:37 +01:00
|
|
|
assert(grid!=NULL);
|
2015-05-12 07:51:41 +01:00
|
|
|
|
2015-04-24 18:40:44 +01:00
|
|
|
const int Nd = grid->_ndimension;
|
|
|
|
const int Nsimd = grid->Nsimd();
|
|
|
|
|
|
|
|
assert(orthogdim >= 0);
|
|
|
|
assert(orthogdim < Nd);
|
|
|
|
|
|
|
|
int fd=grid->_fdimensions[orthogdim];
|
|
|
|
int ld=grid->_ldimensions[orthogdim];
|
|
|
|
int rd=grid->_rdimensions[orthogdim];
|
|
|
|
|
|
|
|
std::vector<vobj,alignedAllocator<vobj> > lvSum(rd); // will locally sum vectors first
|
2018-01-27 23:50:17 +00:00
|
|
|
std::vector<sobj> lsSum(ld,Zero()); // sum across these down to scalars
|
2017-04-17 10:50:19 +01:00
|
|
|
std::vector<sobj> extracted(Nsimd); // splitting the SIMD
|
2015-04-24 18:40:44 +01:00
|
|
|
|
2017-04-18 10:51:55 +01:00
|
|
|
result.resize(fd); // And then global sum to return the same vector to every node
|
2015-04-24 18:40:44 +01:00
|
|
|
for(int r=0;r<rd;r++){
|
2018-01-27 23:50:17 +00:00
|
|
|
lvSum[r]=Zero();
|
2015-04-24 18:40:44 +01:00
|
|
|
}
|
|
|
|
|
2017-04-18 10:51:55 +01:00
|
|
|
int e1= grid->_slice_nblock[orthogdim];
|
|
|
|
int e2= grid->_slice_block [orthogdim];
|
|
|
|
int stride=grid->_slice_stride[orthogdim];
|
2015-04-24 18:40:44 +01:00
|
|
|
|
|
|
|
// sum over reduced dimension planes, breaking out orthog dir
|
2018-01-28 01:01:14 +00:00
|
|
|
thread_loop( (int r=0;r<rd;r++),{
|
2017-04-18 10:51:55 +01:00
|
|
|
|
|
|
|
int so=r*grid->_ostride[orthogdim]; // base offset for start of plane
|
|
|
|
|
|
|
|
for(int n=0;n<e1;n++){
|
|
|
|
for(int b=0;b<e2;b++){
|
|
|
|
int ss= so+n*stride+b;
|
2018-01-26 23:06:03 +00:00
|
|
|
lvSum[r]=lvSum[r]+Data[ss];
|
2017-04-05 14:41:04 +01:00
|
|
|
}
|
2015-06-14 01:03:28 +01:00
|
|
|
}
|
2018-01-28 01:01:14 +00:00
|
|
|
});
|
2015-04-24 18:40:44 +01:00
|
|
|
|
|
|
|
// Sum across simd lanes in the plane, breaking out orthog dir.
|
|
|
|
std::vector<int> icoor(Nd);
|
|
|
|
|
|
|
|
for(int rt=0;rt<rd;rt++){
|
|
|
|
|
|
|
|
extract(lvSum[rt],extracted);
|
|
|
|
|
|
|
|
for(int idx=0;idx<Nsimd;idx++){
|
|
|
|
|
|
|
|
grid->iCoorFromIindex(icoor,idx);
|
|
|
|
|
|
|
|
int ldx =rt+icoor[orthogdim]*rd;
|
|
|
|
|
|
|
|
lsSum[ldx]=lsSum[ldx]+extracted[idx];
|
|
|
|
|
2015-06-14 01:03:28 +01:00
|
|
|
}
|
2015-04-24 18:40:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// sum over nodes.
|
|
|
|
sobj gsum;
|
|
|
|
for(int t=0;t<fd;t++){
|
|
|
|
int pt = t/ld; // processor plane
|
|
|
|
int lt = t%ld;
|
|
|
|
if ( pt == grid->_processor_coor[orthogdim] ) {
|
|
|
|
gsum=lsSum[lt];
|
|
|
|
} else {
|
2018-01-27 23:50:17 +00:00
|
|
|
gsum=Zero();
|
2015-06-14 01:03:28 +01:00
|
|
|
}
|
2015-04-24 18:40:44 +01:00
|
|
|
|
|
|
|
grid->GlobalSum(gsum);
|
|
|
|
|
|
|
|
result[t]=gsum;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-17 10:50:19 +01:00
|
|
|
template<class vobj>
|
|
|
|
static void sliceInnerProductVector( std::vector<ComplexD> & result, const Lattice<vobj> &lhs,const Lattice<vobj> &rhs,int orthogdim)
|
|
|
|
{
|
|
|
|
typedef typename vobj::vector_type vector_type;
|
|
|
|
typedef typename vobj::scalar_type scalar_type;
|
2018-01-27 00:04:12 +00:00
|
|
|
GridBase *grid = lhs.Grid();
|
2017-04-17 10:50:19 +01:00
|
|
|
assert(grid!=NULL);
|
2018-01-27 00:04:12 +00:00
|
|
|
conformable(grid,rhs.Grid());
|
2017-04-17 10:50:19 +01:00
|
|
|
|
|
|
|
const int Nd = grid->_ndimension;
|
|
|
|
const int Nsimd = grid->Nsimd();
|
|
|
|
|
|
|
|
assert(orthogdim >= 0);
|
|
|
|
assert(orthogdim < Nd);
|
|
|
|
|
|
|
|
int fd=grid->_fdimensions[orthogdim];
|
|
|
|
int ld=grid->_ldimensions[orthogdim];
|
|
|
|
int rd=grid->_rdimensions[orthogdim];
|
|
|
|
|
|
|
|
std::vector<vector_type,alignedAllocator<vector_type> > lvSum(rd); // will locally sum vectors first
|
|
|
|
std::vector<scalar_type > lsSum(ld,scalar_type(0.0)); // sum across these down to scalars
|
|
|
|
std::vector<iScalar<scalar_type> > extracted(Nsimd); // splitting the SIMD
|
|
|
|
|
|
|
|
result.resize(fd); // And then global sum to return the same vector to every node for IO to file
|
|
|
|
for(int r=0;r<rd;r++){
|
2018-01-27 23:50:17 +00:00
|
|
|
lvSum[r]=Zero();
|
2017-04-17 10:50:19 +01:00
|
|
|
}
|
|
|
|
|
2017-04-18 10:51:55 +01:00
|
|
|
int e1= grid->_slice_nblock[orthogdim];
|
|
|
|
int e2= grid->_slice_block [orthogdim];
|
|
|
|
int stride=grid->_slice_stride[orthogdim];
|
|
|
|
|
2018-01-28 01:01:14 +00:00
|
|
|
thread_loop( (int r=0;r<rd;r++),{
|
2017-04-18 10:51:55 +01:00
|
|
|
|
|
|
|
int so=r*grid->_ostride[orthogdim]; // base offset for start of plane
|
|
|
|
|
|
|
|
for(int n=0;n<e1;n++){
|
|
|
|
for(int b=0;b<e2;b++){
|
|
|
|
int ss= so+n*stride+b;
|
2018-01-26 23:06:03 +00:00
|
|
|
vector_type vv = TensorRemove(innerProduct(lhs[ss],rhs[ss]));
|
2017-04-17 10:50:19 +01:00
|
|
|
lvSum[r]=lvSum[r]+vv;
|
2015-05-12 07:51:41 +01:00
|
|
|
}
|
2017-04-17 10:50:19 +01:00
|
|
|
}
|
2018-01-28 01:01:14 +00:00
|
|
|
});
|
2017-04-17 10:50:19 +01:00
|
|
|
|
|
|
|
// Sum across simd lanes in the plane, breaking out orthog dir.
|
|
|
|
std::vector<int> icoor(Nd);
|
|
|
|
for(int rt=0;rt<rd;rt++){
|
|
|
|
|
2017-04-18 10:51:55 +01:00
|
|
|
iScalar<vector_type> temp;
|
|
|
|
temp._internal = lvSum[rt];
|
2017-04-17 10:50:19 +01:00
|
|
|
extract(temp,extracted);
|
|
|
|
|
|
|
|
for(int idx=0;idx<Nsimd;idx++){
|
|
|
|
|
|
|
|
grid->iCoorFromIindex(icoor,idx);
|
|
|
|
|
|
|
|
int ldx =rt+icoor[orthogdim]*rd;
|
|
|
|
|
|
|
|
lsSum[ldx]=lsSum[ldx]+extracted[idx]._internal;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// sum over nodes.
|
|
|
|
scalar_type gsum;
|
|
|
|
for(int t=0;t<fd;t++){
|
|
|
|
int pt = t/ld; // processor plane
|
|
|
|
int lt = t%ld;
|
|
|
|
if ( pt == grid->_processor_coor[orthogdim] ) {
|
|
|
|
gsum=lsSum[lt];
|
|
|
|
} else {
|
|
|
|
gsum=scalar_type(0.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
grid->GlobalSum(gsum);
|
|
|
|
|
|
|
|
result[t]=gsum;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
template<class vobj>
|
2017-04-18 10:51:55 +01:00
|
|
|
static void sliceNorm (std::vector<RealD> &sn,const Lattice<vobj> &rhs,int Orthog)
|
2017-04-17 10:50:19 +01:00
|
|
|
{
|
2017-04-18 10:51:55 +01:00
|
|
|
typedef typename vobj::scalar_object sobj;
|
|
|
|
typedef typename vobj::scalar_type scalar_type;
|
|
|
|
typedef typename vobj::vector_type vector_type;
|
|
|
|
|
2018-01-27 00:04:12 +00:00
|
|
|
int Nblock = rhs.Grid()->GlobalDimensions()[Orthog];
|
2017-04-18 10:51:55 +01:00
|
|
|
std::vector<ComplexD> ip(Nblock);
|
|
|
|
sn.resize(Nblock);
|
|
|
|
|
|
|
|
sliceInnerProductVector(ip,rhs,rhs,Orthog);
|
|
|
|
for(int ss=0;ss<Nblock;ss++){
|
|
|
|
sn[ss] = real(ip[ss]);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-04-17 10:50:19 +01:00
|
|
|
|
2017-04-18 10:51:55 +01:00
|
|
|
template<class vobj>
|
|
|
|
static void sliceMaddVector(Lattice<vobj> &R,std::vector<RealD> &a,const Lattice<vobj> &X,const Lattice<vobj> &Y,
|
|
|
|
int orthogdim,RealD scale=1.0)
|
|
|
|
{
|
|
|
|
typedef typename vobj::scalar_object sobj;
|
|
|
|
typedef typename vobj::scalar_type scalar_type;
|
|
|
|
typedef typename vobj::vector_type vector_type;
|
|
|
|
typedef typename vobj::tensor_reduced tensor_reduced;
|
|
|
|
|
2017-05-17 10:51:01 +01:00
|
|
|
scalar_type zscale(scale);
|
|
|
|
|
2018-01-27 00:04:12 +00:00
|
|
|
GridBase *grid = X.Grid();
|
2017-04-17 10:50:19 +01:00
|
|
|
|
2017-04-18 10:51:55 +01:00
|
|
|
int Nsimd =grid->Nsimd();
|
|
|
|
int Nblock =grid->GlobalDimensions()[orthogdim];
|
2017-04-17 10:50:19 +01:00
|
|
|
|
2017-04-18 10:51:55 +01:00
|
|
|
int fd =grid->_fdimensions[orthogdim];
|
|
|
|
int ld =grid->_ldimensions[orthogdim];
|
|
|
|
int rd =grid->_rdimensions[orthogdim];
|
2017-04-17 10:50:19 +01:00
|
|
|
|
2017-04-18 10:51:55 +01:00
|
|
|
int e1 =grid->_slice_nblock[orthogdim];
|
|
|
|
int e2 =grid->_slice_block [orthogdim];
|
|
|
|
int stride =grid->_slice_stride[orthogdim];
|
2017-04-17 10:50:19 +01:00
|
|
|
|
2017-04-18 10:51:55 +01:00
|
|
|
std::vector<int> icoor;
|
2017-04-17 10:50:19 +01:00
|
|
|
|
2017-04-18 10:51:55 +01:00
|
|
|
for(int r=0;r<rd;r++){
|
2017-04-17 10:50:19 +01:00
|
|
|
|
2017-04-18 10:51:55 +01:00
|
|
|
int so=r*grid->_ostride[orthogdim]; // base offset for start of plane
|
2017-04-17 10:50:19 +01:00
|
|
|
|
2017-04-18 10:51:55 +01:00
|
|
|
vector_type av;
|
|
|
|
|
|
|
|
for(int l=0;l<Nsimd;l++){
|
|
|
|
grid->iCoorFromIindex(icoor,l);
|
|
|
|
int ldx =r+icoor[orthogdim]*rd;
|
|
|
|
scalar_type *as =(scalar_type *)&av;
|
2017-05-17 10:51:01 +01:00
|
|
|
as[l] = scalar_type(a[ldx])*zscale;
|
2017-04-18 10:51:55 +01:00
|
|
|
}
|
2017-04-17 10:50:19 +01:00
|
|
|
|
2017-04-18 10:51:55 +01:00
|
|
|
tensor_reduced at; at=av;
|
2017-04-17 10:50:19 +01:00
|
|
|
|
2018-01-28 01:21:53 +00:00
|
|
|
thread_loop_collapse2( (int n=0;n<e1;n++),{
|
2017-04-18 10:51:55 +01:00
|
|
|
for(int b=0;b<e2;b++){
|
|
|
|
int ss= so+n*stride+b;
|
2018-01-26 23:06:03 +00:00
|
|
|
R[ss] = at*X[ss]+Y[ss];
|
2015-04-22 22:46:48 +01:00
|
|
|
}
|
2018-01-28 01:01:14 +00:00
|
|
|
});
|
2017-04-18 10:51:55 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-01-14 23:56:33 +00:00
|
|
|
NAMESPACE_END(Grid);
|
2015-04-18 20:44:19 +01:00
|
|
|
#endif
|
|
|
|
|
2017-05-01 12:13:56 +01:00
|
|
|
|
|
|
|
|