diff --git a/Grid/lattice/Lattice_transfer.h b/Grid/lattice/Lattice_transfer.h index 2292088c..4b1459c3 100644 --- a/Grid/lattice/Lattice_transfer.h +++ b/Grid/lattice/Lattice_transfer.h @@ -85,6 +85,77 @@ template inline void setCheckerboard(Lattice &full,const Latti }); } +template inline void acceleratorPickCheckerboard(int cb,Lattice &half,const Lattice &full, int checker_dim_half=0) +{ + half.Checkerboard() = cb; + autoView(half_v, half, AcceleratorWrite); + autoView(full_v, full, AcceleratorRead); + Coordinate rdim_full = full.Grid()->_rdimensions; + Coordinate rdim_half = half.Grid()->_rdimensions; + unsigned long ndim_half = half.Grid()->_ndimension; + Coordinate checker_dim_mask_half = half.Grid()->_checker_dim_mask; + Coordinate ostride_half = half.Grid()->_ostride; + accelerator_for(ss, full.Grid()->oSites(),full.Grid()->Nsimd(),{ + + Coordinate coor; + int cbos; + int linear=0; + + Lexicographic::CoorFromIndex(coor,ss,rdim_full); + assert(coor.size()==ndim_half); + + for(int d=0;d inline void acceleratorSetCheckerboard(Lattice &full,const Lattice &half, int checker_dim_half=0) +{ + int cb = half.Checkerboard(); + autoView(half_v , half, AcceleratorRead); + autoView(full_v , full, AcceleratorWrite); + nvtxRangePop(); + Coordinate rdim_full = full.Grid()->_rdimensions; + Coordinate rdim_half = half.Grid()->_rdimensions; + unsigned long ndim_half = half.Grid()->_ndimension; + Coordinate checker_dim_mask_half = half.Grid()->_checker_dim_mask; + Coordinate ostride_half = half.Grid()->_ostride; + accelerator_for(ss,full.Grid()->oSites(),full.Grid()->Nsimd(),{ + + Coordinate coor; + int cbos; + int linear=0; + + Lexicographic::CoorFromIndex(coor,ss,rdim_full); + assert(coor.size()==ndim_half); + + for(int d=0;d