Compare commits

...

3 Commits

Author SHA1 Message Date
9dd4c8d0bb Test solvers for development 2023-05-12 13:48:26 +01:00
81c887b27f RBC/UKQCD M0 strange 2023-05-12 13:47:59 +01:00
540711e1ce clang-format settings 2023-05-12 13:47:47 +01:00
3 changed files with 118 additions and 0 deletions

9
.clang-format Normal file
View File

@ -0,0 +1,9 @@
BasedOnStyle: LLVM
AlwaysBreakTemplateDeclarations: "Yes"
AlignEscapedNewlines: Left
BreakBeforeBraces: Allman
FixNamespaceComments: "true"
UseTab: Never
IndentWidth: 2
TabWidth: 2
ColumnLimit: 100

View File

@ -48,6 +48,10 @@ struct RbcUkqcd
const std::string gaugeTransform,
const std::string eigenpackPath,
const double residual = 1.0e-8);
static inline void addM0StrangeSolver(Application &app, const std::string solverName,
const std::string gaugeName,
const std::string gaugeTransform,
const double residual = 1.0e-8);
};
// Implementations /////////////////////////////////////////////////////////////////////////////////
@ -113,4 +117,43 @@ void RbcUkqcd::addM0LightLCDSolver(Application &app, const std::string solverNam
app.createModule<MSolver::MixedPrecisionRBPrecCGBatched>(solverName, solverPar);
}
void RbcUkqcd::addM0StrangeSolver(Application &app, const std::string solverName,
const std::string gaugeName, const std::string gaugeTransform,
const double residual)
{
const std::string prefix = solverName;
// Gauge field FP32 cast
MUtilities::GaugeSinglePrecisionCast::Par gaugeCastPar;
gaugeCastPar.field = gaugeName;
app.createModule<MUtilities::GaugeSinglePrecisionCast>(prefix + "_gauge_fp32", gaugeCastPar);
// Scaled DWF action + FP32 version
MAction::ScaledDWF::Par actionPar;
actionPar.gauge = gaugeName;
actionPar.Ls = RbcUkqcd::m0LCDPar.Ls;
actionPar.M5 = RbcUkqcd::m0LCDPar.M5;
actionPar.mass = RbcUkqcd::m0LCDPar.ms;
actionPar.scale = RbcUkqcd::m0LCDPar.scale;
actionPar.boundary = "1 1 1 1";
actionPar.twist = "0. 0. 0. 0.";
app.createModule<MAction::ScaledDWF>(prefix + "_dwf", actionPar);
actionPar.gauge = prefix + "_gauge_fp32";
app.createModule<MAction::ScaledDWFF>(prefix + "_dwf_fp32", actionPar);
// Batched mixed-precision red-black preconditionned CG
MSolver::MixedPrecisionRBPrecCG::Par solverPar;
solverPar.innerAction = prefix + "_dwf_fp32";
solverPar.outerAction = prefix + "_dwf";
solverPar.maxInnerIteration = 30000;
solverPar.maxOuterIteration = 100;
solverPar.residual = residual;
solverPar.innerGuesser = "";
solverPar.outerGuesser = "";
app.createModule<MSolver::MixedPrecisionRBPrecCG>(solverName, solverPar);
}
} // namespace hadpresets

66
Test.hpp Normal file
View File

@ -0,0 +1,66 @@
/*
* Copyright (C) 2023
*
* Author: Antonin Portelli <antonin.portelli@me.com>
* Elements based on production templates from Raoul Hodgson
*
* Hadrons 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.
*
* Hadrons 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 Hadrons. If not, see <http://www.gnu.org/licenses/>.
*
* See the full license in the file "LICENSE" in the top level distribution
* directory.
*/
#pragma once
#include <Hadrons/Application.hpp>
#include <Hadrons/Modules.hpp>
namespace hadpresets
{
using namespace Grid::Hadrons;
struct Test
{
static inline void addTestDwfSolver(Application &app, const std::string solverName,
const std::string gaugeName, const double mass = 0.1,
const double residual = 1.0e-8);
};
void Test::addTestDwfSolver(Application &app, const std::string solverName,
const std::string gaugeName, const double mass, const double residual)
{
const std::string prefix = solverName;
// DWF action
MAction::DWF::Par actionPar;
actionPar.gauge = gaugeName;
actionPar.Ls = 8;
actionPar.M5 = 1.8;
actionPar.mass = mass;
actionPar.boundary = "1 1 1 -1";
actionPar.twist = "0. 0. 0. 0.";
app.createModule<MAction::DWF>(prefix + "_dwf", actionPar);
// solver
MSolver::RBPrecCG::Par solverPar;
solverPar.action = prefix + "_dwf";
solverPar.guesser = "";
solverPar.maxIteration = 10000;
solverPar.residual = residual;
app.createModule<MSolver::RBPrecCG>(solverName, solverPar);
}
} // namespace hadpresets