1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-14 01:35:36 +00:00

Reintroduced explicit inversion of the Clover term in case of the

CompactExpClover because of the open boundary O(a) improvement. Changed
the timing output to GridLogDebug
This commit is contained in:
Fabian Joswig 2022-03-07 17:43:33 +00:00
parent 56c089d347
commit 451e7972fd
3 changed files with 34 additions and 72 deletions

View File

@ -207,13 +207,13 @@ public:
Clover += diag_mass; Clover += diag_mass;
} }
static void Instantiate(CloverDiagonalField& Diagonal, static void Exponentiate_Clover(CloverDiagonalField& Diagonal,
CloverTriangleField& Triangle, CloverTriangleField& Triangle,
CloverDiagonalField& DiagonalInv, CloverDiagonalField& DiagonalInv,
CloverTriangleField& TriangleInv, CloverTriangleField& TriangleInv,
RealD csw_t, RealD diag_mass) { RealD csw_t, RealD diag_mass) {
// Invert the clover term in the improved layout
CompactHelpers::Invert(Diagonal, Triangle, DiagonalInv, TriangleInv); // Do nothing
} }
// TODO: implement Cmunu for better performances with compact layout, but don't do it // TODO: implement Cmunu for better performances with compact layout, but don't do it
@ -313,7 +313,7 @@ public:
} }
static void Instantiate(CloverDiagonalField& Diagonal, CloverTriangleField& Triangle, static void Exponentiate_Clover(CloverDiagonalField& Diagonal, CloverTriangleField& Triangle,
CloverDiagonalField& DiagonalInv, CloverTriangleField& TriangleInv, CloverDiagonalField& DiagonalInv, CloverTriangleField& TriangleInv,
RealD csw_t, RealD diag_mass) { RealD csw_t, RealD diag_mass) {
@ -345,8 +345,6 @@ public:
autoView(triangle_v, Triangle, CpuRead); autoView(triangle_v, Triangle, CpuRead);
autoView(diagonalExp_v, Diagonal, CpuWrite); autoView(diagonalExp_v, Diagonal, CpuWrite);
autoView(triangleExp_v, Triangle, CpuWrite); autoView(triangleExp_v, Triangle, CpuWrite);
autoView(diagonalExpInv_v, DiagonalInv, CpuWrite);
autoView(triangleExpInv_v, TriangleInv, CpuWrite);
thread_for(site, lsites, { // NOTE: Not on GPU because of (peek/poke)LocalSite thread_for(site, lsites, { // NOTE: Not on GPU because of (peek/poke)LocalSite
@ -421,46 +419,10 @@ public:
pokeLocalSite(diagonal_exp_tmp, diagonalExp_v, lcoor); pokeLocalSite(diagonal_exp_tmp, diagonalExp_v, lcoor);
pokeLocalSite(triangle_exp_tmp, triangleExp_v, lcoor); pokeLocalSite(triangle_exp_tmp, triangleExp_v, lcoor);
// inverse exp(-Clover)
ExponentiateHermitean6by6(srcCloverOpUL,-1.0/diag_mass,cn,NMAX,ExpCloverOp);
block = 0;
for(int i = 0; i < 6; i++){
for(int j = 0; j < 6; j++){
if (i == j){
diagonal_exp_tmp()(block)(i) = ExpCloverOp(i,j);
}
else if(i < j){
triangle_exp_tmp()(block)(CompactHelpers::triangle_index(i, j)) = ExpCloverOp(i,j);
}
}
}
ExponentiateHermitean6by6(srcCloverOpLR,-1.0/diag_mass,cn,NMAX,ExpCloverOp);
block = 1;
for(int i = 0; i < 6; i++){
for(int j = 0; j < 6; j++){
if (i == j){
diagonal_exp_tmp()(block)(i) = ExpCloverOp(i,j);
}
else if(i < j){
triangle_exp_tmp()(block)(CompactHelpers::triangle_index(i, j)) = ExpCloverOp(i,j);
}
}
}
pokeLocalSite(diagonal_exp_tmp, diagonalExpInv_v, lcoor);
pokeLocalSite(triangle_exp_tmp, triangleExpInv_v, lcoor);
}); });
Diagonal = Diagonal * diag_mass; Diagonal = Diagonal * diag_mass;
Triangle = Triangle * diag_mass; Triangle = Triangle * diag_mass;
DiagonalInv = DiagonalInv*(1.0/diag_mass);
TriangleInv = TriangleInv*(1.0/diag_mass);
} }

View File

