diff --git a/Grid/algorithms/LinearOperator.h b/Grid/algorithms/LinearOperator.h index 86d3f030..b86863b8 100644 --- a/Grid/algorithms/LinearOperator.h +++ b/Grid/algorithms/LinearOperator.h @@ -380,6 +380,12 @@ namespace Grid { template class OperatorFunction { public: virtual void operator() (LinearOperatorBase &Linop, const Field &in, Field &out) = 0; + virtual void operator() (LinearOperatorBase &Linop, const std::vector &in,std::vector &out) { + assert(in.size()==out.size()); + for(int k=0;k class LinearFunction { @@ -421,7 +427,7 @@ namespace Grid { // Hermitian operator Linear function and operator function //////////////////////////////////////////////////////////////////////////////////////////// template - class HermOpOperatorFunction : public OperatorFunction { + class HermOpOperatorFunction : public OperatorFunction { void operator() (LinearOperatorBase &Linop, const Field &in, Field &out) { Linop.HermOp(in,out); }; diff --git a/Grid/algorithms/SparseMatrix.h b/Grid/algorithms/SparseMatrix.h index 1611a6f4..9b0f7659 100644 --- a/Grid/algorithms/SparseMatrix.h +++ b/Grid/algorithms/SparseMatrix.h @@ -55,6 +55,14 @@ namespace Grid { template class CheckerBoardedSparseMatrixBase : public SparseMatrixBase { public: virtual GridBase *RedBlackGrid(void)=0; + + ////////////////////////////////////////////////////////////////////// + // Query the even even properties to make algorithmic decisions + ////////////////////////////////////////////////////////////////////// + virtual RealD Mass(void) { return 0.0; }; + virtual int ConstEE(void) { return 0; }; // Disable assumptions unless overridden + virtual int isTrivialEE(void) { return 0; }; // by a derived class that knows better + // half checkerboard operaions virtual void Meooe (const Field &in, Field &out)=0; virtual void Mooee (const Field &in, Field &out)=0; diff --git a/Grid/algorithms/iterative/BlockConjugateGradient.h b/Grid/algorithms/iterative/BlockConjugateGradient.h index 9a1e8b34..972aa608 100644 --- a/Grid/algorithms/iterative/BlockConjugateGradient.h +++ b/Grid/algorithms/iterative/BlockConjugateGradient.h @@ -135,7 +135,7 @@ void operator()(LinearOperatorBase &Linop, const Field &Src, Field &Psi) assert(0); } } -void operator()(LinearOperatorBase &Linop, const std::vector &Src, std::vector &Psi) +virtual void operator()(LinearOperatorBase &Linop, const std::vector &Src, std::vector &Psi) { if ( CGtype == BlockCGrQVec ) { BlockCGrQsolveVec(Linop,Src,Psi); diff --git a/Grid/algorithms/iterative/SchurRedBlack.h b/Grid/algorithms/iterative/SchurRedBlack.h index 5abc4d9f..fdb17a98 100644 --- a/Grid/algorithms/iterative/SchurRedBlack.h +++ b/Grid/algorithms/iterative/SchurRedBlack.h @@ -86,229 +86,23 @@ Author: Peter Boyle */ namespace Grid { + /////////////////////////////////////////////////////////////////////////////////////////////////////// + // Use base class to share code + /////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////// // Take a matrix and form a Red Black solver calling a Herm solver // Use of RB info prevents making SchurRedBlackSolve conform to standard interface /////////////////////////////////////////////////////////////////////////////////////////////////////// - // Now make the norm reflect extra factor of Mee - template class SchurRedBlackStaggeredSolve { - private: + template class SchurRedBlackBase { + protected: + typedef CheckerBoardedSparseMatrixBase Matrix; OperatorFunction & _HermitianRBSolver; int CBfactorise; bool subGuess; public: - ///////////////////////////////////////////////////// - // Wrap the usual normal equations Schur trick - ///////////////////////////////////////////////////// - SchurRedBlackStaggeredSolve(OperatorFunction &HermitianRBSolver, const bool initSubGuess = false) : - _HermitianRBSolver(HermitianRBSolver) - { - CBfactorise=0; - subtractGuess(initSubGuess); - }; - void subtractGuess(const bool initSubGuess) - { - subGuess = initSubGuess; - } - bool isSubtractGuess(void) - { - return subGuess; - } - - template - void operator() (Matrix & _Matrix,const Field &in, Field &out){ - ZeroGuesser guess; - (*this)(_Matrix,in,out,guess); - } - template - void operator() (Matrix & _Matrix,const Field &in, Field &out, Guesser &guess){ - - // FIXME CGdiagonalMee not implemented virtual function - // FIXME use CBfactorise to control schur decomp - GridBase *grid = _Matrix.RedBlackGrid(); - GridBase *fgrid= _Matrix.Grid(); - - SchurStaggeredOperator _HermOpEO(_Matrix); - - Field src_e(grid); - Field src_o(grid); - Field sol_e(grid); - Field sol_o(grid); - Field tmp(grid); - Field Mtmp(grid); - Field resid(fgrid); - - std::cout << GridLogMessage << " SchurRedBlackStaggeredSolve " < using SchurRedBlackStagSolve = SchurRedBlackStaggeredSolve; - - /////////////////////////////////////////////////////////////////////////////////////////////////////// - // Take a matrix and form a Red Black solver calling a Herm solver - // Use of RB info prevents making SchurRedBlackSolve conform to standard interface - /////////////////////////////////////////////////////////////////////////////////////////////////////// - template class SchurRedBlackDiagMooeeSolve { - private: - OperatorFunction & _HermitianRBSolver; - int CBfactorise; - bool subGuess; - public: - - ///////////////////////////////////////////////////// - // Wrap the usual normal equations Schur trick - ///////////////////////////////////////////////////// - SchurRedBlackDiagMooeeSolve(OperatorFunction &HermitianRBSolver,int cb=0, const bool initSubGuess = false) : _HermitianRBSolver(HermitianRBSolver) - { - CBfactorise=cb; - subtractGuess(initSubGuess); - }; - void subtractGuess(const bool initSubGuess) - { - subGuess = initSubGuess; - } - bool isSubtractGuess(void) - { - return subGuess; - } - template - void operator() (Matrix & _Matrix,const Field &in, Field &out){ - ZeroGuesser guess; - (*this)(_Matrix,in,out,guess); - } - template - void operator() (Matrix & _Matrix,const Field &in, Field &out,Guesser &guess){ - - // FIXME CGdiagonalMee not implemented virtual function - // FIXME use CBfactorise to control schur decomp - GridBase *grid = _Matrix.RedBlackGrid(); - GridBase *fgrid= _Matrix.Grid(); - - SchurDiagMooeeOperator _HermOpEO(_Matrix); - - Field src_e(grid); - Field src_o(grid); - Field sol_e(grid); - Field sol_o(grid); - Field tmp(grid); - Field Mtmp(grid); - Field resid(fgrid); - - pickCheckerboard(Even,src_e,in); - pickCheckerboard(Odd ,src_o,in); - pickCheckerboard(Even,sol_e,out); - pickCheckerboard(Odd ,sol_o,out); - - ///////////////////////////////////////////////////// - // src_o = Mdag * (source_o - Moe MeeInv source_e) - ///////////////////////////////////////////////////// - _Matrix.MooeeInv(src_e,tmp); assert( tmp.checkerboard ==Even); - _Matrix.Meooe (tmp,Mtmp); assert( Mtmp.checkerboard ==Odd); - tmp=src_o-Mtmp; assert( tmp.checkerboard ==Odd); - - // get the right MpcDag - _HermOpEO.MpcDag(tmp,src_o); assert(src_o.checkerboard ==Odd); - - ////////////////////////////////////////////////////////////// - // Call the red-black solver - ////////////////////////////////////////////////////////////// - std::cout< class SchurRedBlackDiagTwoSolve { - private: - OperatorFunction & _HermitianRBSolver; - int CBfactorise; - bool subGuess; - public: - - ///////////////////////////////////////////////////// - // Wrap the usual normal equations Schur trick - ///////////////////////////////////////////////////// - SchurRedBlackDiagTwoSolve(OperatorFunction &HermitianRBSolver, const bool initSubGuess = false) : - _HermitianRBSolver(HermitianRBSolver) + SchurRedBlackBase(OperatorFunction &HermitianRBSolver, const bool initSubGuess = false) : + _HermitianRBSolver(HermitianRBSolver) { CBfactorise = 0; subtractGuess(initSubGuess); @@ -322,12 +116,86 @@ namespace Grid { return subGuess; } - template + ///////////////////////////////////////////////////////////// + // Shared code + ///////////////////////////////////////////////////////////// void operator() (Matrix & _Matrix,const Field &in, Field &out){ ZeroGuesser guess; (*this)(_Matrix,in,out,guess); } - template + void operator()(Matrix &_Matrix, const std::vector &in, std::vector &out) + { + ZeroGuesser guess; + (*this)(_Matrix,in,out,guess); + } + + template + void operator()(Matrix &_Matrix, const std::vector &in, std::vector &out,Guesser &guess) + { + GridBase *grid = _Matrix.RedBlackGrid(); + GridBase *fgrid= _Matrix.Grid(); + int nblock = in.size(); + + std::vector src_o(nblock,grid); + std::vector sol_o(nblock,grid); + + std::vector guess_save; + + Field resid(fgrid); + Field tmp(grid); + + //////////////////////////////////////////////// + // Prepare RedBlack source + //////////////////////////////////////////////// + for(int b=0;b void operator() (Matrix & _Matrix,const Field &in, Field &out,Guesser &guess){ // FIXME CGdiagonalMee not implemented virtual function @@ -335,52 +203,39 @@ namespace Grid { GridBase *grid = _Matrix.RedBlackGrid(); GridBase *fgrid= _Matrix.Grid(); - SchurDiagTwoOperator _HermOpEO(_Matrix); - - Field src_e(grid); - Field src_o(grid); - Field sol_e(grid); - Field sol_o(grid); - Field tmp(grid); - Field Mtmp(grid); Field resid(fgrid); + Field src_o(grid); + Field src_e(grid); + Field sol_o(grid); - pickCheckerboard(Even,src_e,in); - pickCheckerboard(Odd ,src_o,in); - pickCheckerboard(Even,sol_e,out); - pickCheckerboard(Odd ,sol_o,out); - - ///////////////////////////////////////////////////// - // src_o = Mdag * (source_o - Moe MeeInv source_e) - ///////////////////////////////////////////////////// - _Matrix.MooeeInv(src_e,tmp); assert( tmp.checkerboard ==Even); - _Matrix.Meooe (tmp,Mtmp); assert( Mtmp.checkerboard ==Odd); - tmp=src_o-Mtmp; assert( tmp.checkerboard ==Odd); + //////////////////////////////////////////////// + // RedBlack source + //////////////////////////////////////////////// + RedBlackSource(_Matrix,in,src_e,src_o); - // get the right MpcDag - _HermOpEO.MpcDag(tmp,src_o); assert(src_o.checkerboard ==Odd); + //////////////////////////////// + // Construct the guess + //////////////////////////////// + Field tmp(grid); + guess(src_o,sol_o); + + Field guess_save(grid); + guess_save = sol_o; ////////////////////////////////////////////////////////////// // Call the red-black solver ////////////////////////////////////////////////////////////// - std::cout< &src_o, std::vector &sol_o)=0; + }; - /////////////////////////////////////////////////////////////////////////////////////////////////////// - // Take a matrix and form a Red Black solver calling a Herm solver - // Use of RB info prevents making SchurRedBlackSolve conform to standard interface - /////////////////////////////////////////////////////////////////////////////////////////////////////// - template class SchurRedBlackDiagTwoMixed { - private: - LinearFunction & _HermitianRBSolver; - int CBfactorise; - bool subGuess; + + template class SchurRedBlackStaggeredSolve : public SchurRedBlackBase { public: + typedef CheckerBoardedSparseMatrixBase Matrix; + + SchurRedBlackStaggeredSolve(OperatorFunction &HermitianRBSolver, const bool initSubGuess = false) + : SchurRedBlackBase (HermitianRBSolver,initSubGuess) + { + } + + ////////////////////////////////////////////////////// + // Override RedBlack specialisation + ////////////////////////////////////////////////////// + virtual void RedBlackSource(Matrix & _Matrix,const Field &src, Field &src_e,Field &src_o) + { + GridBase *grid = _Matrix.RedBlackGrid(); + GridBase *fgrid= _Matrix.Grid(); + + Field tmp(grid); + Field Mtmp(grid); + + pickCheckerboard(Even,src_e,src); + pickCheckerboard(Odd ,src_o,src); + + ///////////////////////////////////////////////////// + // src_o = (source_o - Moe MeeInv source_e) + ///////////////////////////////////////////////////// + _Matrix.MooeeInv(src_e,tmp); assert( tmp.checkerboard ==Even); + _Matrix.Meooe (tmp,Mtmp); assert( Mtmp.checkerboard ==Odd); + tmp=src_o-Mtmp; assert( tmp.checkerboard ==Odd); + + _Matrix.Mooee(tmp,src_o); // Extra factor of "m" in source from dumb choice of matrix norm. + } + virtual void RedBlackSolution(Matrix & _Matrix,const Field &sol_o, const Field &src_e_c,Field &sol) + { + GridBase *grid = _Matrix.RedBlackGrid(); + GridBase *fgrid= _Matrix.Grid(); + + Field tmp(grid); + Field sol_e(grid); + Field src_e(grid); + + src_e = src_e_c; // Const correctness + + /////////////////////////////////////////////////// + // sol_e = M_ee^-1 * ( src_e - Meo sol_o )... + /////////////////////////////////////////////////// + _Matrix.Meooe(sol_o,tmp); assert( tmp.checkerboard ==Even); + src_e = src_e-tmp; assert( src_e.checkerboard ==Even); + _Matrix.MooeeInv(src_e,sol_e); assert( sol_e.checkerboard ==Even); + + setCheckerboard(sol,sol_e); assert( sol_e.checkerboard ==Even); + setCheckerboard(sol,sol_o); assert( sol_o.checkerboard ==Odd ); + } + virtual void RedBlackSolve (Matrix & _Matrix,const Field &src_o, Field &sol_o) + { + SchurStaggeredOperator _HermOpEO(_Matrix); + this->_HermitianRBSolver(_HermOpEO,src_o,sol_o); assert(sol_o.checkerboard==Odd); + }; + virtual void RedBlackSolve (Matrix & _Matrix,const std::vector &src_o, std::vector &sol_o) + { + SchurStaggeredOperator _HermOpEO(_Matrix); + this->_HermitianRBSolver(_HermOpEO,src_o,sol_o); + } + }; + template using SchurRedBlackStagSolve = SchurRedBlackStaggeredSolve; + + /////////////////////////////////////////////////////////////////////////////////////////////////////// + // Site diagonal has Mooee on it. + /////////////////////////////////////////////////////////////////////////////////////////////////////// + template class SchurRedBlackDiagMooeeSolve : public SchurRedBlackBase { + public: + typedef CheckerBoardedSparseMatrixBase Matrix; + + SchurRedBlackDiagMooeeSolve(OperatorFunction &HermitianRBSolver, const bool initSubGuess = false) + : SchurRedBlackBase (HermitianRBSolver,initSubGuess) {}; + + + ////////////////////////////////////////////////////// + // Override RedBlack specialisation + ////////////////////////////////////////////////////// + virtual void RedBlackSource(Matrix & _Matrix,const Field &src, Field &src_e,Field &src_o) + { + GridBase *grid = _Matrix.RedBlackGrid(); + GridBase *fgrid= _Matrix.Grid(); + + Field tmp(grid); + Field Mtmp(grid); + + pickCheckerboard(Even,src_e,src); + pickCheckerboard(Odd ,src_o,src); + + ///////////////////////////////////////////////////// + // src_o = Mdag * (source_o - Moe MeeInv source_e) + ///////////////////////////////////////////////////// + _Matrix.MooeeInv(src_e,tmp); assert( tmp.checkerboard ==Even); + _Matrix.Meooe (tmp,Mtmp); assert( Mtmp.checkerboard ==Odd); + tmp=src_o-Mtmp; assert( tmp.checkerboard ==Odd); + + // get the right MpcDag + SchurDiagMooeeOperator _HermOpEO(_Matrix); + _HermOpEO.MpcDag(tmp,src_o); assert(src_o.checkerboard ==Odd); + + } + virtual void RedBlackSolution(Matrix & _Matrix,const Field &sol_o, const Field &src_e,Field &sol) + { + GridBase *grid = _Matrix.RedBlackGrid(); + GridBase *fgrid= _Matrix.Grid(); + + Field tmp(grid); + Field sol_e(grid); + Field src_e_i(grid); + /////////////////////////////////////////////////// + // sol_e = M_ee^-1 * ( src_e - Meo sol_o )... + /////////////////////////////////////////////////// + _Matrix.Meooe(sol_o,tmp); assert( tmp.checkerboard ==Even); + src_e_i = src_e-tmp; assert( src_e_i.checkerboard ==Even); + _Matrix.MooeeInv(src_e_i,sol_e); assert( sol_e.checkerboard ==Even); + + setCheckerboard(sol,sol_e); assert( sol_e.checkerboard ==Even); + setCheckerboard(sol,sol_o); assert( sol_o.checkerboard ==Odd ); + } + virtual void RedBlackSolve (Matrix & _Matrix,const Field &src_o, Field &sol_o) + { + SchurDiagMooeeOperator _HermOpEO(_Matrix); + this->_HermitianRBSolver(_HermOpEO,src_o,sol_o); assert(sol_o.checkerboard==Odd); + }; + virtual void RedBlackSolve (Matrix & _Matrix,const std::vector &src_o, std::vector &sol_o) + { + SchurDiagMooeeOperator _HermOpEO(_Matrix); + this->_HermitianRBSolver(_HermOpEO,src_o,sol_o); + } + }; + + /////////////////////////////////////////////////////////////////////////////////////////////////////// + // Site diagonal is identity, right preconditioned by Mee^inv + // ( 1 - Meo Moo^inv Moe Mee^inv ) phi =( 1 - Meo Moo^inv Moe Mee^inv ) Mee psi = = eta = eta + //=> psi = MeeInv phi + /////////////////////////////////////////////////////////////////////////////////////////////////////// + template class SchurRedBlackDiagTwoSolve : public SchurRedBlackBase { + public: + typedef CheckerBoardedSparseMatrixBase Matrix; ///////////////////////////////////////////////////// // Wrap the usual normal equations Schur trick ///////////////////////////////////////////////////// - SchurRedBlackDiagTwoMixed(LinearFunction &HermitianRBSolver, const bool initSubGuess = false) : - _HermitianRBSolver(HermitianRBSolver) - { - CBfactorise=0; - subtractGuess(initSubGuess); - }; - void subtractGuess(const bool initSubGuess) - { - subGuess = initSubGuess; - } - bool isSubtractGuess(void) - { - return subGuess; - } + SchurRedBlackDiagTwoSolve(OperatorFunction &HermitianRBSolver, const bool initSubGuess = false) + : SchurRedBlackBase(HermitianRBSolver,initSubGuess) {}; - template - void operator() (Matrix & _Matrix,const Field &in, Field &out){ - ZeroGuesser guess; - (*this)(_Matrix,in,out,guess); - } - template - void operator() (Matrix & _Matrix,const Field &in, Field &out,Guesser &guess){ - - // FIXME CGdiagonalMee not implemented virtual function - // FIXME use CBfactorise to control schur decomp + virtual void RedBlackSource(Matrix & _Matrix,const Field &src, Field &src_e,Field &src_o) + { GridBase *grid = _Matrix.RedBlackGrid(); GridBase *fgrid= _Matrix.Grid(); SchurDiagTwoOperator _HermOpEO(_Matrix); - - Field src_e(grid); - Field src_o(grid); - Field sol_e(grid); - Field sol_o(grid); + Field tmp(grid); Field Mtmp(grid); - Field resid(fgrid); - pickCheckerboard(Even,src_e,in); - pickCheckerboard(Odd ,src_o,in); - pickCheckerboard(Even,sol_e,out); - pickCheckerboard(Odd ,sol_o,out); + pickCheckerboard(Even,src_e,src); + pickCheckerboard(Odd ,src_o,src); ///////////////////////////////////////////////////// // src_o = Mdag * (source_o - Moe MeeInv source_e) @@ -461,43 +430,44 @@ namespace Grid { // get the right MpcDag _HermOpEO.MpcDag(tmp,src_o); assert(src_o.checkerboard ==Odd); + } - ////////////////////////////////////////////////////////////// - // Call the red-black solver - ////////////////////////////////////////////////////////////// - std::cout< _HermOpEO(_Matrix); + this->_HermitianRBSolver(_HermOpEO,src_o,sol_o); + }; + virtual void RedBlackSolve (Matrix & _Matrix,const std::vector &src_o, std::vector &sol_o) + { + SchurDiagTwoOperator _HermOpEO(_Matrix); + this->_HermitianRBSolver(_HermOpEO,src_o,sol_o); + } }; - } #endif diff --git a/Grid/communicator/Communicator_mpi3.cc b/Grid/communicator/Communicator_mpi3.cc index 424b7973..e6800afe 100644 --- a/Grid/communicator/Communicator_mpi3.cc +++ b/Grid/communicator/Communicator_mpi3.cc @@ -50,8 +50,6 @@ void CartesianCommunicator::Init(int *argc, char ***argv) assert(0); } - Grid_quiesce_nodes(); - // Never clean up as done once. MPI_Comm_dup (MPI_COMM_WORLD,&communicator_world); @@ -124,10 +122,8 @@ CartesianCommunicator::CartesianCommunicator(const std::vector &processors, // split the communicator ////////////////////////////////////////////////////////////////////////////////////////////////////// // int Nparent = parent._processors ; - // std::cout << " splitting from communicator "< &processors, int Nchild = Nparent/childsize; assert (childsize * Nchild == Nparent); - // std::cout << " child size "< ccoor(_ndimension); // coor within subcommunicator std::vector scoor(_ndimension); // coor of split within parent std::vector ssize(_ndimension); // coor of split within parent diff --git a/Grid/communicator/SharedMemoryMPI.cc b/Grid/communicator/SharedMemoryMPI.cc index b425d97b..d3b094ad 100644 --- a/Grid/communicator/SharedMemoryMPI.cc +++ b/Grid/communicator/SharedMemoryMPI.cc @@ -413,7 +413,7 @@ void GlobalSharedMemory::SharedMemoryAllocate(uint64_t bytes, int flags) assert(((uint64_t)ptr&0x3F)==0); close(fd); WorldShmCommBufs[r] =ptr; - std::cout << "Set WorldShmCommBufs["< &lowDim, Lattice & higherDim,int assert(orthog>=0); for(int d=0;d_processors[d] == hg->_processors[d]); - assert(lg->_ldimensions[d] == hg->_ldimensions[d]); + if ( d!=orthog ) { + assert(lg->_processors[d] == hg->_processors[d]); + assert(lg->_ldimensions[d] == hg->_ldimensions[d]); + } } // the above should guarantee that the operations are local @@ -499,8 +501,10 @@ void ExtractSliceLocal(Lattice &lowDim, Lattice & higherDim,int slic assert(orthog>=0); for(int d=0;d_processors[d] == hg->_processors[d]); - assert(lg->_ldimensions[d] == hg->_ldimensions[d]); + if ( d!=orthog ) { + assert(lg->_processors[d] == hg->_processors[d]); + assert(lg->_ldimensions[d] == hg->_ldimensions[d]); + } } // the above should guarantee that the operations are local diff --git a/Grid/log/Log.h b/Grid/log/Log.h index b58c5d16..5d97ee5a 100644 --- a/Grid/log/Log.h +++ b/Grid/log/Log.h @@ -146,9 +146,11 @@ public: if ( log.timestamp ) { log.StopWatch->Stop(); GridTime now = log.StopWatch->Elapsed(); + if ( log.timing_mode==1 ) log.StopWatch->Reset(); log.StopWatch->Start(); - stream << log.evidence()<< std::setw(6)< GridTimePoint; -typedef std::chrono::milliseconds GridMillisecs; -typedef std::chrono::microseconds GridTime; -typedef std::chrono::microseconds GridUsecs; -inline std::ostream& operator<< (std::ostream & stream, const std::chrono::milliseconds & time) +typedef std::chrono::seconds GridSecs; +typedef std::chrono::milliseconds GridMillisecs; +typedef std::chrono::microseconds GridUsecs; +typedef std::chrono::microseconds GridTime; + +inline std::ostream& operator<< (std::ostream & stream, const GridSecs & time) { - stream << time.count()<<" ms"; + stream << time.count()<<" s"; return stream; } -inline std::ostream& operator<< (std::ostream & stream, const std::chrono::microseconds & time) +inline std::ostream& operator<< (std::ostream & stream, const GridMillisecs & now) { - stream << time.count()<<" usec"; + GridSecs second(1); + auto secs = now/second ; + auto subseconds = now%second ; + stream << secs<<"."< + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + See the full license in the file "LICENSE" in the top level distribution directory + *************************************************************************************/ + /* END LEGAL */ +#include + +using namespace std; +using namespace Grid; +using namespace Grid::QCD; + + +int main (int argc, char ** argv) +{ + typedef LatticeComplex ComplexField; + + Grid_init(&argc,&argv); + + std::vector latt_size = GridDefaultLatt(); + int nd = latt_size.size(); + int ndm1 = nd-1; + + std::vector simd_layout = GridDefaultSimd(nd,vComplex::Nsimd()); + std::vector mpi_layout = GridDefaultMpi(); + std::vector mpi_split (mpi_layout.size(),1); + + std::cout << " Full " << GridCmdVectorIntToString(latt_size) << " subgrid" < latt_m = latt_size; latt_m[nd-1] = 1; + std::vector mpi_m = mpi_layout; mpi_m [nd-1] = 1; + std::vector simd_m = GridDefaultSimd(ndm1,vComplex::Nsimd()); simd_m.push_back(1); + + + std::cout << " Requesting " << GridCmdVectorIntToString(latt_m)<< " subgrid" <GlobalSum(tmp); + std::cout << GridLogMessage<< " Full nodes "<< tmp <GlobalSum(tmp); + std::cout << GridLogMessage<< " Split nodes "<< tmp <Barrier(); + + auto local_latt = GridN->LocalDimensions(); + + Full_cpy = zero; + std::vector seeds({1,2,3,4}); + GridParallelRNG RNG(GridN); RNG.SeedFixedIntegers(seeds); + + random(RNG,Full); + for(int t=0;t BCGV (BlockCGrQVec,blockDim,stp,100000); + + { - BCGV(HermOp,src,result); + BlockConjugateGradient BCGV (BlockCGrQVec,blockDim,stp,100000); + SchurRedBlackDiagTwoSolve SchurSolver(BCGV); + SchurSolver(Ddwf,src,result); } for(int rhs=0;rhs