From c2250fa124e90a2fc255e3ff043ab3935364a8a7 Mon Sep 17 00:00:00 2001 From: Nils Asmussen Date: Fri, 29 Mar 2019 16:36:56 +0000 Subject: [PATCH 1/3] MFermion::GaugeProp fix for 4d fields --- Hadrons/Modules/MFermion/GaugeProp.hpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Hadrons/Modules/MFermion/GaugeProp.hpp b/Hadrons/Modules/MFermion/GaugeProp.hpp index f11113b4..49b4bd5a 100644 --- a/Hadrons/Modules/MFermion/GaugeProp.hpp +++ b/Hadrons/Modules/MFermion/GaugeProp.hpp @@ -111,13 +111,18 @@ void TGaugeProp::setup(void) { Ls_ = env().getObjectLs(par().solver); envCreateLat(PropagatorField, getName()); - envTmpLat(FermionField, "source", Ls_); - envTmpLat(FermionField, "sol", Ls_); envTmpLat(FermionField, "tmp"); if (Ls_ > 1) { + envTmpLat(FermionField, "source", Ls_); + envTmpLat(FermionField, "sol", Ls_); envCreateLat(PropagatorField, getName() + "_5d", Ls_); } + else + { + envTmpLat(FermionField, "source"); + envTmpLat(FermionField, "sol"); + } } // execution /////////////////////////////////////////////////////////////////// From edeb5908180088cf3e17280bfffd4bbbbabca2a6 Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Fri, 3 May 2019 17:09:47 +0100 Subject: [PATCH 2/3] DiskVector: fix of memory bug triggering segfault when the cache is accessed following a certain pattern --- Hadrons/DiskVector.hpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/Hadrons/DiskVector.hpp b/Hadrons/DiskVector.hpp index 7410f1c3..3a8d0696 100644 --- a/Hadrons/DiskVector.hpp +++ b/Hadrons/DiskVector.hpp @@ -395,12 +395,26 @@ void DiskVectorBase::cacheInsert(const unsigned int i, const T &obj) const auto &freeInd = *freePtr_; auto &loads = *loadsPtr_; - evict(); - index[i] = freeInd.top(); - freeInd.pop(); - cache[index.at(i)] = obj; - loads.push_back(i); - modified[index.at(i)] = false; + // cache miss, evict and store + if (index.find(i) == index.end()) + { + evict(); + index[i] = freeInd.top(); + freeInd.pop(); + cache[index.at(i)] = obj; + loads.push_back(i); + modified[index.at(i)] = false; + } + // cache hit, modify current value + else + { + auto pos = std::find(loads.begin(), loads.end(), i); + + cache[index.at(i)] = obj; + modified[index.at(i)] = true; + loads.erase(pos); + loads.push_back(i); + } #ifdef DV_DEBUG std::string msg; From 2acd8ece655af8882195c6581c16712d21cc65fc Mon Sep 17 00:00:00 2001 From: fionnoh Date: Wed, 8 May 2019 10:57:36 +0100 Subject: [PATCH 3/3] Hadron WeakEye and A2ALoop bug fixes, and WWVVContraction bug fix --- Grid/qcd/utils/A2Autils.h | 9 +++++---- Hadrons/Modules/MContraction/A2ALoop.hpp | 2 +- Hadrons/Modules/MContraction/WeakEye3pt.hpp | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Grid/qcd/utils/A2Autils.h b/Grid/qcd/utils/A2Autils.h index 89b4d4bd..97188ffe 100644 --- a/Grid/qcd/utils/A2Autils.h +++ b/Grid/qcd/utils/A2Autils.h @@ -986,17 +986,18 @@ void A2Autils::ContractWWVV(std::vector &WWVV, for(int t=0;t TA2ALoop::getInput(void) template std::vector TA2ALoop::getOutput(void) { - std::vector out = {}; + std::vector out = {getName()}; return out; } diff --git a/Hadrons/Modules/MContraction/WeakEye3pt.hpp b/Hadrons/Modules/MContraction/WeakEye3pt.hpp index 22af2501..ea7ff529 100644 --- a/Hadrons/Modules/MContraction/WeakEye3pt.hpp +++ b/Hadrons/Modules/MContraction/WeakEye3pt.hpp @@ -52,7 +52,7 @@ BEGIN_HADRONS_NAMESPACE * | * one trace | two traces * - * one trace : tr(qbr*gOut*qs*adj(gIn)*g5*adj(qbl)*g5*G*loop*G*qbr*gOut) + * one trace : tr(qbr*gOut*qs*adj(gIn)*g5*adj(qbl)*g5*G*loop*G) * two traces: tr(qbr*gOut*qs*adj(gIn)*g5*adj(qbl)*g5*G)*tr(loop*G) * */ @@ -118,7 +118,7 @@ template std::vector TWeakEye3pt::getInput(void) { std::vector in = {par().qBarLeft, par().qBarRight, - par().qSpectator}; + par().qSpectator, par().loop}; return in; } @@ -170,7 +170,7 @@ void TWeakEye3pt::execute(void) r.info.op = G.g; // one trace - corr = trace(qbr*gOut*qst*adj(gIn)*g5*adj(qbl)*g5*G*loop*G*qbr*gOut); + corr = trace(qbr*gOut*qst*adj(gIn)*g5*adj(qbl)*g5*G*loop*G); sliceSum(corr, buf, Tp); r.corr.clear(); for (unsigned int t = 0; t < buf.size(); ++t)