From 1f26a234f939781c55f578129965e9760c53a678 Mon Sep 17 00:00:00 2001 From: paboyle Date: Wed, 24 Jan 2018 13:36:31 +0000 Subject: [PATCH] CPU loops explicit for peek poke --- lib/lattice/Lattice_peekpoke.h | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/lib/lattice/Lattice_peekpoke.h b/lib/lattice/Lattice_peekpoke.h index a5dc808a..dc7c7639 100644 --- a/lib/lattice/Lattice_peekpoke.h +++ b/lib/lattice/Lattice_peekpoke.h @@ -36,52 +36,54 @@ Author: Peter Boyle NAMESPACE_BEGIN(Grid); + +// FIXME accelerator_loop and accelerator_inline these //////////////////////////////////////////////////////////////////////////////////////////////////// // Peek internal indices of a Lattice object //////////////////////////////////////////////////////////////////////////////////////////////////// -template +template auto PeekIndex(const Lattice &lhs,int i) -> Lattice(lhs._odata[0],i))> { Lattice(lhs._odata[0],i))> ret(lhs._grid); ret.checkerboard=lhs.checkerboard; - parallel_for(int ss=0;ssoSites();ss++){ + cpu_loop( ss, lhs, { ret._odata[ss] = peekIndex(lhs._odata[ss],i); - } + }); return ret; }; -template +template auto PeekIndex(const Lattice &lhs,int i,int j) -> Lattice(lhs._odata[0],i,j))> { Lattice(lhs._odata[0],i,j))> ret(lhs._grid); ret.checkerboard=lhs.checkerboard; - parallel_for(int ss=0;ssoSites();ss++){ + cpu_loop( ss, lhs, { ret._odata[ss] = peekIndex(lhs._odata[ss],i,j); - } + }); return ret; }; //////////////////////////////////////////////////////////////////////////////////////////////////// // Poke internal indices of a Lattice object //////////////////////////////////////////////////////////////////////////////////////////////////// -template +template void PokeIndex(Lattice &lhs,const Lattice(lhs._odata[0],0))> & rhs,int i) { - parallel_for(int ss=0;ssoSites();ss++){ + cpu_loop( ss, lhs, { pokeIndex(lhs._odata[ss],rhs._odata[ss],i); - } + }); } -template +template void PokeIndex(Lattice &lhs,const Lattice(lhs._odata[0],0,0))> & rhs,int i,int j) { - parallel_for(int ss=0;ssoSites();ss++){ + cpu_loop( ss, lhs, { pokeIndex(lhs._odata[ss],rhs._odata[ss],i,j); - } + }); } ////////////////////////////////////////////////////// // Poke a scalar object into the SIMD array ////////////////////////////////////////////////////// -template +template void pokeSite(const sobj &s,Lattice &l,const std::vector &site){ GridBase *grid=l._grid;