1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +00:00

Accelerator loops

This commit is contained in:
paboyle 2018-01-24 13:35:36 +00:00
parent 210c50a278
commit 25f589b064

View File

@ -47,9 +47,9 @@ template<class vfunctor,class lobj,class robj>
inline Lattice<vInteger> LLComparison(vfunctor op,const Lattice<lobj> &lhs,const Lattice<robj> &rhs) inline Lattice<vInteger> LLComparison(vfunctor op,const Lattice<lobj> &lhs,const Lattice<robj> &rhs)
{ {
Lattice<vInteger> ret(rhs._grid); Lattice<vInteger> ret(rhs._grid);
parallel_for(int ss=0;ss<rhs._grid->oSites(); ss++){ accelerator_loop( ss, rhs, {
ret._odata[ss]=op(lhs._odata[ss],rhs._odata[ss]); ret._odata[ss]=op(lhs._odata[ss],rhs._odata[ss]);
} });
return ret; return ret;
} }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
@ -59,9 +59,9 @@ template<class vfunctor,class lobj,class robj>
inline Lattice<vInteger> LSComparison(vfunctor op,const Lattice<lobj> &lhs,const robj &rhs) inline Lattice<vInteger> LSComparison(vfunctor op,const Lattice<lobj> &lhs,const robj &rhs)
{ {
Lattice<vInteger> ret(lhs._grid); Lattice<vInteger> ret(lhs._grid);
parallel_for(int ss=0;ss<lhs._grid->oSites(); ss++){ accelerator_loop( ss, lhs, {
ret._odata[ss]=op(lhs._odata[ss],rhs); ret._odata[ss]=op(lhs._odata[ss],rhs);
} });
return ret; return ret;
} }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
@ -71,9 +71,9 @@ template<class vfunctor,class lobj,class robj>
inline Lattice<vInteger> SLComparison(vfunctor op,const lobj &lhs,const Lattice<robj> &rhs) inline Lattice<vInteger> SLComparison(vfunctor op,const lobj &lhs,const Lattice<robj> &rhs)
{ {
Lattice<vInteger> ret(rhs._grid); Lattice<vInteger> ret(rhs._grid);
parallel_for(int ss=0;ss<rhs._grid->oSites(); ss++){ accelerator_loop( ss, rhs, {
ret._odata[ss]=op(lhs._odata[ss],rhs); ret._odata[ss]=op(lhs._odata[ss],rhs);
} });
return ret; return ret;
} }