@ -326,16 +326,20 @@ void CompactWilsonCloverFermion<Impl, CloverHelpers>::ImportGauge(const GaugeFie
double t4 = usecond(); double t4 = usecond();
CompactHelpers::ConvertLayout(TmpOriginal, Diagonal, Triangle); CompactHelpers::ConvertLayout(TmpOriginal, Diagonal, Triangle);
// Possible modify the boundary values // Exponentiate the clover (nothing happens in case of the standard clover)
double t5 = usecond(); double t5 = usecond();
CloverHelpers::Exponentiate_Clover(Diagonal, Triangle, DiagonalInv, TriangleInv, csw_t, this->diag_mass);
// Possible modify the boundary values
double t6 = usecond();
if(open_boundaries) CompactHelpers::ModifyBoundaries(Diagonal, Triangle, csw_t, cF, this->diag_mass); if(open_boundaries) CompactHelpers::ModifyBoundaries(Diagonal, Triangle, csw_t, cF, this->diag_mass);
// Instantiate based on clover policy // Invert the Clover term (explicit inversion needed for the improvement in case of open boundary conditions)
double t6 = usecond(); double t7 = usecond();
CloverHelpers::Instantiate(Diagonal, Triangle, DiagonalInv, TriangleInv, csw_t, this->diag_mass); CompactHelpers::Invert(Diagonal, Triangle, DiagonalInv, TriangleInv);
// Fill the remaining clover fields // Fill the remaining clover fields
double t7 = usecond(); double t8 = usecond();
pickCheckerboard(Even, DiagonalEven, Diagonal); pickCheckerboard(Even, DiagonalEven, Diagonal);
pickCheckerboard(Even, TriangleEven, Triangle); pickCheckerboard(Even, TriangleEven, Triangle);
pickCheckerboard(Odd, DiagonalOdd, Diagonal); pickCheckerboard(Odd, DiagonalOdd, Diagonal);
@ -346,20 +350,19 @@ void CompactWilsonCloverFermion<Impl, CloverHelpers>::ImportGauge(const GaugeFie
pickCheckerboard(Odd, TriangleInvOdd, TriangleInv); pickCheckerboard(Odd, TriangleInvOdd, TriangleInv);
// Report timings // Report timings
double t8 = usecond(); double t9 = usecond();
#if 0
std::cout << GridLogMessage << "CompactWilsonCloverFermion::ImportGauge timings:" std::cout << GridLogDebug << "CompactWilsonCloverFermion::ImportGauge timings:" << std::endl;
<< " WilsonFermion::Importgauge = " << (t1 - t0) / 1e6 std::cout << GridLogDebug << "WilsonFermion::Importgauge = " << (t1 - t0) / 1e6 << std::endl;
<< ", allocations = " << (t2 - t1) / 1e6 std::cout << GridLogDebug << "allocations = " << (t2 - t1) / 1e6 << std::endl;
<< ", field strength = " << (t3 - t2) / 1e6 std::cout << GridLogDebug << "field strength = " << (t3 - t2) / 1e6 << std::endl;
<< ", fill clover = " << (t4 - t3) / 1e6 std::cout << GridLogDebug << "fill clover = " << (t4 - t3) / 1e6 << std::endl;
<< ", convert = " << (t5 - t4) / 1e6 std::cout << GridLogDebug << "convert = " << (t5 - t4) / 1e6 << std::endl;
<< ", boundaries = " << (t6 - t5) / 1e6 std::cout << GridLogDebug << "exponentiation = " << (t6 - t5) / 1e6 << std::endl;
<< ", instantiate = " << (t7 - t6) / 1e6 std::cout << GridLogDebug << "boundaries = " << (t7 - t6) / 1e6 << std::endl;
<< ", pick cbs = " << (t8 - t7) / 1e6 std::cout << GridLogDebug << "inversions = " << (t8 - t7) / 1e6 << std::endl;
<< ", total = " << (t8 - t0) / 1e6 std::cout << GridLogDebug << "pick cbs = " << (t9 - t8) / 1e6 << std::endl;
<< std::endl; std::cout << GridLogDebug << "total = " << (t9 - t0) / 1e6 << std::endl;
#endif
} }
NAMESPACE_END(Grid); NAMESPACE_END(Grid);

View File

@ -150,17 +150,14 @@ void WilsonCloverFermion<Impl, CloverHelpers>::ImportGauge(const GaugeField &_Um
pickCheckerboard(Odd, CloverTermInvDagOdd, adj(CloverTermInv)); pickCheckerboard(Odd, CloverTermInvDagOdd, adj(CloverTermInv));
double t6 = usecond(); double t6 = usecond();
#if 0 std::cout << GridLogDebug << "WilsonCloverFermion::ImportGauge timings:" << std::endl;
std::cout << GridLogMessage << "WilsonCloverFermion::ImportGauge timings:" std::cout << GridLogDebug << "WilsonFermion::Importgauge = " << (t1 - t0) / 1e6 << std::endl;
<< " WilsonFermion::Importgauge = " << (t1 - t0) / 1e6 std::cout << GridLogDebug << "allocations = " << (t2 - t1) / 1e6 << std::endl;
<< ", allocations = " << (t2 - t1) / 1e6 std::cout << GridLogDebug << "field strength = " << (t3 - t2) / 1e6 << std::endl;
<< ", field strength = " << (t3 - t2) / 1e6 std::cout << GridLogDebug << "fill clover = " << (t4 - t3) / 1e6 << std::endl;
<< ", fill clover = " << (t4 - t3) / 1e6 std::cout << GridLogDebug << "instantiation = " << (t5 - t4) / 1e6 << std::endl;
<< ", instantiation = " << (t5 - t4) / 1e6 std::cout << GridLogDebug << "pick cbs = " << (t6 - t5) / 1e6 << std::endl;
<< ", pick cbs = " << (t6 - t5) / 1e6 std::cout << GridLogDebug << "total = " << (t6 - t0) / 1e6 << std::endl;
<< ", total = " << (t6 - t0) / 1e6
<< std::endl;
#endif
} }
template<class Impl, class CloverHelpers> template<class Impl, class CloverHelpers>