diff --git a/Grid/qcd/action/gauge/PlaqPlusRectangleAction.h b/Grid/qcd/action/gauge/PlaqPlusRectangleAction.h index b7f31d0e..9116e78f 100644 --- a/Grid/qcd/action/gauge/PlaqPlusRectangleAction.h +++ b/Grid/qcd/action/gauge/PlaqPlusRectangleAction.h @@ -76,27 +76,27 @@ public: return action; }; - virtual void deriv(const GaugeField &Umu,GaugeField & dSdU) { + virtual void deriv(const GaugeField &U, GaugeField &dSdU) { //extend Ta to include Lorentz indexes RealD factor_p = c_plaq/RealD(Nc)*0.5; RealD factor_r = c_rect/RealD(Nc)*0.5; - GridBase *grid = Umu.Grid(); + GridBase *grid = U.Grid(); - std::vector U (Nd,grid); + std::vector Umu (Nd,grid); for(int mu=0;mu(Umu,mu); + Umu[mu] = PeekIndex(U,mu); } std::vector RectStaple(Nd,grid), Staple(Nd,grid); - WilsonLoops::StapleAndRectStapleAll(Staple, RectStaple, U, workspace); + WilsonLoops::StapleAndRectStapleAll(Staple, RectStaple, Umu, workspace); GaugeLinkField dSdU_mu(grid); GaugeLinkField staple(grid); for (int mu=0; mu < Nd; mu++){ - dSdU_mu = Ta(U[mu]*Staple[mu])*factor_p; - dSdU_mu = dSdU_mu + Ta(U[mu]*RectStaple[mu])*factor_r; - + dSdU_mu = Ta(Umu[mu]*Staple[mu])*factor_p; + dSdU_mu = dSdU_mu + Ta(Umu[mu]*RectStaple[mu])*factor_r; + PokeIndex(dSdU, dSdU_mu, mu); } diff --git a/Grid/qcd/action/gauge/WilsonGaugeAction.h b/Grid/qcd/action/gauge/WilsonGaugeAction.h index 22c792cc..b3c30416 100644 --- a/Grid/qcd/action/gauge/WilsonGaugeAction.h +++ b/Grid/qcd/action/gauge/WilsonGaugeAction.h @@ -73,20 +73,23 @@ public: // extend Ta to include Lorentz indexes RealD factor = 0.5 * beta / RealD(Nc); + GridBase *grid = U.Grid(); - GaugeLinkField Umu(U.Grid()); - GaugeLinkField dSdU_mu(U.Grid()); + GaugeLinkField dSdU_mu(grid); + std::vector Umu(Nd, grid); for (int mu = 0; mu < Nd; mu++) { + Umu[mu] = PeekIndex(U, mu); + } - Umu = PeekIndex(U, mu); - + for (int mu = 0; mu < Nd; mu++) { // Staple in direction mu - WilsonLoops::Staple(dSdU_mu, U, mu); - dSdU_mu = Ta(Umu * dSdU_mu) * factor; - + WilsonLoops::Staple(dSdU_mu, Umu, mu); + dSdU_mu = Ta(Umu[mu] * dSdU_mu) * factor; + PokeIndex(dSdU, dSdU_mu, mu); } } + private: RealD beta; }; diff --git a/Grid/qcd/smearing/WilsonFlow.h b/Grid/qcd/smearing/WilsonFlow.h index f169d02b..dc135823 100644 --- a/Grid/qcd/smearing/WilsonFlow.h +++ b/Grid/qcd/smearing/WilsonFlow.h @@ -207,11 +207,14 @@ std::vector WilsonFlowBase::flowMeasureEnergyDensityCloverleaf(con } template -void WilsonFlowBase::setDefaultMeasurements(int topq_meas_interval){ - addMeasurement(1, [](int step, RealD t, const typename Gimpl::GaugeField &U){ +void WilsonFlowBase::setDefaultMeasurements(int meas_interval){ + addMeasurement(meas_interval, [](int step, RealD t, const typename Gimpl::GaugeField &U){ std::cout << GridLogMessage << "[WilsonFlow] Energy density (plaq) : " << step << " " << t << " " << energyDensityPlaquette(t,U) << std::endl; }); - addMeasurement(topq_meas_interval, [](int step, RealD t, const typename Gimpl::GaugeField &U){ + addMeasurement(meas_interval, [](int step, RealD t, const typename Gimpl::GaugeField &U){ + std::cout << GridLogMessage << "[WilsonFlow] Energy density (cloverleaf) : " << step << " " << t << " " << energyDensityCloverleaf(t,U) << std::endl; + }); + addMeasurement(meas_interval, [](int step, RealD t, const typename Gimpl::GaugeField &U){ std::cout << GridLogMessage << "[WilsonFlow] Top. charge : " << step << " " << WilsonLoops::TopologicalCharge(U) << std::endl; }); } diff --git a/Grid/qcd/utils/WilsonLoops.h b/Grid/qcd/utils/WilsonLoops.h index 851ba172..6e9318c0 100644 --- a/Grid/qcd/utils/WilsonLoops.h +++ b/Grid/qcd/utils/WilsonLoops.h @@ -292,19 +292,21 @@ public: ////////////////////////////////////////////////// // the sum over all nu-oriented staples for nu != mu on each site ////////////////////////////////////////////////// - static void Staple(GaugeMat &staple, const GaugeLorentz &Umu, int mu) { + static void Staple(GaugeMat &staple, const GaugeLorentz &U, int mu) { - GridBase *grid = Umu.Grid(); - - std::vector U(Nd, grid); + std::vector Umu(Nd, U.grid()); for (int d = 0; d < Nd; d++) { - U[d] = PeekIndex(Umu, d); + Umu[d] = PeekIndex(U, d); } - Staple(staple, U, mu); + Staple(staple, Umu, mu); } - static void Staple(GaugeMat &staple, const std::vector &U, int mu) { - staple = Zero(); + static void Staple(GaugeMat &staple, const std::vector &Umu, int mu) { + + autoView(staple_v, staple, AcceleratorWrite); + accelerator_for(i, staple.Grid()->oSites(), Simd::Nsimd(), { + staple_v[i] = Zero(); + }); for (int nu = 0; nu < Nd; nu++) { @@ -318,12 +320,12 @@ public: // | // __| // - + staple += Gimpl::ShiftStaple( Gimpl::CovShiftForward( - U[nu], nu, + Umu[nu], nu, Gimpl::CovShiftBackward( - U[mu], mu, Gimpl::CovShiftIdentityBackward(U[nu], nu))), + Umu[mu], mu, Gimpl::CovShiftIdentityBackward(Umu[nu], nu))), mu); // __ @@ -333,8 +335,8 @@ public: // staple += Gimpl::ShiftStaple( - Gimpl::CovShiftBackward(U[nu], nu, - Gimpl::CovShiftBackward(U[mu], mu, U[nu])), mu); + Gimpl::CovShiftBackward(Umu[nu], nu, + Gimpl::CovShiftBackward(Umu[mu], mu, Umu[nu])), mu); } } } diff --git a/configure.ac b/configure.ac index e4b553bf..9664a675 100644 --- a/configure.ac +++ b/configure.ac @@ -151,7 +151,7 @@ AC_ARG_ENABLE([tracing], case ${ac_TRACING} in nvtx) AC_DEFINE([GRID_TRACING_NVTX],[1],[use NVTX]) - LIBS="${LIBS} -lnvToolsExt64_1" + LIBS="${LIBS} -lnvToolsExt" ;; roctx) AC_DEFINE([GRID_TRACING_ROCTX],[1],[use ROCTX]) diff --git a/tests/smearing/Test_WilsonFlow.cc b/tests/smearing/Test_WilsonFlow.cc index e0726f87..4acd3b4f 100644 --- a/tests/smearing/Test_WilsonFlow.cc +++ b/tests/smearing/Test_WilsonFlow.cc @@ -33,8 +33,7 @@ namespace Grid{ GRID_SERIALIZABLE_CLASS_MEMBERS(WFParameters, int, steps, double, step_size, - int, meas_interval, - double, maxTau); // for the adaptive algorithm + int, meas_interval); template @@ -86,7 +85,7 @@ int main(int argc, char **argv) { WFParameters WFPar(Reader); ConfParameters CPar(Reader); CheckpointerParameters CPPar(CPar.conf_prefix, CPar.rng_prefix); - BinaryHmcCheckpointer CPBin(CPPar); + NerscHmcCheckpointer CPBin(CPPar); for (int conf = CPar.StartConfiguration; conf <= CPar.EndConfiguration; conf+= CPar.Skip){ @@ -96,19 +95,13 @@ int main(int argc, char **argv) { std::cout << GridLogMessage << "Initial plaquette: " << WilsonLoops::avgPlaquette(Umu) << std::endl; - int t=WFPar.maxTau; - WilsonFlowAdaptive WF(WFPar.step_size, WFPar.maxTau, - 1.0e-4, + WilsonFlow WF(WFPar.step_size, WFPar.steps, WFPar.meas_interval); WF.smear(Uflow, Umu); RealD WFlow_plaq = WilsonLoops::avgPlaquette(Uflow); - RealD WFlow_TC = WilsonLoops::TopologicalCharge(Uflow); - RealD WFlow_T0 = WF.energyDensityPlaquette(t,Uflow); std::cout << GridLogMessage << "Plaquette "<< conf << " " << WFlow_plaq << std::endl; - std::cout << GridLogMessage << "T0 "<< conf << " " << WFlow_T0 << std::endl; - std::cout << GridLogMessage << "TopologicalCharge "<< conf << " " << WFlow_TC << std::endl; std::cout<< GridLogMessage << " Admissibility check:\n"; const double sp_adm = 0.067; // admissible threshold