From 35abd05ee9a68b8288d4bc395280c74318de24f8 Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Mon, 10 Sep 2018 15:16:59 +0100 Subject: [PATCH 01/11] mute Version.h cache creation --- Grid/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Grid/Makefile.am b/Grid/Makefile.am index 8d5b9413..b88ea4f2 100644 --- a/Grid/Makefile.am +++ b/Grid/Makefile.am @@ -24,7 +24,7 @@ endif all: version-cache version-cache: - if [ `git status --porcelain | grep -v '??' | wc -l` -gt 0 ]; then\ + @if [ `git status --porcelain | grep -v '??' | wc -l` -gt 0 ]; then\ a="uncommited changes";\ else\ a="clean";\ From 7b6b7125654bb7b9836b793c58ecf0622a8d9bb8 Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Mon, 10 Sep 2018 15:17:32 +0100 Subject: [PATCH 02/11] function to convert std::vector to string --- Grid/serialisation/VectorUtils.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Grid/serialisation/VectorUtils.h b/Grid/serialisation/VectorUtils.h index 880744ec..b6b95c10 100644 --- a/Grid/serialisation/VectorUtils.h +++ b/Grid/serialisation/VectorUtils.h @@ -423,4 +423,17 @@ namespace Grid { } } +// helper function to read space-separated values +template +std::string vecToStr(const std::vector &v) +{ + using Grid::operator<<; + + std::ostringstream sstr; + + sstr << v; + + return sstr.str(); +} + #endif \ No newline at end of file From 63c21767bafd53bb04397bc73aa53141cdea19ff Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Mon, 10 Sep 2018 15:31:39 +0100 Subject: [PATCH 03/11] Hadrons: grids stored with hash of SIMD type (for mixed-precision setups) --- Hadrons/Environment.cc | 133 ++-------------------- Hadrons/Environment.hpp | 245 ++++++++++++++++++++++++++++++++++++---- Hadrons/Global.cc | 5 + Hadrons/Global.hpp | 18 ++- 4 files changed, 253 insertions(+), 148 deletions(-) diff --git a/Hadrons/Environment.cc b/Hadrons/Environment.cc index 5ad189ad..ab5b4de9 100644 --- a/Hadrons/Environment.cc +++ b/Hadrons/Environment.cc @@ -43,137 +43,24 @@ HADRONS_ERROR_REF(ObjectDefinition, "no object with address " + std::to_string(a // constructor ///////////////////////////////////////////////////////////////// Environment::Environment(void) { - dim_ = GridDefaultLatt(); - nd_ = dim_.size(); - grid4d_.reset(SpaceTimeGrid::makeFourDimGrid( - dim_, GridDefaultSimd(nd_, vComplex::Nsimd()), - GridDefaultMpi())); - gridRb4d_.reset(SpaceTimeGrid::makeFourDimRedBlackGrid(grid4d_.get())); + dim_ = GridDefaultLatt(); + nd_ = dim_.size(); + defaultGrid_ = {typeHash(), 1}; + grid4d_[defaultGrid_].reset( + SpaceTimeGrid::makeFourDimGrid(dim_, + GridDefaultSimd(nd_, vComplex::Nsimd()), + GridDefaultMpi())); + gridRb4d_[defaultGrid_].reset( + SpaceTimeGrid::makeFourDimRedBlackGrid(grid4d_[defaultGrid_].get())); vol_ = 1.; for (auto d: dim_) { vol_ *= d; } - rng4d_.reset(new GridParallelRNG(grid4d_.get())); + rng4d_.reset(new GridParallelRNG(grid4d_[defaultGrid_].get())); } // grids /////////////////////////////////////////////////////////////////////// -void Environment::createGrid(const unsigned int Ls) -{ - if ((Ls > 1) and (grid5d_.find(Ls) == grid5d_.end())) - { - auto g = getGrid(); - - grid5d_[Ls].reset(SpaceTimeGrid::makeFiveDimGrid(Ls, g)); - gridRb5d_[Ls].reset(SpaceTimeGrid::makeFiveDimRedBlackGrid(Ls, g)); - } -} - -void Environment::createCoarseGrid(const std::vector &blockSize, - const unsigned int Ls) -{ - int nd = getNd(); - std::vector fineDim = getDim(), coarseDim; - unsigned int cLs; - auto key4d = blockSize, key5d = blockSize; - - createGrid(Ls); - coarseDim.resize(nd); - for (int d = 0; d < coarseDim.size(); d++) - { - coarseDim[d] = fineDim[d]/blockSize[d]; - if (coarseDim[d]*blockSize[d] != fineDim[d]) - { - HADRONS_ERROR(Size, "Fine dimension " + std::to_string(d) - + " (" + std::to_string(fineDim[d]) - + ") not divisible by coarse dimension (" - + std::to_string(coarseDim[d]) + ")"); - } - } - if (blockSize.size() > nd) - { - cLs = Ls/blockSize[nd]; - if (cLs*blockSize[nd] != Ls) - { - HADRONS_ERROR(Size, "Fine Ls (" + std::to_string(Ls) - + ") not divisible by coarse Ls (" - + std::to_string(cLs) + ")"); - } - key4d.resize(nd); - key5d.push_back(Ls); - } - gridCoarse4d_[key4d].reset( - SpaceTimeGrid::makeFourDimGrid(coarseDim, - GridDefaultSimd(nd, vComplex::Nsimd()), GridDefaultMpi())); - if (Ls > 1) - { - gridCoarse5d_[key5d].reset( - SpaceTimeGrid::makeFiveDimGrid(cLs, gridCoarse4d_[key4d].get())); - } -} - -GridCartesian * Environment::getGrid(const unsigned int Ls) const -{ - try - { - if (Ls == 1) - { - return grid4d_.get(); - } - else - { - return grid5d_.at(Ls).get(); - } - } - catch(std::out_of_range &) - { - HADRONS_ERROR(Definition, "no grid with Ls= " + std::to_string(Ls)); - } -} - -GridRedBlackCartesian * Environment::getRbGrid(const unsigned int Ls) const -{ - try - { - if (Ls == 1) - { - return gridRb4d_.get(); - } - else - { - return gridRb5d_.at(Ls).get(); - } - } - catch(std::out_of_range &) - { - HADRONS_ERROR(Definition, "no red-black grid with Ls= " + std::to_string(Ls)); - } -} - -GridCartesian * Environment::getCoarseGrid( - const std::vector &blockSize, const unsigned int Ls) const -{ - auto key = blockSize; - - try - { - if (Ls == 1) - { - key.resize(getNd()); - return gridCoarse4d_.at(key).get(); - } - else - { - key.push_back(Ls); - return gridCoarse5d_.at(key).get(); - } - } - catch(std::out_of_range &) - { - HADRONS_ERROR(Definition, "no coarse grid with Ls= " + std::to_string(Ls)); - } -} - unsigned int Environment::getNd(void) const { return nd_; diff --git a/Hadrons/Environment.hpp b/Hadrons/Environment.hpp index 8aaac012..24682195 100644 --- a/Hadrons/Environment.hpp +++ b/Hadrons/Environment.hpp @@ -83,15 +83,28 @@ private: int module{-1}; std::unique_ptr data{nullptr}; }; + typedef std::pair FineGridKey; + typedef std::pair> CoarseGridKey; public: // grids + template void createGrid(const unsigned int Ls); + template void createCoarseGrid(const std::vector &blockSize, const unsigned int Ls = 1); - GridCartesian * getGrid(const unsigned int Ls = 1) const; - GridRedBlackCartesian * getRbGrid(const unsigned int Ls = 1) const; + template + GridCartesian * getGrid(void) const; + template + GridRedBlackCartesian * getRbGrid(void) const; + template + GridCartesian * getCoarseGrid(const std::vector &blockSize) const; + template + GridCartesian * getGrid(const unsigned int Ls) const; + template + GridRedBlackCartesian * getRbGrid(const unsigned int Ls) const; + template GridCartesian * getCoarseGrid(const std::vector &blockSize, - const unsigned int Ls = 1) const; + const unsigned int Ls) const; std::vector getDim(void) const; int getDim(const unsigned int mu) const; unsigned int getNd(void) const; @@ -154,22 +167,23 @@ public: void printContent(void) const; private: // general - double vol_; - bool protect_{true}; + double vol_; + bool protect_{true}; // grids - std::vector dim_; - GridPt grid4d_; - std::map grid5d_; - GridRbPt gridRb4d_; - std::map gridRb5d_; - std::map, GridPt> gridCoarse4d_; - std::map, GridPt> gridCoarse5d_; - unsigned int nd_; + std::vector dim_; + FineGridKey defaultGrid_; + std::map grid4d_; + std::map grid5d_; + std::map gridRb4d_; + std::map gridRb5d_; + std::map gridCoarse4d_; + std::map gridCoarse5d_; + unsigned int nd_; // random number generator - RngPt rng4d_; + RngPt rng4d_; // object store - std::vector object_; - std::map objectAddress_; + std::vector object_; + std::map objectAddress_; }; /****************************************************************************** @@ -203,6 +217,191 @@ void Holder::reset(T *pt) /****************************************************************************** * Environment template implementation * ******************************************************************************/ +// grids /////////////////////////////////////////////////////////////////////// +template +void Environment::createGrid(const unsigned int Ls) +{ + size_t hash = typeHash(); + + if (grid4d_.find({hash, 1}) == grid4d_.end()) + { + grid4d_[{hash, 1}].reset( + SpaceTimeGrid::makeFourDimGrid(getDim(), + GridDefaultSimd(getNd(), VType::Nsimd()), + GridDefaultMpi())); + gridRb4d_[{hash, 1}].reset( + SpaceTimeGrid::makeFourDimRedBlackGrid(grid4d_[{hash, 1}].get())); + } + if (grid5d_.find({hash, Ls}) == grid5d_.end()) + { + auto g = grid4d_[{hash, 1}].get(); + + grid5d_[{hash, Ls}].reset(SpaceTimeGrid::makeFiveDimGrid(Ls, g)); + gridRb5d_[{hash, Ls}].reset(SpaceTimeGrid::makeFiveDimRedBlackGrid(Ls, g)); + } +} + +template +void Environment::createCoarseGrid(const std::vector &blockSize, + const unsigned int Ls) +{ + int nd = getNd(); + std::vector fineDim = getDim(), coarseDim(nd); + unsigned int cLs; + auto key4d = blockSize, key5d = blockSize; + size_t hash = typeHash(); + + createGrid(Ls); + for (int d = 0; d < coarseDim.size(); d++) + { + coarseDim[d] = fineDim[d]/blockSize[d]; + if (coarseDim[d]*blockSize[d] != fineDim[d]) + { + HADRONS_ERROR(Size, "Fine dimension " + std::to_string(d) + + " (" + std::to_string(fineDim[d]) + + ") not divisible by coarse dimension (" + + std::to_string(coarseDim[d]) + ")"); + } + } + if (blockSize.size() > nd) + { + cLs = Ls/blockSize[nd]; + if (cLs*blockSize[nd] != Ls) + { + HADRONS_ERROR(Size, "Fine Ls (" + std::to_string(Ls) + + ") not divisible by coarse Ls (" + + std::to_string(cLs) + ")"); + } + } + else + { + cLs = Ls; + } + key4d.resize(nd); + key5d.push_back(Ls); + + CoarseGridKey hkey4d = {hash, key4d}, hkey5d = {hash, key5d}; + + if (gridCoarse4d_.find(hkey4d) == gridCoarse4d_.end()) + { + gridCoarse4d_[hkey4d].reset( + SpaceTimeGrid::makeFourDimGrid(coarseDim, + GridDefaultSimd(nd, VType::Nsimd()), GridDefaultMpi())); + } + if (gridCoarse5d_.find(hkey5d) == gridCoarse5d_.end()) + { + gridCoarse5d_[hkey5d].reset( + SpaceTimeGrid::makeFiveDimGrid(cLs, gridCoarse4d_[hkey4d].get())); + } +} + +template +GridCartesian * Environment::getGrid(void) const +{ + auto it = grid4d_.find({typeHash(), 1}); + + if (it != grid4d_.end()) + { + return it->second.get(); + } + else + { + HADRONS_ERROR(Definition, "no 4D grid for SIMD type '" + + typeName() + "'"); + } +} + +template +GridRedBlackCartesian * Environment::getRbGrid(void) const +{ + auto it = gridRb4d_.find({typeHash(), 1}); + + if (it != gridRb4d_.end()) + { + return it->second.get(); + } + else + { + HADRONS_ERROR(Definition, "no 4D red-black grid for SIMD type '" + + typeName() + "'"); + } +} + +template +GridCartesian * Environment::getCoarseGrid(const std::vector &blockSize) const +{ + std::vector s = blockSize; + + s.resize(getNd()); + auto it = gridCoarse4d_.find({typeHash(), s}); + if (it != gridCoarse4d_.end()) + { + return it->second.get(); + } + else + { + HADRONS_ERROR(Definition, "no 4D coarse grid for SIMD type '" + + typeName() + "' and block size " + + vecToStr(blockSize)); + } +} + +template +GridCartesian * Environment::getGrid(const unsigned int Ls) const +{ + auto it = grid5d_.find({typeHash(), Ls}); + + if (it != grid5d_.end()) + { + return it->second.get(); + } + else + { + HADRONS_ERROR(Definition, "no 5D grid for SIMD type '" + + typeName() + "' and Ls = " + + std::to_string(Ls)); + } +} + +template +GridRedBlackCartesian * Environment::getRbGrid(const unsigned int Ls) const +{ + auto it = gridRb5d_.find({typeHash(), Ls}); + + if (it != gridRb5d_.end()) + { + return it->second.get(); + } + else + { + HADRONS_ERROR(Definition, "no 5D red-black grid for SIMD type '" + + typeName() + "' and Ls = " + + std::to_string(Ls)); + } +} + +template +GridCartesian * Environment::getCoarseGrid(const std::vector &blockSize, + const unsigned int Ls) const +{ + std::vector s = blockSize; + + s.push_back(Ls); + auto it = gridCoarse5d_.find({typeHash(), s}); + if (it != gridCoarse5d_.end()) + { + return it->second.get(); + } + else + { + HADRONS_ERROR(Definition, "no 5D coarse grid for SIMD type '" + + typeName() + "', block size " + + vecToStr(blockSize) + + " and Ls = " + std::to_string(Ls)); + } +} + + // general memory management /////////////////////////////////////////////////// template void Environment::createDerivedObject(const std::string name, @@ -230,19 +429,19 @@ void Environment::createDerivedObject(const std::string name, object_[address].Ls = Ls; object_[address].data.reset(new Holder(new T(std::forward(args)...))); object_[address].size = MemoryProfiler::stats->maxAllocated - initMem; - object_[address].type = &typeid(B); - object_[address].derivedType = &typeid(T); + object_[address].type = typeIdPt(); + object_[address].derivedType = typeIdPt(); if (MemoryProfiler::stats == &memStats) { MemoryProfiler::stats = nullptr; } } // object already exists, no error if it is a cache, error otherwise - else if ((object_[address].storage != Storage::cache) or - (object_[address].storage != storage) or - (object_[address].name != name) or - (object_[address].type != &typeid(B)) or - (object_[address].derivedType != &typeid(T))) + else if ((object_[address].storage != Storage::cache) or + (object_[address].storage != storage) or + (object_[address].name != name) or + (typeHash(object_[address].type) != typeHash()) or + (typeHash(object_[address].derivedType) != typeHash())) { HADRONS_ERROR_REF(ObjectDefinition, "object '" + name + "' already allocated", address); } diff --git a/Hadrons/Global.cc b/Hadrons/Global.cc index 516e466f..a83f422f 100644 --- a/Hadrons/Global.cc +++ b/Hadrons/Global.cc @@ -72,6 +72,11 @@ void Hadrons::initLogger(void) } // type utilities ////////////////////////////////////////////////////////////// +size_t Hadrons::typeHash(const std::type_info *info) +{ + return info->hash_code(); +} + constexpr unsigned int maxNameSize = 1024u; std::string Hadrons::typeName(const std::type_info *info) diff --git a/Hadrons/Global.hpp b/Hadrons/Global.hpp index 04c1f54a..808ed2ba 100644 --- a/Hadrons/Global.hpp +++ b/Hadrons/Global.hpp @@ -155,14 +155,28 @@ const std::type_info * typeIdPt(const T &x) return &typeid(x); } -std::string typeName(const std::type_info *info); - template const std::type_info * typeIdPt(void) { return &typeid(T); } +size_t typeHash(const std::type_info *info); + +template +size_t typeHash(const T &x) +{ + return typeHash(typeIdPt(x)); +} + +template +size_t typeHash(void) +{ + return typeHash(typeIdPt()); +} + +std::string typeName(const std::type_info *info); + template std::string typeName(const T &x) { From 920b4717616f52dac040309d874b00eb47076d19 Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Mon, 10 Sep 2018 15:32:13 +0100 Subject: [PATCH 04/11] Hadrons tests update --- tests/hadrons/Test_QED.cc | 2 +- tests/hadrons/Test_free_prop.cc | 2 +- tests/hadrons/Test_hadrons.hpp | 2 +- tests/hadrons/Test_hadrons_meson_3pt.cc | 2 +- tests/hadrons/Test_hadrons_quark.cc | 156 ----------------------- tests/hadrons/Test_hadrons_spectrum.cc | 2 +- tests/hadrons/Test_hadrons_wilsonFund.cc | 3 +- 7 files changed, 6 insertions(+), 163 deletions(-) delete mode 100644 tests/hadrons/Test_hadrons_quark.cc diff --git a/tests/hadrons/Test_QED.cc b/tests/hadrons/Test_QED.cc index 4f2bd371..fb6f8198 100644 --- a/tests/hadrons/Test_QED.cc +++ b/tests/hadrons/Test_QED.cc @@ -57,7 +57,7 @@ int main(int argc, char *argv[]) globalPar.trajCounter.start = 1500; globalPar.trajCounter.end = 1520; globalPar.trajCounter.step = 20; - globalPar.seed = "1 2 3 4"; + globalPar.runId = "test"; application.setPar(globalPar); // gauge field application.createModule("gauge"); diff --git a/tests/hadrons/Test_free_prop.cc b/tests/hadrons/Test_free_prop.cc index 0081c10f..abf05e33 100644 --- a/tests/hadrons/Test_free_prop.cc +++ b/tests/hadrons/Test_free_prop.cc @@ -59,7 +59,7 @@ int main(int argc, char *argv[]) globalPar.trajCounter.start = 1500; globalPar.trajCounter.end = 1520; globalPar.trajCounter.step = 20; - globalPar.seed = "1 2 3 4"; + globalPar.runId = "test"; application.setPar(globalPar); // gauge field application.createModule("gauge"); diff --git a/tests/hadrons/Test_hadrons.hpp b/tests/hadrons/Test_hadrons.hpp index 65bd9154..1ee72356 100644 --- a/tests/hadrons/Test_hadrons.hpp +++ b/tests/hadrons/Test_hadrons.hpp @@ -51,7 +51,7 @@ using namespace Hadrons; globalPar.trajCounter.start = 1500; \ globalPar.trajCounter.end = 1520; \ globalPar.trajCounter.step = 20; \ - globalPar.seed = "1 2 3 4"; \ + globalPar.runId = "test"; \ globalPar.genetic.maxGen = 1000; \ globalPar.genetic.maxCstGen = 200; \ globalPar.genetic.popSize = 20; \ diff --git a/tests/hadrons/Test_hadrons_meson_3pt.cc b/tests/hadrons/Test_hadrons_meson_3pt.cc index 0c866cd2..5b7cda22 100644 --- a/tests/hadrons/Test_hadrons_meson_3pt.cc +++ b/tests/hadrons/Test_hadrons_meson_3pt.cc @@ -54,7 +54,7 @@ int main(int argc, char *argv[]) globalPar.trajCounter.start = 1500; globalPar.trajCounter.end = 1520; globalPar.trajCounter.step = 20; - globalPar.seed = "1 2 3 4"; + globalPar.runId = "test"; globalPar.genetic.maxGen = 1000; globalPar.genetic.maxCstGen = 200; globalPar.genetic.popSize = 20; diff --git a/tests/hadrons/Test_hadrons_quark.cc b/tests/hadrons/Test_hadrons_quark.cc deleted file mode 100644 index f1a75e15..00000000 --- a/tests/hadrons/Test_hadrons_quark.cc +++ /dev/null @@ -1,156 +0,0 @@ -/************************************************************************************* - -Grid physics library, www.github.com/paboyle/Grid - -Source file: Tests/Hadrons/Test_hadrons_quark.cc - -Copyright (C) 2015-2018 - - Author: Andrew Lawson - -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 "Test_hadrons.hpp" - -using namespace Grid; -using namespace QCD; -using namespace Hadrons; - -/******************************************************************************* - * Unit test functions within Quark module. - ******************************************************************************/ - -// Alternative 4D & 5D projections -template -inline void make_4D_with_gammas(Lattice &in_5d, Lattice &out_4d, int Ls) -{ - GridBase *_grid(out_4d._grid); - Lattice tmp(_grid); - Gamma G5(Gamma::Algebra::Gamma5); - - ExtractSlice(tmp, in_5d, 0, 0); - out_4d = 0.5 * (tmp - G5*tmp); - ExtractSlice(tmp, in_5d, Ls - 1, 0); - out_4d += 0.5 * (tmp + G5*tmp); -} - -template -inline void make_5D_with_gammas(Lattice &in_4d, Lattice &out_5d, int Ls) -{ - out_5d = zero; - Gamma G5(Gamma::Algebra::Gamma5); - GridBase *_grid(in_4d._grid); - Lattice tmp(_grid); - - tmp = 0.5 * (in_4d + G5*in_4d); - InsertSlice(tmp, out_5d, 0, 0); - tmp = 0.5 * (in_4d - G5*in_4d); - InsertSlice(tmp, out_5d, Ls - 1, 0); -} - -int main(int argc, char **argv) -{ - /*************************************************************************** - * Initialisation. - **************************************************************************/ - Grid_init(&argc, &argv); - - std::vector latt_size = GridDefaultLatt(); - std::vector simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd()); - std::vector mpi_layout = GridDefaultMpi(); - - const int Ls = 8; - - GridCartesian UGrid(latt_size,simd_layout,mpi_layout); - GridCartesian *FGrid = SpaceTimeGrid::makeFiveDimGrid(Ls, &UGrid); - GridSerialRNG sRNG; - GridParallelRNG pRNG(&UGrid); - - std::vector seeds4({1,2,3,4}); - std::vector seeds5({5,6,7,8}); - GridParallelRNG rng4(&UGrid); - GridParallelRNG rng5(FGrid); - rng4.SeedFixedIntegers(seeds4); - rng5.SeedFixedIntegers(seeds5); - - /*************************************************************************** - * Build a 4D random source, and convert it to 5D. - **************************************************************************/ - LatticeFermion test4(&UGrid); - LatticeFermion test5(FGrid); - LatticeFermion check5(FGrid); - - gaussian(rng4, test4); - make_5D(test4, test5, Ls); - make_5D_with_gammas(test4, check5, Ls); - test5 -= check5; - std::cout << "4D -> 5D comparison, diff = " << Grid::sqrt(norm2(test5)) << std::endl; - - /*************************************************************************** - * Build a 5D random source, and project down to 4D. - **************************************************************************/ - LatticeFermion check4(&UGrid); - gaussian(rng5, test5); - check5 = test5; - - make_4D(test5, test4, Ls); - make_4D_with_gammas(check5, check4, Ls); - test4 -= check4; - std::cout << "5D -> 4D comparison, diff = " << Grid::sqrt(norm2(test4)) << std::endl; - - /*************************************************************************** - * Convert a propagator to a fermion & back. - **************************************************************************/ - LatticeFermion ferm(&UGrid); - LatticePropagator prop(&UGrid), ref(&UGrid); - gaussian(rng4, prop); - - // Define variables for sanity checking a single site. - typename SpinColourVector::scalar_object fermSite; - typename SpinColourMatrix::scalar_object propSite; - std::vector site(Nd, 0); - - for (int s = 0; s < Ns; ++s) - for (int c = 0; c < Nc; ++c) - { - ref = prop; - PropToFerm(ferm, prop, s, c); - FermToProp(prop, ferm, s, c); - - std::cout << "Spin = " << s << ", Colour = " << c << std::endl; - ref -= prop; - std::cout << "Prop->Ferm->Prop test, diff = " << Grid::sqrt(norm2(ref)) << std::endl; - - peekSite(fermSite, ferm, site); - peekSite(propSite, prop, site); - for (int s2 = 0; s2 < Ns; ++s2) - for (int c2 = 0; c2 < Nc; ++c2) - { - if (propSite()(s2, s)(c2, c) != fermSite()(s2)(c2)) - { - std::cout << propSite()(s2, s)(c2, c) << " != " - << fermSite()(s2)(c2) << " for spin = " << s2 - << ", col = " << c2 << std::endl; - } - } - } - - Grid_finalize(); - return EXIT_SUCCESS; -} diff --git a/tests/hadrons/Test_hadrons_spectrum.cc b/tests/hadrons/Test_hadrons_spectrum.cc index a1c8788e..b57deb38 100644 --- a/tests/hadrons/Test_hadrons_spectrum.cc +++ b/tests/hadrons/Test_hadrons_spectrum.cc @@ -53,7 +53,7 @@ int main(int argc, char *argv[]) globalPar.trajCounter.start = 1500; globalPar.trajCounter.end = 1520; globalPar.trajCounter.step = 20; - globalPar.seed = "1 2 3 4"; + globalPar.runId = "test"; application.setPar(globalPar); // gauge field application.createModule("gauge"); diff --git a/tests/hadrons/Test_hadrons_wilsonFund.cc b/tests/hadrons/Test_hadrons_wilsonFund.cc index c4a47855..df621812 100644 --- a/tests/hadrons/Test_hadrons_wilsonFund.cc +++ b/tests/hadrons/Test_hadrons_wilsonFund.cc @@ -55,8 +55,7 @@ int main(int argc, char *argv[]) globalPar.trajCounter.start = 309; globalPar.trajCounter.end = 310; globalPar.trajCounter.step = 1; - - globalPar.seed = "1 2 3 4"; + globalPar.runId = "test"; application.setPar(globalPar); // gauge field From 6d1d28955e0e574c6c12328b6a7489d42a15dc22 Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Mon, 10 Sep 2018 17:35:54 +0100 Subject: [PATCH 05/11] Guesser class is redundant, switching to LinearFunction --- Grid/algorithms/iterative/Deflation.h | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/Grid/algorithms/iterative/Deflation.h b/Grid/algorithms/iterative/Deflation.h index 7c3e8e57..ceba1c09 100644 --- a/Grid/algorithms/iterative/Deflation.h +++ b/Grid/algorithms/iterative/Deflation.h @@ -31,21 +31,13 @@ Author: Peter Boyle namespace Grid { template -class Guesser { -public: - Guesser(void) = default; - virtual ~Guesser(void) = default; - virtual void operator()(const Field &src, Field &guess) = 0; -}; - -template -class ZeroGuesser: public Guesser { +class ZeroGuesser: public LinearFunction { public: virtual void operator()(const Field &src, Field &guess) { guess = zero; }; }; template -class SourceGuesser: public Guesser { +class SourceGuesser: public LinearFunction { public: virtual void operator()(const Field &src, Field &guess) { guess = src; }; }; @@ -54,7 +46,7 @@ public: // Fine grid deflation //////////////////////////////// template -class DeflatedGuesser: public Guesser { +class DeflatedGuesser: public LinearFunction { private: const std::vector &evec; const std::vector &eval; @@ -76,7 +68,7 @@ public: }; template -class LocalCoherenceDeflatedGuesser: public Guesser { +class LocalCoherenceDeflatedGuesser: public LinearFunction { private: const std::vector &subspace; const std::vector &evec_coarse; From 6d912f6c67ceeff52eff486c62a101d5a7836a1c Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Mon, 10 Sep 2018 17:36:54 +0100 Subject: [PATCH 06/11] Hadrons: general guesser factory --- Hadrons/Environment.hpp | 3 ++ Hadrons/Modules/MSolver/RBPrecCG.hpp | 47 +++++----------------------- 2 files changed, 10 insertions(+), 40 deletions(-) diff --git a/Hadrons/Environment.hpp b/Hadrons/Environment.hpp index 24682195..3cacd28b 100644 --- a/Hadrons/Environment.hpp +++ b/Hadrons/Environment.hpp @@ -63,6 +63,9 @@ inline Environment & env(void) const\ return Environment::getInstance();\ } +#define DEFINE_ENV_LAMBDA \ +auto env = [](void)->Environment &{return Environment::getInstance();} + class Environment { SINGLETON(Environment); diff --git a/Hadrons/Modules/MSolver/RBPrecCG.hpp b/Hadrons/Modules/MSolver/RBPrecCG.hpp index 10f976d0..09779b3a 100644 --- a/Hadrons/Modules/MSolver/RBPrecCG.hpp +++ b/Hadrons/Modules/MSolver/RBPrecCG.hpp @@ -35,6 +35,7 @@ See the full license in the file "LICENSE" in the top level distribution directo #include #include #include +#include BEGIN_HADRONS_NAMESPACE @@ -59,13 +60,6 @@ class TRBPrecCG: public Module public: FG_TYPE_ALIASES(FImpl,); SOLVER_TYPE_ALIASES(FImpl,); - typedef FermionEigenPack EPack; - typedef CoarseFermionEigenPack CoarseEPack; - typedef std::shared_ptr> GuesserPt; - typedef DeflatedGuesser FineGuesser; - typedef LocalCoherenceDeflatedGuesser< - typename FImpl::FermionField, - typename CoarseEPack::CoarseField> CoarseGuesser; public: // constructor TRBPrecCG(const std::string name); @@ -138,45 +132,18 @@ void TRBPrecCG::setup(void) << par().residual << ", maximum iteration " << par().maxIteration << std::endl; - auto Ls = env().getObjectLs(par().action); - auto &mat = envGet(FMat, par().action); - std::string guesserName = getName() + "_guesser"; - GuesserPt guesser{nullptr}; + auto Ls = env().getObjectLs(par().action); + auto &mat = envGet(FMat, par().action); + auto guesserPt = makeGuesser(par().eigenPack); - if (par().eigenPack.empty()) - { - guesser.reset(new ZeroGuesser()); - } - else - { - try - { - auto &epack = envGetDerived(EPack, CoarseEPack, par().eigenPack); - - LOG(Message) << "using low-mode deflation with coarse eigenpack '" - << par().eigenPack << "' (" - << epack.evecCoarse.size() << " modes)" << std::endl; - guesser.reset(new CoarseGuesser(epack.evec, epack.evecCoarse, - epack.evalCoarse)); - } - catch (Exceptions::ObjectType &e) - { - auto &epack = envGet(EPack, par().eigenPack); - - LOG(Message) << "using low-mode deflation with eigenpack '" - << par().eigenPack << "' (" - << epack.evec.size() << " modes)" << std::endl; - guesser.reset(new FineGuesser(epack.evec, epack.eval)); - } - } - auto makeSolver = [&mat, guesser, this](bool subGuess) { - return [&mat, guesser, subGuess, this](FermionField &sol, + auto makeSolver = [&mat, guesserPt, this](bool subGuess) { + return [&mat, guesserPt, subGuess, this](FermionField &sol, const FermionField &source) { ConjugateGradient cg(par().residual, par().maxIteration); HADRONS_DEFAULT_SCHUR_SOLVE schurSolver(cg); schurSolver.subtractGuess(subGuess); - schurSolver(mat, source, sol, *guesser); + schurSolver(mat, source, sol, *guesserPt); }; }; auto solver = makeSolver(false); From 375edd137062eb3cc71c08e156cce7355c8050c0 Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Mon, 10 Sep 2018 17:37:29 +0100 Subject: [PATCH 07/11] file forgotten in last commit --- Hadrons/Modules/MSolver/Guesser.hpp | 58 +++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Hadrons/Modules/MSolver/Guesser.hpp diff --git a/Hadrons/Modules/MSolver/Guesser.hpp b/Hadrons/Modules/MSolver/Guesser.hpp new file mode 100644 index 00000000..ba89c43f --- /dev/null +++ b/Hadrons/Modules/MSolver/Guesser.hpp @@ -0,0 +1,58 @@ +#ifndef Hadrons_MSolver_Guesser_hpp_ +#define Hadrons_MSolver_Guesser_hpp_ + +#include +#include + +BEGIN_HADRONS_NAMESPACE +BEGIN_MODULE_NAMESPACE(MSolver) + +template +std::shared_ptr> +makeGuesser(const std::string epackName) +{ + typedef typename FImpl::FermionField FermionField; + typedef FermionEigenPack EPack; + typedef CoarseFermionEigenPack CoarseEPack; + typedef DeflatedGuesser FineGuesser; + typedef LocalCoherenceDeflatedGuesser< + FermionField, typename CoarseEPack::CoarseField> CoarseGuesser; + + std::shared_ptr> guesserPt; + + DEFINE_ENV_LAMBDA; + + if (epackName.empty()) + { + guesserPt.reset(new ZeroGuesser()); + } + else + { + try + { + auto &epack = envGetDerived(EPack, CoarseEPack, epackName); + + LOG(Message) << "using low-mode deflation with coarse eigenpack '" + << epackName << "' (" + << epack.evecCoarse.size() << " modes)" << std::endl; + guesserPt.reset(new CoarseGuesser(epack.evec, epack.evecCoarse, + epack.evalCoarse)); + } + catch (Exceptions::ObjectType &e) + { + auto &epack = envGet(EPack, epackName); + + LOG(Message) << "using low-mode deflation with eigenpack '" + << epackName << "' (" + << epack.evec.size() << " modes)" << std::endl; + guesserPt.reset(new FineGuesser(epack.evec, epack.eval)); + } + } + + return guesserPt; +} + +END_MODULE_NAMESPACE +END_HADRONS_NAMESPACE + +#endif \ No newline at end of file From 408130b80808f7a7da993a402407ace0103c2cbd Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Mon, 10 Sep 2018 17:38:54 +0100 Subject: [PATCH 08/11] Hadrons: header list fix --- Hadrons/Modules.hpp | 1 + Hadrons/modules.inc | 1 + 2 files changed, 2 insertions(+) diff --git a/Hadrons/Modules.hpp b/Hadrons/Modules.hpp index c76de4ae..61baa799 100644 --- a/Hadrons/Modules.hpp +++ b/Hadrons/Modules.hpp @@ -46,6 +46,7 @@ See the full license in the file "LICENSE" in the top level distribution directo #include #include #include +#include #include #include #include diff --git a/Hadrons/modules.inc b/Hadrons/modules.inc index 2e7066e5..afcbad9b 100644 --- a/Hadrons/modules.inc +++ b/Hadrons/modules.inc @@ -81,6 +81,7 @@ modules_hpp =\ Modules/MSink/Smear.hpp \ Modules/MSink/Point.hpp \ Modules/MSolver/LocalCoherenceLanczos.hpp \ + Modules/MSolver/Guesser.hpp \ Modules/MSolver/RBPrecCG.hpp \ Modules/MSolver/A2AVectors.hpp \ Modules/MGauge/UnitEm.hpp \ From 464c81706eb8642db9c30d975780cf276e0001ca Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Fri, 14 Sep 2018 12:46:43 +0100 Subject: [PATCH 09/11] Hadrons: defaults Impls for different precisions --- Hadrons/Application.cc | 8 ++++---- Hadrons/Global.hpp | 34 ++++++++++++++++++++++++++-------- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/Hadrons/Application.cc b/Hadrons/Application.cc index d3eee21c..44579646 100644 --- a/Hadrons/Application.cc +++ b/Hadrons/Application.cc @@ -62,10 +62,10 @@ Application::Application(void) LOG(Message) << std::endl; LOG(Message) << "** Default parameters (and associated C macros)" << std::endl; LOG(Message) << "ASCII output precision : " << MACOUT(DEFAULT_ASCII_PREC) << std::endl; - LOG(Message) << "Fermion implementation : " << MACOUTS(FIMPL) << std::endl; - LOG(Message) << "z-Fermion implementation: " << MACOUTS(ZFIMPL) << std::endl; - LOG(Message) << "Scalar implementation : " << MACOUTS(SIMPL) << std::endl; - LOG(Message) << "Gauge implementation : " << MACOUTS(GIMPL) << std::endl; + LOG(Message) << "Fermion implementation : " << MACOUTS(FIMPLBASE) << std::endl; + LOG(Message) << "z-Fermion implementation: " << MACOUTS(ZFIMPLBASE) << std::endl; + LOG(Message) << "Scalar implementation : " << MACOUTS(SIMPLBASE) << std::endl; + LOG(Message) << "Gauge implementation : " << MACOUTS(GIMPLBASE) << std::endl; LOG(Message) << "Eigenvector base size : " << MACOUT(HADRONS_DEFAULT_LANCZOS_NBASIS) << std::endl; LOG(Message) << "Schur decomposition : " << MACOUTS(HADRONS_DEFAULT_SCHUR) << std::endl; diff --git a/Hadrons/Global.hpp b/Hadrons/Global.hpp index 808ed2ba..61eb11c2 100644 --- a/Hadrons/Global.hpp +++ b/Hadrons/Global.hpp @@ -62,18 +62,36 @@ using Grid::operator>>; #define END_MODULE_NAMESPACE } -#ifndef FIMPL -#define FIMPL WilsonImplR +#define _HADRONS_IMPL(impl, sub) impl##sub +#define HADRONS_IMPL(impl, sub) _HADRONS_IMPL(impl, sub) + +#ifndef FIMPLBASE +#define FIMPLBASE WilsonImpl #endif -#ifndef ZFIMPL -#define ZFIMPL ZWilsonImplR +#define FIMPL HADRONS_IMPL(FIMPLBASE, R) +#define FIMPLF HADRONS_IMPL(FIMPLBASE, F) +#define FIMPLD HADRONS_IMPL(FIMPLBASE, D) + +#ifndef ZFIMPLBASE +#define ZFIMPLBASE ZWilsonImpl #endif -#ifndef SIMPL -#define SIMPL ScalarImplCR +#define ZFIMPL HADRONS_IMPL(ZFIMPLBASE, R) +#define ZFIMPLF HADRONS_IMPL(ZFIMPLBASE, F) +#define ZFIMPLD HADRONS_IMPL(ZFIMPLBASE, D) + +#ifndef SIMPLBASE +#define SIMPLBASE ScalarImplC #endif -#ifndef GIMPL -#define GIMPL PeriodicGimplR +#define SIMPL HADRONS_IMPL(SIMPLBASE, R) +#define SIMPLF HADRONS_IMPL(SIMPLBASE, F) +#define SIMPLD HADRONS_IMPL(SIMPLBASE, D) + +#ifndef GIMPLBASE +#define GIMPLBASE PeriodicGimpl #endif +#define GIMPL HADRONS_IMPL(GIMPLBASE, R) +#define GIMPLF HADRONS_IMPL(GIMPLBASE, F) +#define GIMPLD HADRONS_IMPL(GIMPLBASE, D) BEGIN_HADRONS_NAMESPACE From f60fbcfc4d4bef2a8bc0e2bfacdc8d0bffeff650 Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Fri, 14 Sep 2018 12:47:55 +0100 Subject: [PATCH 10/11] Hadrons: mixed precision CG, to be tested --- Hadrons/Modules.hpp | 1 + .../Modules/MSolver/MixedPrecisionRBPrecCG.cc | 8 + .../MSolver/MixedPrecisionRBPrecCG.hpp | 170 ++++++++++++++++++ Hadrons/modules.inc | 2 + 4 files changed, 181 insertions(+) create mode 100644 Hadrons/Modules/MSolver/MixedPrecisionRBPrecCG.cc create mode 100644 Hadrons/Modules/MSolver/MixedPrecisionRBPrecCG.hpp diff --git a/Hadrons/Modules.hpp b/Hadrons/Modules.hpp index 61baa799..bb3a9b87 100644 --- a/Hadrons/Modules.hpp +++ b/Hadrons/Modules.hpp @@ -45,6 +45,7 @@ See the full license in the file "LICENSE" in the top level distribution directo #include #include #include +#include #include #include #include diff --git a/Hadrons/Modules/MSolver/MixedPrecisionRBPrecCG.cc b/Hadrons/Modules/MSolver/MixedPrecisionRBPrecCG.cc new file mode 100644 index 00000000..6e9087a1 --- /dev/null +++ b/Hadrons/Modules/MSolver/MixedPrecisionRBPrecCG.cc @@ -0,0 +1,8 @@ +#include + +using namespace Grid; +using namespace Hadrons; +using namespace MSolver; + +template class Grid::Hadrons::MSolver::TMixedPrecisionRBPrecCG; +template class Grid::Hadrons::MSolver::TMixedPrecisionRBPrecCG; diff --git a/Hadrons/Modules/MSolver/MixedPrecisionRBPrecCG.hpp b/Hadrons/Modules/MSolver/MixedPrecisionRBPrecCG.hpp new file mode 100644 index 00000000..3898b8ec --- /dev/null +++ b/Hadrons/Modules/MSolver/MixedPrecisionRBPrecCG.hpp @@ -0,0 +1,170 @@ +#ifndef Hadrons_MSolver_MixedPrecisionRBPrecCG_hpp_ +#define Hadrons_MSolver_MixedPrecisionRBPrecCG_hpp_ + +#include +#include +#include +#include +#include +#include + +BEGIN_HADRONS_NAMESPACE + +/****************************************************************************** + * Mixed precision schur red-black preconditioned CG * + ******************************************************************************/ +BEGIN_MODULE_NAMESPACE(MSolver) + +class MixedPrecisionRBPrecCGPar: Serializable +{ +public: + GRID_SERIALIZABLE_CLASS_MEMBERS(MixedPrecisionRBPrecCGPar, + std::string , innerAction, + std::string , outerAction, + unsigned int, maxInnerIteration, + unsigned int, maxOuterIteration, + double , residual, + std::string , eigenPack); +}; + +template +class TMixedPrecisionRBPrecCG: public Module +{ +public: + FG_TYPE_ALIASES(FImplInner, Inner); + FG_TYPE_ALIASES(FImplOuter, Outer); + SOLVER_TYPE_ALIASES(FImplOuter,); + typedef HADRONS_DEFAULT_SCHUR_OP SchurFMatInner; + typedef HADRONS_DEFAULT_SCHUR_OP SchurFMatOuter; +private: + template + class OperatorFunctionWrapper: public OperatorFunction + { + public: + OperatorFunctionWrapper(LinearFunction &fn): fn_(fn) {}; + virtual ~OperatorFunctionWrapper(void) = default; + virtual void operator()(LinearOperatorBase &op, + const Field &in, Field &out) + { + fn_(in, out); + } + private: + LinearFunction &fn_; + }; +public: + // constructor + TMixedPrecisionRBPrecCG(const std::string name); + // destructor + virtual ~TMixedPrecisionRBPrecCG(void) {}; + // dependency relation + virtual std::vector getInput(void); + virtual std::vector getReference(void); + virtual std::vector getOutput(void); + // setup + virtual void setup(void); + // execution + virtual void execute(void); +}; + +MODULE_REGISTER_TMP(MixedPrecisionRBPrecCG, + ARG(TMixedPrecisionRBPrecCG), MSolver); +MODULE_REGISTER_TMP(ZMixedPrecisionRBPrecCG, + ARG(TMixedPrecisionRBPrecCG), MSolver); + +/****************************************************************************** + * TMixedPrecisionRBPrecCG implementation * + ******************************************************************************/ +// constructor ///////////////////////////////////////////////////////////////// +template +TMixedPrecisionRBPrecCG +::TMixedPrecisionRBPrecCG(const std::string name) +: Module(name) +{} + +// dependencies/products /////////////////////////////////////////////////////// +template +std::vector TMixedPrecisionRBPrecCG +::getInput(void) +{ + std::vector in; + + return in; +} + +template +std::vector TMixedPrecisionRBPrecCG +::getReference(void) +{ + std::vector ref = {par().innerAction, par().outerAction}; + + if (!par().eigenPack.empty()) + { + ref.push_back(par().eigenPack); + } + + return ref; +} + +template +std::vector TMixedPrecisionRBPrecCG +::getOutput(void) +{ + std::vector out = {getName(), getName() + "_subtract"}; + + return out; +} + +// setup /////////////////////////////////////////////////////////////////////// +template +void TMixedPrecisionRBPrecCG +::setup(void) +{ + LOG(Message) << "Setting up Schur red-black preconditioned mixed-precision " + << "CG for inner/outer action '" << par().innerAction + << "'/'" << par().outerAction << "', residual " + << par().residual << ", and maximum inner/outer iteration " + << par().maxInnerIteration << "/" << par().maxOuterIteration + << std::endl; + + auto Ls = env().getObjectLs(par().innerAction); + auto &imat = envGet(FMatInner, par().innerAction); + auto &omat = envGet(FMatOuter, par().outerAction); + auto guesserPt = makeGuesser(par().eigenPack); + + auto makeSolver = [&imat, &omat, guesserPt, Ls, this](bool subGuess) + { + return [&imat, &omat, guesserPt, subGuess, Ls, this] + (FermionFieldOuter &sol, const FermionFieldOuter &source) + { + typedef typename FermionFieldInner::vector_type VTypeInner; + + SchurFMatInner simat(imat); + SchurFMatOuter somat(omat); + MixedPrecisionConjugateGradient + mpcg(par().residual, par().maxInnerIteration, + par().maxOuterIteration, + env().template getGrid(Ls), + simat, somat); + OperatorFunctionWrapper wmpcg(mpcg); + HADRONS_DEFAULT_SCHUR_SOLVE schurSolver(wmpcg); + schurSolver.subtractGuess(subGuess); + schurSolver(omat, source, sol, *guesserPt); + }; + }; + auto solver = makeSolver(false); + envCreate(Solver, getName(), Ls, solver, omat); + auto solver_subtract = makeSolver(true); + envCreate(Solver, getName() + "_subtract", Ls, solver_subtract, omat); +} + +// execution /////////////////////////////////////////////////////////////////// +template +void TMixedPrecisionRBPrecCG +::execute(void) +{} + +END_MODULE_NAMESPACE + +END_HADRONS_NAMESPACE + +#endif // Hadrons_MSolver_MixedPrecisionRBPrecCG_hpp_ diff --git a/Hadrons/modules.inc b/Hadrons/modules.inc index afcbad9b..7a7645f5 100644 --- a/Hadrons/modules.inc +++ b/Hadrons/modules.inc @@ -19,6 +19,7 @@ modules_cc =\ Modules/MSink/Smear.cc \ Modules/MSolver/A2AVectors.cc \ Modules/MSolver/RBPrecCG.cc \ + Modules/MSolver/MixedPrecisionRBPrecCG.cc \ Modules/MSolver/LocalCoherenceLanczos.cc \ Modules/MGauge/StoutSmearing.cc \ Modules/MGauge/Unit.cc \ @@ -80,6 +81,7 @@ modules_hpp =\ Modules/MSource/SeqConserved.hpp \ Modules/MSink/Smear.hpp \ Modules/MSink/Point.hpp \ + Modules/MSolver/MixedPrecisionRBPrecCG.hpp \ Modules/MSolver/LocalCoherenceLanczos.hpp \ Modules/MSolver/Guesser.hpp \ Modules/MSolver/RBPrecCG.hpp \ From 4af6c7e7aa6dc439e8f84c878144480a09ec8b16 Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Fri, 14 Sep 2018 12:51:48 +0100 Subject: [PATCH 11/11] Hadrons: copyright update --- Hadrons/Modules/MSolver/Guesser.hpp | 29 ++++++++++++++++++- .../Modules/MSolver/MixedPrecisionRBPrecCG.cc | 27 +++++++++++++++++ .../MSolver/MixedPrecisionRBPrecCG.hpp | 27 +++++++++++++++++ 3 files changed, 82 insertions(+), 1 deletion(-) diff --git a/Hadrons/Modules/MSolver/Guesser.hpp b/Hadrons/Modules/MSolver/Guesser.hpp index ba89c43f..5b4582d6 100644 --- a/Hadrons/Modules/MSolver/Guesser.hpp +++ b/Hadrons/Modules/MSolver/Guesser.hpp @@ -1,3 +1,30 @@ +/************************************************************************************* + +Grid physics library, www.github.com/paboyle/Grid + +Source file: Hadrons/Modules/MSolver/Guesser.hpp + +Copyright (C) 2015-2018 + +Author: Antonin Portelli + +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 Hadrons_MSolver_Guesser_hpp_ #define Hadrons_MSolver_Guesser_hpp_ @@ -55,4 +82,4 @@ makeGuesser(const std::string epackName) END_MODULE_NAMESPACE END_HADRONS_NAMESPACE -#endif \ No newline at end of file +#endif diff --git a/Hadrons/Modules/MSolver/MixedPrecisionRBPrecCG.cc b/Hadrons/Modules/MSolver/MixedPrecisionRBPrecCG.cc index 6e9087a1..36dc7c94 100644 --- a/Hadrons/Modules/MSolver/MixedPrecisionRBPrecCG.cc +++ b/Hadrons/Modules/MSolver/MixedPrecisionRBPrecCG.cc @@ -1,3 +1,30 @@ +/************************************************************************************* + +Grid physics library, www.github.com/paboyle/Grid + +Source file: Hadrons/Modules/MSolver/MixedPrecisionRBPrecCG.cc + +Copyright (C) 2015-2018 + +Author: Antonin Portelli + +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 Grid; diff --git a/Hadrons/Modules/MSolver/MixedPrecisionRBPrecCG.hpp b/Hadrons/Modules/MSolver/MixedPrecisionRBPrecCG.hpp index 3898b8ec..5ada4e69 100644 --- a/Hadrons/Modules/MSolver/MixedPrecisionRBPrecCG.hpp +++ b/Hadrons/Modules/MSolver/MixedPrecisionRBPrecCG.hpp @@ -1,3 +1,30 @@ +/************************************************************************************* + +Grid physics library, www.github.com/paboyle/Grid + +Source file: Hadrons/Modules/MSolver/MixedPrecisionRBPrecCG.hpp + +Copyright (C) 2015-2018 + +Author: Antonin Portelli + +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 Hadrons_MSolver_MixedPrecisionRBPrecCG_hpp_ #define Hadrons_MSolver_MixedPrecisionRBPrecCG_hpp_