mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-09 21:50:45 +01:00
Offload
This commit is contained in:
parent
237ce92540
commit
84c19587e7
@ -46,9 +46,9 @@ auto PeekIndex(const Lattice<vobj> &lhs,int i) -> Lattice<decltype(peekIndex<Ind
|
|||||||
{
|
{
|
||||||
Lattice<decltype(peekIndex<Index>(vobj(),i))> ret(lhs.Grid());
|
Lattice<decltype(peekIndex<Index>(vobj(),i))> ret(lhs.Grid());
|
||||||
ret.Checkerboard()=lhs.Checkerboard();
|
ret.Checkerboard()=lhs.Checkerboard();
|
||||||
autoView( ret_v, ret, CpuWrite);
|
autoView( ret_v, ret, AcceleratorWrite);
|
||||||
autoView( lhs_v, lhs, CpuRead);
|
autoView( lhs_v, lhs, AcceleratorRead);
|
||||||
thread_for( ss, lhs_v.size(), {
|
accelerator_for( ss, lhs_v.size(), 1, {
|
||||||
ret_v[ss] = peekIndex<Index>(lhs_v[ss],i);
|
ret_v[ss] = peekIndex<Index>(lhs_v[ss],i);
|
||||||
});
|
});
|
||||||
return ret;
|
return ret;
|
||||||
@ -58,9 +58,9 @@ auto PeekIndex(const Lattice<vobj> &lhs,int i,int j) -> Lattice<decltype(peekInd
|
|||||||
{
|
{
|
||||||
Lattice<decltype(peekIndex<Index>(vobj(),i,j))> ret(lhs.Grid());
|
Lattice<decltype(peekIndex<Index>(vobj(),i,j))> ret(lhs.Grid());
|
||||||
ret.Checkerboard()=lhs.Checkerboard();
|
ret.Checkerboard()=lhs.Checkerboard();
|
||||||
autoView( ret_v, ret, CpuWrite);
|
autoView( ret_v, ret, AcceleratorWrite);
|
||||||
autoView( lhs_v, lhs, CpuRead);
|
autoView( lhs_v, lhs, AcceleratorRead);
|
||||||
thread_for( ss, lhs_v.size(), {
|
accelerator_for( ss, lhs_v.size(), 1, {
|
||||||
ret_v[ss] = peekIndex<Index>(lhs_v[ss],i,j);
|
ret_v[ss] = peekIndex<Index>(lhs_v[ss],i,j);
|
||||||
});
|
});
|
||||||
return ret;
|
return ret;
|
||||||
@ -72,18 +72,18 @@ auto PeekIndex(const Lattice<vobj> &lhs,int i,int j) -> Lattice<decltype(peekInd
|
|||||||
template<int Index,class vobj>
|
template<int Index,class vobj>
|
||||||
void PokeIndex(Lattice<vobj> &lhs,const Lattice<decltype(peekIndex<Index>(vobj(),0))> & rhs,int i)
|
void PokeIndex(Lattice<vobj> &lhs,const Lattice<decltype(peekIndex<Index>(vobj(),0))> & rhs,int i)
|
||||||
{
|
{
|
||||||
autoView( rhs_v, rhs, CpuRead);
|
autoView( rhs_v, rhs, AcceleratorRead);
|
||||||
autoView( lhs_v, lhs, CpuWrite);
|
autoView( lhs_v, lhs, AcceleratorWrite);
|
||||||
thread_for( ss, lhs_v.size(), {
|
accelerator_for( ss, lhs_v.size(), 1, {
|
||||||
pokeIndex<Index>(lhs_v[ss],rhs_v[ss],i);
|
pokeIndex<Index>(lhs_v[ss],rhs_v[ss],i);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
template<int Index,class vobj>
|
template<int Index,class vobj>
|
||||||
void PokeIndex(Lattice<vobj> &lhs,const Lattice<decltype(peekIndex<Index>(vobj(),0,0))> & rhs,int i,int j)
|
void PokeIndex(Lattice<vobj> &lhs,const Lattice<decltype(peekIndex<Index>(vobj(),0,0))> & rhs,int i,int j)
|
||||||
{
|
{
|
||||||
autoView( rhs_v, rhs, CpuRead);
|
autoView( rhs_v, rhs, AcceleratorRead);
|
||||||
autoView( lhs_v, lhs, CpuWrite);
|
autoView( lhs_v, lhs, AcceleratorWrite);
|
||||||
thread_for( ss, lhs_v.size(), {
|
accelerator_for( ss, lhs_v.size(), 1, {
|
||||||
pokeIndex<Index>(lhs_v[ss],rhs_v[ss],i,j);
|
pokeIndex<Index>(lhs_v[ss],rhs_v[ss],i,j);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -151,13 +151,12 @@ void peekSite(sobj &s,const Lattice<vobj> &l,const Coordinate &site){
|
|||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////
|
||||||
// Peek a scalar object from the SIMD array
|
// Peek a scalar object from the SIMD array
|
||||||
//////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////
|
||||||
template<class vobj,class sobj>
|
template<class vobj,class sobj>
|
||||||
inline void peekLocalSite(sobj &s,const Lattice<vobj> &l,Coordinate &site){
|
inline void peekLocalSite(sobj &s,const Lattice<vobj> &l,Coordinate &site)
|
||||||
|
{
|
||||||
GridBase *grid = l.Grid();
|
GridBase *grid = l.Grid();
|
||||||
|
|
||||||
typedef typename vobj::scalar_type scalar_type;
|
typedef typename vobj::scalar_type scalar_type;
|
||||||
@ -185,8 +184,8 @@ inline void peekLocalSite(sobj &s,const Lattice<vobj> &l,Coordinate &site){
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<class vobj,class sobj>
|
template<class vobj,class sobj>
|
||||||
inline void pokeLocalSite(const sobj &s,Lattice<vobj> &l,Coordinate &site){
|
inline void pokeLocalSite(const sobj &s,Lattice<vobj> &l,Coordinate &site)
|
||||||
|
{
|
||||||
GridBase *grid=l.Grid();
|
GridBase *grid=l.Grid();
|
||||||
|
|
||||||
typedef typename vobj::scalar_type scalar_type;
|
typedef typename vobj::scalar_type scalar_type;
|
||||||
@ -208,7 +207,6 @@ inline void pokeLocalSite(const sobj &s,Lattice<vobj> &l,Coordinate &site){
|
|||||||
for(int w=0;w<words;w++){
|
for(int w=0;w<words;w++){
|
||||||
vp[idx+w*Nsimd] = pt[w];
|
vp[idx+w*Nsimd] = pt[w];
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user