1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +00:00

Merge pull request #33 from aportelli/master

Travis for clang 3.8 + various updates/fixes
This commit is contained in:
Peter Boyle 2016-05-05 22:57:13 +01:00
commit f8f9fd6f22
8 changed files with 70 additions and 38 deletions

View File

@ -33,19 +33,6 @@ matrix:
- libmpc-dev - libmpc-dev
- binutils-dev - binutils-dev
env: VERSION=-5 env: VERSION=-5
- compiler: clang
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.6
packages:
- clang-3.6
- libmpfr-dev
- libgmp-dev
- libmpc-dev
- binutils-dev
env: VERSION=-3.6
- compiler: clang - compiler: clang
addons: addons:
apt: apt:
@ -59,6 +46,19 @@ matrix:
- libmpc-dev - libmpc-dev
- binutils-dev - binutils-dev
env: VERSION=-3.7 env: VERSION=-3.7
- compiler: clang
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8
packages:
- clang-3.8
- libmpfr-dev
- libgmp-dev
- libmpc-dev
- binutils-dev
env: VERSION=-3.8
before_install: before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi

View File

@ -190,6 +190,7 @@ void Grid_init(int *argc,char ***argv)
std::cout<<GridLogMessage<<"--omp n : default number of OMP threads"<<std::endl; std::cout<<GridLogMessage<<"--omp n : default number of OMP threads"<<std::endl;
std::cout<<GridLogMessage<<"--grid n.n.n.n : default Grid size"<<std::endl; std::cout<<GridLogMessage<<"--grid n.n.n.n : default Grid size"<<std::endl;
std::cout<<GridLogMessage<<"--log list : comma separted list of streams from Error,Warning,Message,Performance,Iterative,Integrator,Debug"<<std::endl; std::cout<<GridLogMessage<<"--log list : comma separted list of streams from Error,Warning,Message,Performance,Iterative,Integrator,Debug"<<std::endl;
exit(EXIT_SUCCESS);
} }
if( GridCmdOptionExists(*argv,*argv+*argc,"--log") ){ if( GridCmdOptionExists(*argv,*argv+*argc,"--log") ){

View File

@ -84,7 +84,7 @@ public:
return; return;
} }
std::cout<<GridLogIterative << std::setprecision(4)<< "ConjugateGradient: k=0 residual "<<cp<<" rsq"<<rsq<<std::endl; std::cout<<GridLogIterative << std::setprecision(4)<< "ConjugateGradient: k=0 residual "<<cp<<" target "<<rsq<<std::endl;
GridStopWatch LinalgTimer; GridStopWatch LinalgTimer;
GridStopWatch MatrixTimer; GridStopWatch MatrixTimer;
@ -115,7 +115,7 @@ public:
p = p*b+r; p = p*b+r;
LinalgTimer.Stop(); LinalgTimer.Stop();
std::cout<<GridLogIterative<<"ConjugateGradient: Iteration " <<k<<" residual "<<cp<< " target"<< rsq<<std::endl; std::cout<<GridLogIterative<<"ConjugateGradient: Iteration " <<k<<" residual "<<cp<< " target "<< rsq<<std::endl;
// Stopping condition // Stopping condition
if ( cp <= rsq ) { if ( cp <= rsq ) {
@ -132,9 +132,9 @@ public:
std::cout<<GridLogMessage<<"ConjugateGradient: Converged on iteration " <<k std::cout<<GridLogMessage<<"ConjugateGradient: Converged on iteration " <<k
<<" computed residual "<<sqrt(cp/ssq) <<" computed residual "<<sqrt(cp/ssq)
<<" true residual "<<true_residual <<" true residual " <<true_residual
<<" target "<<Tolerance<<std::endl; <<" target "<<Tolerance<<std::endl;
std::cout<<GridLogMessage<<" Time elapsed: Total "<< SolverTimer.Elapsed() << " Matrix "<<MatrixTimer.Elapsed() << " Linalg "<<LinalgTimer.Elapsed(); std::cout<<GridLogMessage<<"Time elapsed: Total "<< SolverTimer.Elapsed() << " Matrix "<<MatrixTimer.Elapsed() << " Linalg "<<LinalgTimer.Elapsed();
std::cout<<std::endl; std::cout<<std::endl;
assert(true_residual/Tolerance < 1000.0); assert(true_residual/Tolerance < 1000.0);

View File

@ -102,6 +102,8 @@ namespace Grid {
pickCheckerboard(Even,src_e,in); pickCheckerboard(Even,src_e,in);
pickCheckerboard(Odd ,src_o,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) // src_o = Mdag * (source_o - Moe MeeInv source_e)

View File

@ -152,7 +152,7 @@ template<class vobj> inline void sliceSum(const Lattice<vobj> &Data,std::vector<
assert(grid!=NULL); assert(grid!=NULL);
// FIXME // FIXME
std::cout<<GridLogMessage<<"WARNING ! SliceSum is unthreaded "<<grid->SumArraySize()<<" threads "<<std::endl; // std::cout<<GridLogMessage<<"WARNING ! SliceSum is unthreaded "<<grid->SumArraySize()<<" threads "<<std::endl;
const int Nd = grid->_ndimension; const int Nd = grid->_ndimension;
const int Nsimd = grid->Nsimd(); const int Nsimd = grid->Nsimd();

View File

@ -61,6 +61,31 @@ namespace Grid {
" " " "
}; };
SpinMatrix makeGammaProd(const unsigned int i)
{
SpinMatrix g;
g = 1.;
if (i & 0x1)
{
g = g*Gamma(Gamma::GammaMatrix::GammaX);
}
if (i & 0x2)
{
g = g*Gamma(Gamma::GammaMatrix::GammaY);
}
if (i & 0x4)
{
g = g*Gamma(Gamma::GammaMatrix::GammaZ);
}
if (i & 0x8)
{
g = g*Gamma(Gamma::GammaMatrix::GammaT);
}
return g;
}
// void sprojMul( vHalfSpinColourVector &out,vColourMatrix &u, vSpinColourVector &in){ // void sprojMul( vHalfSpinColourVector &out,vColourMatrix &u, vSpinColourVector &in){
// vHalfSpinColourVector hspin; // vHalfSpinColourVector hspin;
// spProjXp(hspin,in); // spProjXp(hspin,in);

View File

@ -83,6 +83,9 @@ namespace QCD {
}; };
// Make gamma products (Chroma convention)
SpinMatrix makeGammaProd(const unsigned int i);
/* Gx /* Gx
* 0 0 0 i * 0 0 0 i
* 0 0 i 0 * 0 0 i 0

View File

@ -49,6 +49,24 @@ namespace Grid {
return v; return v;
} }
// output to streams for vectors
template < class T >
inline std::ostream & operator<<(std::ostream &os, const std::vector<T> &v)
{
os << "[";
for (auto &x: v)
{
os << x << " ";
}
if (v.size() > 0)
{
os << "\b";
}
os << "]";
return os;
}
class Serializable {}; class Serializable {};
// static polymorphism implemented using CRTP idiom // static polymorphism implemented using CRTP idiom
@ -154,23 +172,6 @@ namespace Grid {
r.read(s, output); r.read(s, output);
} }
template < class T >
inline std::ostream& operator << (std::ostream& os, const std::vector<T>& v)
{
os << "[";
for (auto &x: v)
{
os << x << " ";
}
if (v.size() > 0)
{
os << "\b";
}
os << "]";
return os;
}
// Writer template implementation //////////////////////////////////////////// // Writer template implementation ////////////////////////////////////////////
template <typename T> template <typename T>
Writer<T>::Writer(void) Writer<T>::Writer(void)