From 0da2d3e222fcefcadb6fe2b0924104d4b7eb9a59 Mon Sep 17 00:00:00 2001 From: paboyle Date: Fri, 2 Feb 2018 11:27:35 +0000 Subject: [PATCH] accelerator off load some more stuff --- lib/lattice/Lattice_base.h | 50 ++++++++------------------------------ 1 file changed, 10 insertions(+), 40 deletions(-) diff --git a/lib/lattice/Lattice_base.h b/lib/lattice/Lattice_base.h index 26eabde4..7940e87d 100644 --- a/lib/lattice/Lattice_base.h +++ b/lib/lattice/Lattice_base.h @@ -74,9 +74,6 @@ public: accelerator_inline uint64_t begin(void) const { return 0;}; accelerator_inline uint64_t end(void) const { return _odata_size; }; accelerator_inline uint64_t size(void) const { return _odata_size; }; - accelerator_inline vobj & operator[](size_t i) { return _odata[i]; }; - accelerator_inline const vobj & operator[](size_t i) const { return _odata[i]; }; - }; class LatticeExpressionBase {}; @@ -153,6 +150,8 @@ private: // std::cout << " copied lattice "<_odata<<" size "<_odata_size<_odata[i]; }; + accelerator_inline const vobj & operator[](size_t i) const { return this->_odata[i]; }; ~Lattice() { if ( this->_odata_size ) { // std::cout << " deleting lattice this"<_odata<<" size "<_odata_size<checkerboard=cb; resize(_grid->oSites()); -#ifdef STREAMING_STORES - accelerator_loop(ss,(*this),{ - vstream(this->_odata[ss] ,eval(ss,expr)); - }); -#else - accelerator_loop(ss,(*this),{ - this->_odata[ss]=eval(ss,expr); - }); -#endif + + *this = expr; } template Lattice(const LatticeBinaryExpression & expr) { _grid = nullptr; GridFromExpression(_grid,expr); assert(_grid!=nullptr); - resize(_grid->oSites()); int cb=-1; CBFromExpression(cb,expr); assert( (cb==Odd) || (cb==Even)); this->checkerboard=cb; - -#ifdef STREAMING_STORES - accelerator_loop(ss,(*this),{ - vobj tmp = eval(ss,expr); - vstream(this->_odata[ss] ,tmp); - }); -#else - accelerator_loop(ss,(*this),{ - this->_odata[ss]=eval(ss,expr); - }); -#endif + + resize(_grid->oSites()); + + *this = expr; } template Lattice(const LatticeTrinaryExpression & expr) { @@ -294,21 +278,9 @@ public: this->checkerboard=cb; resize(_grid->oSites()); - accelerator_loop(ss,(*this),{ - vstream(this->_odata[ss] ,eval(ss,expr)); - }); - } - // virtual ~Lattice(void) = default; - /* - void reset(GridBase* grid) { - if (_grid != grid) { - _grid = grid; - resize(grid->oSites()); - this->checkerboard = 0; - } + *this = expr; } - */ template inline Lattice & operator = (const sobj & r){ accelerator_loop(ss,(*this),{ @@ -333,9 +305,7 @@ public: _grid = r.Grid(); resize(r._odata_size); this->checkerboard = r.Checkerboard(); - accelerator_loop(ss,(*this),{ - this->_odata[ss]=r[ss]; - }); + *this = r; } Lattice(Lattice && r){ // move constructor // std::cout << "Lattice move constructor(Lattice &) "<