1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-04-09 21:50:45 +01:00

consistency of tests

This commit is contained in:
Guido Cossu 2016-12-13 02:24:20 +00:00
parent 7bc2065113
commit ef72f322d2
4 changed files with 80 additions and 19 deletions

View File

@ -28,10 +28,14 @@
*************************************************************************************/ *************************************************************************************/
/* END LEGAL */ /* END LEGAL */
#include <Grid.h> #include <Grid.h>
#include <ctype.h>
using namespace Grid; using namespace Grid;
using namespace std; using namespace std;
#define GRID_TEXT_INDENT 2 //number of spaces for indentation of levels
// Writer implementation /////////////////////////////////////////////////////// // Writer implementation ///////////////////////////////////////////////////////
TextWriter::TextWriter(const string &fileName) TextWriter::TextWriter(const string &fileName)
: file_(fileName, ios::out) : file_(fileName, ios::out)
@ -50,9 +54,8 @@ void TextWriter::pop(void)
void TextWriter::indent(void) void TextWriter::indent(void)
{ {
for (int i = 0; i < level_; ++i) for (int i = 0; i < level_; ++i)
{ for (int t = 0; t < GRID_TEXT_INDENT; t++)
file_ << '\t';//is this portable? file_ << ' ';
}
}; };
// Reader implementation /////////////////////////////////////////////////////// // Reader implementation ///////////////////////////////////////////////////////
@ -61,7 +64,7 @@ TextReader::TextReader(const string &fileName)
file_.open(fileName, ios::in); file_.open(fileName, ios::in);
if (!file_.is_open()) { if (!file_.is_open()) {
std::cout << GridLogMessage << "TextReader: Error opening file " << fileName << std::endl; std::cout << GridLogMessage << "TextReader: Error opening file " << fileName << std::endl;
exit(0);// write better error handling exit(1);// write better error handling
} }
} }
@ -81,12 +84,15 @@ void TextReader::checkIndent(void)
for (int i = 0; i < level_; ++i) for (int i = 0; i < level_; ++i)
{ {
bool check = true;
for (int t = 0; t< GRID_TEXT_INDENT; t++){
file_.get(c); file_.get(c);
if (c != '\t') check = check && isspace(c);
}
if (!check)
{ {
cerr << "TextReader: mismatch on tab " << c << " level " << level_; cerr << "TextReader: mismatch on level " << level_ << std::endl;
cerr << " i "<< i << endl; exit(1);
abort();
} }
} }
} }

49
lib/supported_compilers.h Normal file
View File

@ -0,0 +1,49 @@
/*************************************************************************************
Grid physics library, www.github.com/paboyle/Grid
Source file: ./lib/supported_compilers.h
Copyright (C) 2016
Author: Guido Cossu <guido.cossu@ed.ac.uk>
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 */
#ifndef COMPILER_CHECK_H
#define COMPILER_CHECK_H
// exclude unsupported compilers
#if defined(__clang__)
#define CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
#if CLANG_VERSION < 30800
#error "unsupported Clang version"
#endif
#elif defined(__GNUC__)
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#if GCC_VERSION < 40800
#error "unsupported GCC version"
#endif
#endif
#endif

View File

@ -175,10 +175,10 @@ int main(int argc, char **argv) {
// Seeds for the random number generators // Seeds for the random number generators
std::vector<int> SerSeed({1, 2, 3, 4, 5}); std::vector<int> SerSeed({1, 2, 3, 4, 5});
std::vector<int> ParSeed({6, 7, 8, 9, 5}); std::vector<int> ParSeed({6, 7, 8, 9, 10});
TheHMC.RNGSeeds(SerSeed, ParSeed); TheHMC.RNGSeeds(SerSeed, ParSeed);
TheHMC.MDparameters.set(20, 1.0);// MDsteps, traj length TheHMC.MDparameters.set(40, 1.0);// MDsteps, traj length
TheHMC.BuildTheAction(argc, argv); TheHMC.BuildTheAction(argc, argv);

View File

@ -63,7 +63,8 @@ public:
{ {
typedef WilsonImplR ImplPolicy; typedef WilsonImplR ImplPolicy;
typedef ScaledShamirFermion<ImplPolicy> FermionAction; //typedef ScaledShamirFermion<ImplPolicy> FermionAction;
typedef DomainWallFermionR FermionAction;
typedef typename FermionAction::FermionField FermionField; typedef typename FermionAction::FermionField FermionField;
const int Ls = 8; const int Ls = 8;
@ -78,15 +79,19 @@ public:
LatticeGaugeField U(UGrid); LatticeGaugeField U(UGrid);
// Gauge action // Gauge action
double beta = 4.0; double beta = 5.6;
WilsonGaugeActionR Waction(beta); WilsonGaugeActionR Waction(beta);
Real mass = 0.04; Real mass = 0.04;
Real pv = 1.0; Real pv = 1.0;
RealD M5 = 1.5; RealD M5 = 1.5;
RealD scale = 2.0; RealD scale = 2.0;
/*
FermionAction DenOp(U,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5,scale); FermionAction DenOp(U,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5,scale);
FermionAction NumOp(U,*FGrid,*FrbGrid,*UGrid,*UrbGrid,pv,M5,scale); FermionAction NumOp(U,*FGrid,*FrbGrid,*UGrid,*UrbGrid,pv,M5,scale);
*/
FermionAction DenOp(U,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5);
FermionAction NumOp(U,*FGrid,*FrbGrid,*UGrid,*UrbGrid,pv,M5);
double StoppingCondition = 1.0e-8; double StoppingCondition = 1.0e-8;
double MaxCGIterations = 10000; double MaxCGIterations = 10000;
@ -100,15 +105,16 @@ public:
// here an example of 2 level integration // here an example of 2 level integration
ActionLevel<Field> Level1(1); ActionLevel<Field> Level1(1);
Level1.push_back(&Nf2); Level1.push_back(&Nf2);
Level1.push_back(&Waction);
// this level will integrate with a // this level will integrate with a
// step that is 4 times finer // step that is 4 times finer
// than the previous level // than the previous level
ActionLevel<Field> Level2(4); //ActionLevel<Field> Level2(4);
Level2.push_back(&Waction);
TheAction.push_back(Level1); TheAction.push_back(Level1);
TheAction.push_back(Level2); //TheAction.push_back(Level2);
// Add observables // Add observables
int SaveInterval = 1; int SaveInterval = 1;
@ -137,8 +143,8 @@ public:
NumOp.ZeroCounters(); NumOp.ZeroCounters();
DenOp.ZeroCounters(); DenOp.ZeroCounters();
Run(argc, argv, Checkpoint, SmearingPolicy); //Run(argc, argv, Checkpoint, SmearingPolicy);
//Run(argc, argv, Checkpoint); // no smearing Run(argc, argv, Checkpoint); // no smearing
@ -163,10 +169,10 @@ int main(int argc, char **argv) {
// Seeds for the random number generators // Seeds for the random number generators
std::vector<int> SerSeed({1, 2, 3, 4, 5}); std::vector<int> SerSeed({1, 2, 3, 4, 5});
std::vector<int> ParSeed({6, 7, 8, 9, 5}); std::vector<int> ParSeed({6, 7, 8, 9, 10});
TheHMC.RNGSeeds(SerSeed, ParSeed); TheHMC.RNGSeeds(SerSeed, ParSeed);
TheHMC.MDparameters.set(20, 1.0);// MDsteps, traj length TheHMC.MDparameters.set(40, 1.0);// MDsteps, traj length
TheHMC.BuildTheAction(argc, argv); TheHMC.BuildTheAction(argc, argv);