mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-03 02:35:55 +01:00
Merge branch 'release/v0.7.0'
This commit is contained in:
commit
c4435e6beb
@ -24,7 +24,7 @@ _Please do not send pull requests to the `master` branch which is reserved for r
|
||||
|
||||
### Compilers
|
||||
|
||||
Intel ICPC v16 and later
|
||||
Intel ICPC v16.0.3 and later
|
||||
|
||||
Clang v3.5 and later (need 3.8 and later for OpenMP)
|
||||
|
||||
@ -52,7 +52,7 @@ When you file an issue, please go though the following checklist:
|
||||
2. Give a description of the target platform (CPU, network, compiler). Please give the full CPU part description, using for example `cat /proc/cpuinfo | grep 'model name' | uniq` (Linux) or `sysctl machdep.cpu.brand_string` (macOS) and the full output the `--version` option of your compiler.
|
||||
3. Give the exact `configure` command used.
|
||||
4. Attach `config.log`.
|
||||
5. Attach `config.summary`.
|
||||
5. Attach `grid.config.summary`.
|
||||
6. Attach the output of `make V=1`.
|
||||
7. Describe the issue and any previous attempt to solve it. If relevant, show how to reproduce the issue using a minimal working example.
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
]#!/usr/bin/env bash
|
||||
|
||||
EIGEN_URL='http://bitbucket.org/eigen/eigen/get/3.2.9.tar.bz2'
|
||||
EIGEN_URL='http://bitbucket.org/eigen/eigen/get/3.3.3.tar.bz2'
|
||||
|
||||
echo "-- deploying Eigen source..."
|
||||
wget ${EIGEN_URL} --no-check-certificate
|
||||
|
@ -1,9 +1,9 @@
|
||||
AC_PREREQ([2.63])
|
||||
AC_INIT([Grid], [0.6.0-dev], [https://github.com/paboyle/Grid], [Grid])
|
||||
AC_INIT([Grid], [0.7.0], [https://github.com/paboyle/Grid], [Grid])
|
||||
AC_CANONICAL_BUILD
|
||||
AC_CANONICAL_HOST
|
||||
AC_CANONICAL_TARGET
|
||||
AM_INIT_AUTOMAKE(subdir-objects)
|
||||
AM_INIT_AUTOMAKE([subdir-objects 1.13])
|
||||
AM_EXTRA_RECURSIVE_TARGETS([tests bench])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AC_CONFIG_SRCDIR([lib/Grid.h])
|
||||
@ -29,6 +29,7 @@ AC_DEFINE_UNQUOTED([GXX_VERSION],["$GXX_VERSION"],
|
||||
|
||||
CXXFLAGS="-O3 $CXXFLAGS"
|
||||
|
||||
|
||||
############### Checks for typedefs, structures, and compiler characteristics
|
||||
AC_TYPE_SIZE_T
|
||||
AC_TYPE_UINT32_T
|
||||
|
@ -28,7 +28,7 @@ SOFTWARE.
|
||||
|
||||
#ifndef NLOHMANN_JSON_HPP
|
||||
#define NLOHMANN_JSON_HPP
|
||||
|
||||
#include <Grid/DisableWarnings.h>
|
||||
#include <algorithm> // all_of, for_each, transform
|
||||
#include <array> // array
|
||||
#include <cassert> // assert
|
||||
|
@ -30,6 +30,7 @@ directory
|
||||
*************************************************************************************/
|
||||
/* END LEGAL */
|
||||
#include <Grid/GridCore.h>
|
||||
#include <Grid/util/CompilerCompatible.h>
|
||||
|
||||
#include <cxxabi.h>
|
||||
#include <memory>
|
||||
|
@ -220,20 +220,32 @@ namespace QCD {
|
||||
|
||||
inline void DoubleStore(GridBase *GaugeGrid,
|
||||
DoubledGaugeField &Uds,
|
||||
const GaugeField &Umu) {
|
||||
const GaugeField &Umu)
|
||||
{
|
||||
typedef typename Simd::scalar_type scalar_type;
|
||||
|
||||
conformable(Uds._grid, GaugeGrid);
|
||||
conformable(Umu._grid, GaugeGrid);
|
||||
|
||||
GaugeLinkField U(GaugeGrid);
|
||||
GaugeLinkField tmp(GaugeGrid);
|
||||
|
||||
Lattice<iScalar<vInteger> > coor(GaugeGrid);
|
||||
for (int mu = 0; mu < Nd; mu++) {
|
||||
LatticeCoordinate(coor, mu);
|
||||
|
||||
auto pha = Params.boundary_phases[mu];
|
||||
scalar_type phase( real(pha),imag(pha) );
|
||||
|
||||
int Lmu = GaugeGrid->GlobalDimensions()[mu] - 1;
|
||||
|
||||
LatticeCoordinate(coor, mu);
|
||||
|
||||
U = PeekIndex<LorentzIndex>(Umu, mu);
|
||||
tmp = where(coor == Lmu, Params.boundary_phases[mu] * U, U);
|
||||
tmp = where(coor == Lmu, phase * U, U);
|
||||
PokeIndex<LorentzIndex>(Uds, tmp, mu);
|
||||
|
||||
U = adj(Cshift(U, mu, -1));
|
||||
U = where(coor == 0, Params.boundary_phases[mu] * U, U);
|
||||
U = where(coor == 0, conjugate(phase) * U, U);
|
||||
PokeIndex<LorentzIndex>(Uds, U, mu + 4);
|
||||
}
|
||||
}
|
||||
@ -251,11 +263,11 @@ namespace QCD {
|
||||
tmp = zero;
|
||||
|
||||
parallel_for(int sss=0;sss<tmp._grid->oSites();sss++){
|
||||
int sU=sss;
|
||||
for(int s=0;s<Ls;s++){
|
||||
int sF = s+Ls*sU;
|
||||
tmp[sU] = tmp[sU]+ traceIndex<SpinIndex>(outerProduct(Btilde[sF],Atilde[sF])); // ordering here
|
||||
}
|
||||
int sU=sss;
|
||||
for(int s=0;s<Ls;s++){
|
||||
int sF = s+Ls*sU;
|
||||
tmp[sU] = tmp[sU]+ traceIndex<SpinIndex>(outerProduct(Btilde[sF],Atilde[sF])); // ordering here
|
||||
}
|
||||
}
|
||||
PokeIndex<LorentzIndex>(mat,tmp,mu);
|
||||
|
||||
|
@ -40,7 +40,6 @@ JSONWriter::~JSONWriter(void)
|
||||
delete_comma();
|
||||
ss_ << "}";
|
||||
|
||||
cout << ss_.str() << endl;
|
||||
// write prettified JSON to file
|
||||
std::ofstream os(fileName_);
|
||||
os << std::setw(2) << json::parse(ss_.str()) << std::endl;
|
||||
@ -95,7 +94,7 @@ JSONReader::JSONReader(const string &fileName)
|
||||
|
||||
// test
|
||||
// serialize to standard output
|
||||
std::cout << "JSONReader::JSONReader : " << jobject_ << endl;
|
||||
//std::cout << "JSONReader::JSONReader : " << jobject_ << endl;
|
||||
jcur_ = jobject_;
|
||||
}
|
||||
|
||||
@ -113,7 +112,7 @@ bool JSONReader::push(const string &s)
|
||||
std::cout << "out of range: " << e.what() << '\n';
|
||||
return false;
|
||||
}
|
||||
cout << "JSONReader::push : " << s << " : "<< jcur_ << endl;
|
||||
//cout << "JSONReader::push : " << s << " : "<< jcur_ << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -134,7 +133,7 @@ void JSONReader::pop(void)
|
||||
else
|
||||
do_pop.pop_back();
|
||||
|
||||
cout << "JSONReader::pop : " << jcur_ << endl;
|
||||
//cout << "JSONReader::pop : " << jcur_ << endl;
|
||||
}
|
||||
|
||||
bool JSONReader::nextElement(const std::string &s)
|
||||
@ -157,14 +156,14 @@ bool JSONReader::nextElement(const std::string &s)
|
||||
template <>
|
||||
void JSONReader::readDefault(const string &s, string &output)
|
||||
{
|
||||
cout << "JSONReader::readDefault(string) : " << s<< " " << jcur_ << endl;
|
||||
//cout << "JSONReader::readDefault(string) : " << s<< " " << jcur_ << endl;
|
||||
if (s.size()){
|
||||
std::cout << "String: "<< jcur_[s] << std::endl;
|
||||
//std::cout << "String: "<< jcur_[s] << std::endl;
|
||||
output = jcur_[s];
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "String: "<< jcur_ << std::endl;
|
||||
//std::cout << "String: "<< jcur_ << std::endl;
|
||||
output = jcur_;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./lib/serialisation/JSON_IO.h
|
||||
|
||||
@ -43,10 +43,10 @@ using json = nlohmann::json;
|
||||
|
||||
namespace Grid
|
||||
{
|
||||
|
||||
|
||||
class JSONWriter: public Writer<JSONWriter>
|
||||
{
|
||||
|
||||
|
||||
public:
|
||||
JSONWriter(const std::string &fileName);
|
||||
virtual ~JSONWriter(void);
|
||||
@ -55,6 +55,8 @@ namespace Grid
|
||||
template <typename U>
|
||||
void writeDefault(const std::string &s, const U &x);
|
||||
template <typename U>
|
||||
void writeDefault(const std::string &s, const std::complex<U> &x);
|
||||
template <typename U>
|
||||
void writeDefault(const std::string &s, const std::vector<U> &x);
|
||||
|
||||
template<std::size_t N>
|
||||
@ -65,7 +67,7 @@ namespace Grid
|
||||
std::string fileName_;
|
||||
std::ostringstream ss_;
|
||||
};
|
||||
|
||||
|
||||
class JSONReader: public Reader<JSONReader>
|
||||
{
|
||||
public:
|
||||
@ -77,6 +79,8 @@ namespace Grid
|
||||
template <typename U>
|
||||
void readDefault(const std::string &s, U &output);
|
||||
template <typename U>
|
||||
void readDefault(const std::string &s, std::complex<U> &output);
|
||||
template <typename U>
|
||||
void readDefault(const std::string &s, std::vector<U> &output);
|
||||
private:
|
||||
json jobject_; // main object
|
||||
@ -97,11 +101,12 @@ namespace Grid
|
||||
struct isWriter< JSONWriter > {
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
|
||||
// Writer template implementation ////////////////////////////////////////////
|
||||
template <typename U>
|
||||
void JSONWriter::writeDefault(const std::string &s, const U &x)
|
||||
{
|
||||
//std::cout << "JSONReader::writeDefault(U) : " << s << std::endl;
|
||||
std::ostringstream os;
|
||||
os << std::boolalpha << x;
|
||||
if (s.size())
|
||||
@ -110,9 +115,23 @@ namespace Grid
|
||||
ss_ << os.str() << " ," ;
|
||||
}
|
||||
|
||||
template <typename U>
|
||||
void JSONWriter::writeDefault(const std::string &s, const std::complex<U> &x)
|
||||
{
|
||||
//std::cout << "JSONReader::writeDefault(complex) : " << s << std::endl;
|
||||
std::ostringstream os;
|
||||
os << "["<< std::boolalpha << x.real() << ", " << x.imag() << "]";
|
||||
if (s.size())
|
||||
ss_ << "\""<< s << "\" : " << os.str() << " ," ;
|
||||
else
|
||||
ss_ << os.str() << " ," ;
|
||||
}
|
||||
|
||||
template <typename U>
|
||||
void JSONWriter::writeDefault(const std::string &s, const std::vector<U> &x)
|
||||
{
|
||||
//std::cout << "JSONReader::writeDefault(vec U) : " << s << std::endl;
|
||||
|
||||
if (s.size())
|
||||
ss_ << " \""<<s<<"\" : [";
|
||||
else
|
||||
@ -124,59 +143,77 @@ namespace Grid
|
||||
delete_comma();
|
||||
ss_<< "],";
|
||||
}
|
||||
|
||||
|
||||
template<std::size_t N>
|
||||
void JSONWriter::writeDefault(const std::string &s, const char(&x)[N]){
|
||||
//std::cout << "JSONReader::writeDefault(char U) : " << s << std::endl;
|
||||
|
||||
if (s.size())
|
||||
ss_ << "\""<< s << "\" : \"" << x << "\" ," ;
|
||||
else
|
||||
ss_ << "\"" << x << "\" ," ;
|
||||
ss_ << "\"" << x << "\" ," ;
|
||||
}
|
||||
|
||||
// Reader template implementation ////////////////////////////////////////////
|
||||
template <typename U>
|
||||
void JSONReader::readDefault(const std::string &s, U &output)
|
||||
{
|
||||
std::cout << "JSONReader::readDefault(U) : " << s << " : "<< jcur_ << std::endl;
|
||||
|
||||
//std::cout << "JSONReader::readDefault(U) : " << s << " : "<< jcur_ << std::endl;
|
||||
|
||||
if (s.size()){
|
||||
std::cout << "String: "<< jcur_[s] << std::endl;
|
||||
//std::cout << "String: "<< jcur_[s] << std::endl;
|
||||
output = jcur_[s];
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "String: "<< jcur_ << std::endl;
|
||||
output = jcur_;
|
||||
//std::cout << "String: "<< jcur_ << std::endl;
|
||||
output = jcur_;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
template <typename U>
|
||||
void JSONReader::readDefault(const std::string &s, std::complex<U> &output)
|
||||
{
|
||||
U tmp1, tmp2;
|
||||
//std::cout << "JSONReader::readDefault( complex U) : " << s << " : "<< jcur_ << std::endl;
|
||||
json j = jcur_;
|
||||
json::iterator it = j.begin();
|
||||
jcur_ = *it;
|
||||
read("", tmp1);
|
||||
it++;
|
||||
jcur_ = *it;
|
||||
read("", tmp2);
|
||||
output = std::complex<U>(tmp1,tmp2);
|
||||
}
|
||||
|
||||
|
||||
template <>
|
||||
void JSONReader::readDefault(const std::string &s, std::string &output);
|
||||
|
||||
|
||||
template <typename U>
|
||||
void JSONReader::readDefault(const std::string &s, std::vector<U> &output)
|
||||
{
|
||||
std::string buf;
|
||||
unsigned int i = 0;
|
||||
std::cout << "JSONReader::readDefault(vec) : " << jcur_ << std::endl;
|
||||
//std::cout << "JSONReader::readDefault(vec) : " << jcur_ << std::endl;
|
||||
if (s.size())
|
||||
push(s);
|
||||
|
||||
|
||||
json j = jcur_;
|
||||
for (json::iterator it = j.begin(); it != j.end(); ++it) {
|
||||
jcur_ = *it;
|
||||
std::cout << "Value: " << it.value() << "\n";
|
||||
//std::cout << "Value: " << it.value() << "\n";
|
||||
output.resize(i + 1);
|
||||
read("", output[i++]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
jcur_ = j;
|
||||
if (s.size())
|
||||
pop();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#endif
|
||||
|
56
lib/util/CompilerCompatible.h
Normal file
56
lib/util/CompilerCompatible.h
Normal file
@ -0,0 +1,56 @@
|
||||
#pragma once
|
||||
|
||||
#if defined(__clang__)
|
||||
|
||||
#if __clang_major__ < 3
|
||||
#error "This clang++ version is known to not work with Grid due to compiler bugs"
|
||||
#endif
|
||||
|
||||
#if __clang_major__ == 3
|
||||
#if __clang_minor__ < 5
|
||||
#error "This clang++ version is known to not work with Grid due to compiler bugs"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Intel compiler *ALSO* has __GNUC__ defined so must if/else GCC checks
|
||||
#elif defined(__INTEL_COMPILER)
|
||||
|
||||
#if __INTEL_COMPILER < 1603
|
||||
#error "This icpc version is known to not work with Grid due to compiler bugs"
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
// This macro is annoying many other compilers just define __GNUC__ and claim GCC compat
|
||||
// but this defeats the use of __GNUC__ to really detect G++
|
||||
#if defined(__GNUC__)
|
||||
|
||||
#if __GNUC__ < 4
|
||||
#error "g++ prior to version 4 is known to not work with Grid due to compiler bugs"
|
||||
#endif
|
||||
|
||||
#if __GNUC__ == 4
|
||||
#if __GNUC_MINOR__ != 9
|
||||
#error "g++ 4.9 is the only gcc-4.x version known to work with Grid due to compiler bugs"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if __GNUC__ == 5
|
||||
#warning "g++ version 5 is known to not work with Grid due to compiler bugs under -O3 : ensure you run make check"
|
||||
#endif
|
||||
|
||||
#if __GNUC__ == 6
|
||||
#if __GNUC_MINOR__ < 3
|
||||
#warning "This g++6.3 is the first recent g++ version known to work with Grid: ensure you run make check"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#warning "Unknown compiler detected: cannot guarantee compatability since Grid tends to break compilers"
|
||||
#warning "Ensure to run : make check"
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -48,6 +48,8 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
|
||||
|
||||
#include <Grid/Grid.h>
|
||||
|
||||
#include <Grid/util/CompilerCompatible.h>
|
||||
|
||||
|
||||
#include <fenv.h>
|
||||
#ifdef __APPLE__
|
||||
|
@ -214,6 +214,7 @@ int main(int argc,char **argv)
|
||||
|
||||
// test serializable class writing
|
||||
myclass obj(1234); // non-trivial constructor
|
||||
std::cout << "-- serialisable class writing to 'bother.json'..." << std::endl;
|
||||
write(JW,"obj",obj);
|
||||
JW.write("obj2", obj);
|
||||
|
||||
@ -236,7 +237,9 @@ int main(int argc,char **argv)
|
||||
std::cout << "Loaded (JSON) -----------------" << std::endl;
|
||||
std::cout << jcopy1 << std::endl << jveccopy1 << std::endl;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
// This is still work in progress
|
||||
{
|
||||
// Testing the next element function
|
||||
JSONReader RD("test.json");
|
||||
@ -245,7 +248,7 @@ int main(int argc,char **argv)
|
||||
std::string name;
|
||||
read(RD,"name", name);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
SUBDIRS = . core forces hmc solver debug smearing
|
||||
SUBDIRS = . core forces hmc solver debug smearing IO
|
||||
|
||||
if BUILD_CHROMA_REGRESSION
|
||||
SUBDIRS+= qdpxx
|
||||
|
@ -157,7 +157,7 @@ int main (int argc, char ** argv)
|
||||
std::cout << GridLogMessage << "dS "<<Sprime-S<<std::endl;
|
||||
std::cout << GridLogMessage << "predict dS "<< dSpred <<std::endl;
|
||||
|
||||
assert( fabs(real(Sprime-S-dSpred)) < 1.0e-2 ) ;
|
||||
assert( fabs(real(Sprime-S-dSpred)) < 1.0 ) ;
|
||||
|
||||
std::cout<< GridLogMessage << "Done" <<std::endl;
|
||||
Grid_finalize();
|
||||
|
@ -212,7 +212,7 @@ int main (int argc, char ** argv)
|
||||
|
||||
std::cout << GridLogMessage << "Total dS "<< Hmomprime - Hmom + Sprime - S <<std::endl;
|
||||
|
||||
assert( fabs(real(Sprime-S-dSpred)) < 1.0e-2 ) ;
|
||||
assert( fabs(real(Sprime-S-dSpred)) < 5.0 ) ;
|
||||
|
||||
std::cout<< GridLogMessage << "Done" <<std::endl;
|
||||
Grid_finalize();
|
||||
|
@ -198,7 +198,7 @@ int main (int argc, char ** argv)
|
||||
std::cout << GridLogMessage << " Sprime "<<Sprime<<std::endl;
|
||||
std::cout << GridLogMessage << "dS "<<Sprime-S<<std::endl;
|
||||
std::cout << GridLogMessage << "predict dS "<< dSpred <<std::endl;
|
||||
assert( fabs(real(Sprime-S-dSpred)) < 1.0e-2 ) ;
|
||||
assert( fabs(real(Sprime-S-dSpred)) < 1.0 ) ;
|
||||
std::cout<< GridLogMessage << "Done" <<std::endl;
|
||||
Grid_finalize();
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ int main (int argc, char ** argv)
|
||||
std::cout << GridLogMessage << "dS "<<Sprime-S<<std::endl;
|
||||
std::cout << GridLogMessage << "predict dS "<< dSpred <<std::endl;
|
||||
|
||||
assert( fabs(real(Sprime-S-dSpred)) < 1.0e-2 ) ;
|
||||
assert( fabs(real(Sprime-S-dSpred)) < 2.0 ) ;
|
||||
|
||||
std::cout<< GridLogMessage << "Done" <<std::endl;
|
||||
Grid_finalize();
|
||||
|
@ -168,7 +168,7 @@ int main (int argc, char ** argv)
|
||||
std::cout << GridLogMessage << "dS "<<Sprime-S<<std::endl;
|
||||
std::cout << GridLogMessage << "pred dS "<< dSpred <<std::endl;
|
||||
|
||||
assert( fabs(real(Sprime-S-dSpred)) < 1.0e-2 ) ;
|
||||
assert( fabs(real(Sprime-S-dSpred)) < 1.0 ) ;
|
||||
|
||||
std::cout<< GridLogMessage << "Done" <<std::endl;
|
||||
Grid_finalize();
|
||||
|
@ -148,7 +148,7 @@ int main (int argc, char ** argv)
|
||||
std::cout << GridLogMessage << "dS "<<Sprime-S<<std::endl;
|
||||
std::cout << GridLogMessage << "predict dS "<< dSpred <<std::endl;
|
||||
|
||||
assert( fabs(real(Sprime-S-dSpred)) < 1.0e-2 ) ;
|
||||
assert( fabs(real(Sprime-S-dSpred)) < 1.0 ) ;
|
||||
|
||||
std::cout<< GridLogMessage << "Done" <<std::endl;
|
||||
Grid_finalize();
|
||||
|
@ -196,7 +196,7 @@ int main (int argc, char ** argv)
|
||||
|
||||
std::cout << GridLogMessage << "Total dS "<< Hmomprime - Hmom + Sprime - S <<std::endl;
|
||||
|
||||
assert( fabs(real(Sprime-S-dSpred)) < 1.0e-2 ) ;
|
||||
assert( fabs(real(Sprime-S-dSpred)) < 1.0 ) ;
|
||||
|
||||
std::cout<< GridLogMessage << "Done" <<std::endl;
|
||||
Grid_finalize();
|
||||
|
@ -162,7 +162,7 @@ int main (int argc, char ** argv)
|
||||
std::cout << GridLogMessage << "dS "<<Sprime-S<<std::endl;
|
||||
std::cout << GridLogMessage << "predict dS "<< dSpred <<std::endl;
|
||||
|
||||
assert( fabs(real(Sprime-S-dSpred)) < 1.0e-2 ) ;
|
||||
assert( fabs(real(Sprime-S-dSpred)) < 3.0 ) ;
|
||||
|
||||
std::cout<< GridLogMessage << "Done" <<std::endl;
|
||||
Grid_finalize();
|
||||
|
302
tests/hmc/Test_hmc_EOMobiusRatioManyFlavour.cc
Normal file
302
tests/hmc/Test_hmc_EOMobiusRatioManyFlavour.cc
Normal file
@ -0,0 +1,302 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Grid physics library, www.github.com/paboyle/Grid
|
||||
|
||||
Source file: ./tests/Test_hmc_EODWFRatio.cc
|
||||
|
||||
Copyright (C) 2015-2016
|
||||
|
||||
Author: Peter Boyle <pabobyle@ph.ed.ac.uk>
|
||||
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 */
|
||||
#include <Grid/Grid.h>
|
||||
|
||||
namespace Grid{
|
||||
struct FermionParameters: Serializable {
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(FermionParameters,
|
||||
int, Ls,
|
||||
double, mass,
|
||||
double, M5,
|
||||
double, b,
|
||||
double, c,
|
||||
double, StoppingCondition,
|
||||
int, MaxCGIterations,
|
||||
bool, ApplySmearing);
|
||||
|
||||
//template <class ReaderClass >
|
||||
//FermionParameters(Reader<ReaderClass>& Reader){
|
||||
// read(Reader, "Mobius", *this);
|
||||
//}
|
||||
|
||||
};
|
||||
|
||||
|
||||
struct MobiusHMCParameters: Serializable {
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(MobiusHMCParameters,
|
||||
double, gauge_beta,
|
||||
FermionParameters, Mobius)
|
||||
|
||||
template <class ReaderClass >
|
||||
MobiusHMCParameters(Reader<ReaderClass>& Reader){
|
||||
read(Reader, "Action", *this);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
struct SmearingParameters: Serializable {
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(SmearingParameters,
|
||||
double, rho,
|
||||
Integer, Nsmear)
|
||||
|
||||
template <class ReaderClass >
|
||||
SmearingParameters(Reader<ReaderClass>& Reader){
|
||||
read(Reader, "StoutSmearing", *this);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
using namespace Grid;
|
||||
using namespace Grid::QCD;
|
||||
|
||||
Grid_init(&argc, &argv);
|
||||
int threads = GridThread::GetThreads();
|
||||
// here make a routine to print all the relevant information on the run
|
||||
std::cout << GridLogMessage << "Grid is setup to use " << threads << " threads" << std::endl;
|
||||
|
||||
// Typedefs to simplify notation
|
||||
typedef GenericHMCRunner<MinimumNorm2> HMCWrapper; // Uses the default minimum norm
|
||||
typedef WilsonImplR FermionImplPolicy;
|
||||
typedef MobiusFermionR FermionAction;
|
||||
typedef typename FermionAction::FermionField FermionField;
|
||||
// Serialiser
|
||||
//typedef Grid::XmlReader Serialiser;
|
||||
typedef Grid::JSONReader Serialiser;
|
||||
|
||||
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
HMCWrapper TheHMC;
|
||||
TheHMC.ReadCommandLine(argc, argv); // these can be parameters from file
|
||||
|
||||
// Reader, file should come from command line
|
||||
if (TheHMC.ParameterFile.empty()){
|
||||
std::cout << "Input file not specified."
|
||||
<< "Use --ParameterFile option in the command line.\nAborting"
|
||||
<< std::endl;
|
||||
exit(1);
|
||||
}
|
||||
Serialiser Reader(TheHMC.ParameterFile);
|
||||
|
||||
MobiusHMCParameters MyParams(Reader);
|
||||
// Apply smearing to the fermionic action
|
||||
bool ApplySmearing = MyParams.Mobius.ApplySmearing;
|
||||
|
||||
|
||||
|
||||
// Grid from the command line
|
||||
TheHMC.Resources.AddFourDimGrid("gauge");
|
||||
// Possibile to create the module by hand
|
||||
// hardcoding parameters or using a Reader
|
||||
|
||||
|
||||
// Checkpointer definition (Name: Checkpointer)
|
||||
CheckpointerParameters CPparams(Reader);
|
||||
// Commenting out since we are using the reader
|
||||
/*
|
||||
CPparams.config_prefix = "ckpoint_EODWF_lat";
|
||||
CPparams.rng_prefix = "ckpoint_EODWF_rng";
|
||||
CPparams.saveInterval = 5;
|
||||
CPparams.format = "IEEE64BIG";
|
||||
*/
|
||||
|
||||
TheHMC.Resources.LoadNerscCheckpointer(CPparams);
|
||||
// TheHMC.Resources.LoadBinaryCheckpointer(CPparams);
|
||||
|
||||
// RNG definition (Name: RandomNumberGenerator)
|
||||
RNGModuleParameters RNGpar(Reader);
|
||||
// Commenting out since we are using the reader
|
||||
/*
|
||||
RNGpar.serial_seeds = "1 2 3 4 5";
|
||||
RNGpar.parallel_seeds = "6 7 8 9 10";
|
||||
*/
|
||||
TheHMC.Resources.SetRNGSeeds(RNGpar);
|
||||
|
||||
// Construct observables
|
||||
// here there is too much indirection
|
||||
typedef PlaquetteMod<HMCWrapper::ImplPolicy> PlaqObs;
|
||||
TheHMC.Resources.AddObservable<PlaqObs>();
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// Collect actions, here use more encapsulation
|
||||
// need wrappers of the fermionic classes
|
||||
// that have a complex construction
|
||||
// standard
|
||||
|
||||
//RealD beta = 5.6 ;
|
||||
//WilsonGaugeActionR Waction(MyParams.gauge_beta);
|
||||
SymanzikGaugeActionR Syzaction(MyParams.gauge_beta);
|
||||
|
||||
|
||||
//const int Ls = 8;
|
||||
const int Ls = MyParams.Mobius.Ls;
|
||||
auto GridPtr = TheHMC.Resources.GetCartesian();
|
||||
auto GridRBPtr = TheHMC.Resources.GetRBCartesian();
|
||||
auto FGrid = SpaceTimeGrid::makeFiveDimGrid(Ls,GridPtr);
|
||||
auto FrbGrid = SpaceTimeGrid::makeFiveDimRedBlackGrid(Ls,GridPtr);
|
||||
|
||||
|
||||
// temporarily need a gauge field
|
||||
LatticeGaugeField U(GridPtr);
|
||||
|
||||
Real mass = MyParams.Mobius.mass; //0.04;
|
||||
Real pv = 1.0;
|
||||
RealD M5 = MyParams.Mobius.M5; //1.5;
|
||||
// Note: IroIro and Grid notation for b and c differ
|
||||
RealD b = MyParams.Mobius.b; // 3./2.;
|
||||
RealD c = MyParams.Mobius.c; // 1./2.;
|
||||
|
||||
// These lines are unecessary if BC are all periodic
|
||||
std::vector<Complex> boundary = {1,1,1,-1};
|
||||
FermionAction::ImplParams Params(boundary);
|
||||
|
||||
FermionAction DenOp(U,*FGrid,*FrbGrid,*GridPtr,*GridRBPtr,mass,M5,b,c, Params);
|
||||
FermionAction NumOp(U,*FGrid,*FrbGrid,*GridPtr,*GridRBPtr,pv, M5,b,c, Params);
|
||||
|
||||
//double StoppingCondition = 1e-8;
|
||||
//double MaxCGIterations = 10000;
|
||||
ConjugateGradient<FermionField> CG(MyParams.Mobius.StoppingCondition,MyParams.Mobius.MaxCGIterations);
|
||||
TwoFlavourEvenOddRatioPseudoFermionAction<FermionImplPolicy> Nf2a(NumOp, DenOp,CG,CG);
|
||||
TwoFlavourEvenOddRatioPseudoFermionAction<FermionImplPolicy> Nf2b(NumOp, DenOp,CG,CG);
|
||||
TwoFlavourEvenOddRatioPseudoFermionAction<FermionImplPolicy> Nf2c(NumOp, DenOp,CG,CG);
|
||||
TwoFlavourEvenOddRatioPseudoFermionAction<FermionImplPolicy> Nf2d(NumOp, DenOp,CG,CG);
|
||||
TwoFlavourEvenOddRatioPseudoFermionAction<FermionImplPolicy> Nf2e(NumOp, DenOp,CG,CG);
|
||||
// TwoFlavourEvenOddRatioPseudoFermionAction<FermionImplPolicy> Nf2f(NumOp, DenOp,CG,CG);
|
||||
|
||||
// Set smearing (true/false), default: false
|
||||
Nf2a.is_smeared = ApplySmearing;
|
||||
Nf2b.is_smeared = ApplySmearing;
|
||||
Nf2c.is_smeared = ApplySmearing;
|
||||
Nf2d.is_smeared = ApplySmearing;
|
||||
Nf2e.is_smeared = ApplySmearing;
|
||||
//Nf2f.is_smeared = ApplySmearing;
|
||||
|
||||
// Collect actions
|
||||
ActionLevel<HMCWrapper::Field> Level1(1);
|
||||
Level1.push_back(&Nf2a);
|
||||
Level1.push_back(&Nf2b);
|
||||
Level1.push_back(&Nf2c);
|
||||
Level1.push_back(&Nf2d);
|
||||
Level1.push_back(&Nf2e);
|
||||
//Level1.push_back(&Nf2f);
|
||||
|
||||
ActionLevel<HMCWrapper::Field> Level2(4);
|
||||
Level2.push_back(&Syzaction);
|
||||
|
||||
TheHMC.TheAction.push_back(Level1);
|
||||
TheHMC.TheAction.push_back(Level2);
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// HMC parameters are serialisable
|
||||
TheHMC.Parameters.initialize(Reader);
|
||||
/*
|
||||
TheHMC.Parameters.MD.MDsteps = 20;
|
||||
TheHMC.Parameters.MD.trajL = 1.0;
|
||||
*/
|
||||
|
||||
// Reset performance counters
|
||||
NumOp.ZeroCounters();
|
||||
DenOp.ZeroCounters();
|
||||
|
||||
if (ApplySmearing){
|
||||
SmearingParameters SmPar(Reader);
|
||||
//double rho = 0.1; // smearing parameter
|
||||
//int Nsmear = 3; // number of smearing levels
|
||||
Smear_Stout<HMCWrapper::ImplPolicy> Stout(SmPar.rho);
|
||||
SmearedConfiguration<HMCWrapper::ImplPolicy> SmearingPolicy(GridPtr, SmPar.Nsmear, Stout);
|
||||
TheHMC.Run(SmearingPolicy); // for smearing
|
||||
} else {
|
||||
TheHMC.Run(); // no smearing
|
||||
}
|
||||
|
||||
std::cout << GridLogMessage << "Numerator report, Pauli-Villars term : " << std::endl;
|
||||
NumOp.Report();
|
||||
std::cout << GridLogMessage << "Denominator report, Dw(m) term (includes CG) : " << std::endl;
|
||||
DenOp.Report();
|
||||
|
||||
Grid_finalize();
|
||||
} // main
|
||||
|
||||
|
||||
|
||||
/* Examples for input files
|
||||
|
||||
JSON
|
||||
|
||||
{
|
||||
"Checkpointer": {
|
||||
"config_prefix": "ckpoint_json_lat",
|
||||
"rng_prefix": "ckpoint_json_rng",
|
||||
"saveInterval": 1,
|
||||
"format": "IEEE64BIG"
|
||||
},
|
||||
"RandomNumberGenerator": {
|
||||
"serial_seeds": "1 2 3 4 6",
|
||||
"parallel_seeds": "6 7 8 9 11"
|
||||
},
|
||||
"Action":{
|
||||
"gauge_beta": 5.6,
|
||||
"Mobius": {
|
||||
"Ls" : 10,
|
||||
"mass": 0.01,
|
||||
"M5" : 1.0,
|
||||
"b" : 1.5,
|
||||
"c" : 0.5,
|
||||
"StoppingCondition": 1e-8,
|
||||
"MaxCGIterations": 10000,
|
||||
"ApplySmearing": true
|
||||
}
|
||||
},
|
||||
"HMC":{
|
||||
"StartTrajectory": 0,
|
||||
"Trajectories": 100,
|
||||
"MetropolisTest": true,
|
||||
"NoMetropolisUntil": 10,
|
||||
"StartingType": "HotStart",
|
||||
"MD":{
|
||||
"name": "MinimumNorm2",
|
||||
"MDsteps": 15,
|
||||
"trajL": 2.0
|
||||
}
|
||||
},
|
||||
"StoutSmearing":{
|
||||
"rho": 0.1,
|
||||
"Nsmear": 3
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
XML example not provided yet
|
||||
|
||||
*/
|
Loading…
x
Reference in New Issue
Block a user