From 180c732b4c2db59d5cd13903f1395ef261644805 Mon Sep 17 00:00:00 2001 From: paboyle Date: Thu, 20 Apr 2017 13:17:55 +0100 Subject: [PATCH] Move compressors out of Cshift. Slice iterators would help --- lib/cshift/Cshift_common.h | 67 ++++++++------------------------------ lib/cshift/Cshift_mpi.h | 15 +-------- 2 files changed, 14 insertions(+), 68 deletions(-) diff --git a/lib/cshift/Cshift_common.h b/lib/cshift/Cshift_common.h index 956f6cf1..1be672e8 100644 --- a/lib/cshift/Cshift_common.h +++ b/lib/cshift/Cshift_common.h @@ -30,33 +30,11 @@ Author: Peter Boyle namespace Grid { -template -class SimpleCompressor { -public: - void Point(int) {}; - inline int CommDatumSize(void) { return sizeof(vobj); } - inline bool DecompressionStep(void) { return false; } - inline void Compress(vobj *buf,int o,const vobj &in) { buf[o]=in; } - inline void Exchange(vobj *mp,vobj *vp0,vobj *vp1,Integer type,Integer o){ - exchange(mp[2*o],mp[2*o+1],vp0[o],vp1[o],type); - } - inline void Decompress(vobj *out,vobj *in, int o){ assert(0); } - inline void CompressExchange(vobj *out0,vobj *out1,const vobj *in, - int j,int k, int m,int type){ - exchange(out0[j],out1[j],in[k],in[m],type); - } - // For cshift. Cshift should drop compressor coupling altogether - // because I had to decouple the code from the Stencil anyway - inline vobj operator() (const vobj &arg) { - return arg; - } -}; - /////////////////////////////////////////////////////////////////// -// Gather for when there is no need to SIMD split with compression +// Gather for when there is no need to SIMD split /////////////////////////////////////////////////////////////////// -template void -Gather_plane_simple (const Lattice &rhs,commVector &buffer,int dimension,int plane,int cbmask,compressor &compress, int off=0) +template void +Gather_plane_simple (const Lattice &rhs,commVector &buffer,int dimension,int plane,int cbmask, int off=0) { int rd = rhs._grid->_rdimensions[dimension]; @@ -74,7 +52,7 @@ Gather_plane_simple (const Lattice &rhs,commVector &buffer,int dimen for(int b=0;b &rhs,commVector &buffer,int dimen } } parallel_for(int i=0;i void -Gather_plane_extract(const Lattice &rhs,std::vector pointers,int dimension,int plane,int cbmask,compressor &compress) +template void +Gather_plane_extract(const Lattice &rhs,std::vector pointers,int dimension,int plane,int cbmask) { int rd = rhs._grid->_rdimensions[dimension]; @@ -121,8 +98,8 @@ Gather_plane_extract(const Lattice &rhs,std::vector(temp,pointers,offset); + vobj temp =rhs._odata[so+o+b]; + extract(temp,pointers,offset); } } @@ -139,32 +116,14 @@ Gather_plane_extract(const Lattice &rhs,std::vector(temp,pointers,offset); + vobj temp =rhs._odata[so+o+b]; + extract(temp,pointers,offset); } } } } } -////////////////////////////////////////////////////// -// Gather for when there is no need to SIMD split -////////////////////////////////////////////////////// -template void Gather_plane_simple (const Lattice &rhs,commVector &buffer, int dimension,int plane,int cbmask) -{ - SimpleCompressor dontcompress; - Gather_plane_simple (rhs,buffer,dimension,plane,cbmask,dontcompress); -} - -////////////////////////////////////////////////////// -// Gather for when there *is* need to SIMD split -////////////////////////////////////////////////////// -template void Gather_plane_extract(const Lattice &rhs,std::vector pointers,int dimension,int plane,int cbmask) -{ - SimpleCompressor dontcompress; - Gather_plane_extract(rhs,pointers,dimension,plane,cbmask,dontcompress); -} - ////////////////////////////////////////////////////// // Scatter for when there is no need to SIMD split ////////////////////////////////////////////////////// @@ -212,7 +171,7 @@ template void Scatter_plane_simple (Lattice &rhs,commVector void Scatter_plane_merge(Lattice &rhs,std::vector pointers,int dimension,int plane,int cbmask) +template void Scatter_plane_merge(Lattice &rhs,std::vector pointers,int dimension,int plane,int cbmask) { int rd = rhs._grid->_rdimensions[dimension]; diff --git a/lib/cshift/Cshift_mpi.h b/lib/cshift/Cshift_mpi.h index b2a44961..a66b49bf 100644 --- a/lib/cshift/Cshift_mpi.h +++ b/lib/cshift/Cshift_mpi.h @@ -154,13 +154,7 @@ template void Cshift_comms(Lattice &ret,const Lattice &r recv_from_rank, bytes); grid->Barrier(); - /* - for(int i=0;i void Cshift_comms_simd(Lattice &ret,const LatticeBarrier(); rpointers[i] = &recv_buf_extract[i][0]; } else {