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

Accelerator loops

This commit is contained in:
paboyle 2018-01-24 13:35:55 +00:00
parent 25f589b064
commit 13f0116425

View File

@ -43,9 +43,9 @@ template<class vobj>
inline auto localNorm2 (const Lattice<vobj> &rhs)-> Lattice<typename vobj::tensor_reduced>
{
Lattice<typename vobj::tensor_reduced> ret(rhs._grid);
parallel_for(int ss=0;ss<rhs._grid->oSites(); ss++){
accelerator_loop(ss,rhs,{
ret._odata[ss]=innerProduct(rhs._odata[ss],rhs._odata[ss]);
}
});
return ret;
}
@ -54,9 +54,9 @@ template<class vobj>
inline auto localInnerProduct (const Lattice<vobj> &lhs,const Lattice<vobj> &rhs) -> Lattice<typename vobj::tensor_reduced>
{
Lattice<typename vobj::tensor_reduced> ret(rhs._grid);
parallel_for(int ss=0;ss<rhs._grid->oSites(); ss++){
accelerator_loop(ss,rhs,{
ret._odata[ss]=innerProduct(lhs._odata[ss],rhs._odata[ss]);
}
});
return ret;
}
@ -66,9 +66,9 @@ template<class ll,class rr>
inline auto outerProduct (const Lattice<ll> &lhs,const Lattice<rr> &rhs) -> Lattice<decltype(outerProduct(lhs._odata[0],rhs._odata[0]))>
{
Lattice<decltype(outerProduct(lhs._odata[0],rhs._odata[0]))> ret(rhs._grid);
parallel_for(int ss=0;ss<rhs._grid->oSites(); ss++){
accelerator_loop(ss,rhs,{
ret._odata[ss]=outerProduct(lhs._odata[ss],rhs._odata[ss]);
}
});
return ret;
}
NAMESPACE_END(Grid);