Commit 2786bb0a authored by Marcel Koch's avatar Marcel Koch
Browse files

add ginkgo to multigrid app

parent 4ebba28d
......@@ -37,6 +37,8 @@
#include "hyteg/composites/P2P2UnstableStokesOperator.hpp"
#include "hyteg/dataexport/TimingOutput.hpp"
#include "hyteg/dataexport/VTKOutput.hpp"
#include "hyteg/ginkgo/GinkgoBlockSolver.hpp"
#include "hyteg/ginkgo/GinkgoUtilities.hpp"
#include "hyteg/gridtransferoperators/P1P1StokesToP1P1StokesProlongation.hpp"
#include "hyteg/gridtransferoperators/P1P1StokesToP1P1StokesRestriction.hpp"
#include "hyteg/gridtransferoperators/P1toP1LinearProlongation.hpp"
......@@ -62,7 +64,6 @@
#include "hyteg/primitivestorage/PrimitiveStorage.hpp"
#include "hyteg/primitivestorage/SetupPrimitiveStorage.hpp"
#include "hyteg/primitivestorage/Visualization.hpp"
#include "hyteg/solvers/CGSolver.hpp"
#include "hyteg/solvers/FullMultigridSolver.hpp"
#include "hyteg/solvers/GeometricMultigridSolver.hpp"
#include "hyteg/solvers/MinresSolver.hpp"
......@@ -840,6 +841,7 @@ void MultigridStokes( const std::shared_ptr< PrimitiveStorage >& st
const bool& coarseGridSolverVerbose,
const bool& blockLowRank,
const real_t& blockLowRankTolerance,
const std::string& gkoExecutor,
const bool& agglomeration,
const std::string& agglomerationStrategy,
const uint_t& agglomerationNumProcesses,
......@@ -1231,6 +1233,7 @@ void MultigridStokes( const std::shared_ptr< PrimitiveStorage >& st
// 2: MINRES (HyTeG)
// 3: pressure preconditioned MINRES (HyTeG)
// 4: SuperLU_Dist (PETSc)
// 5: block preconditioned GMRES (Ginkgo)
std::shared_ptr< Solver< StokesOperator > > coarseGridSolverInternal;
WALBERLA_LOG_INFO_ON_ROOT( "Coarse grid solver:" )
......@@ -1313,6 +1316,31 @@ void MultigridStokes( const std::shared_ptr< PrimitiveStorage >& st
preconditioner );
dynamic_cast< MinResSolver< StokesOperator >* >( coarseGridSolverInternal.get() )->setPrintInfo( coarseGridSolverVerbose );
}
else if ( coarseGridSolverType == 5 )
{
WALBERLA_LOG_INFO_ON_ROOT( "block preconditioned GMRES (Ginkgo)" )
#ifdef HYTEG_BUILD_WITH_GINKGO
// need to check rank relative to agglomeration
auto exec = get_executor(walberla::MPIManager::instance()->rank() == 0 ? gkoExecutor : "reference");
auto ginkgoSolverInternalTmp =
std::make_shared< GinkgoBlockSolver< StokesOperator > >( coarseGridSolverStorage,
coarseGridMaxLevel,
exec,
coarseResidualTolerance,
coarseGridMaxIterations,
coarseGridSolverVelocityPreconditionerType );
ginkgoSolverInternalTmp->setPrintInfo( coarseGridSolverVerbose );
coarseGridSolverInternal = ginkgoSolverInternalTmp;
#else
WALBERLA_UNUSED( coarseGridSolverVelocityPreconditionerType );
WALBERLA_ABORT( "Ginkgo is not enabled." )
#endif
}
else
{
WALBERLA_ABORT( "Unrecognized coarse grid solver type " << coarseGridSolverType );
}
WALBERLA_LOG_INFO_ON_ROOT( "" )
if ( agglomeration )
......@@ -1746,9 +1774,10 @@ void setup( int argc, char** argv )
const uint_t coarseGridSolverType = mainConf.getParameter< uint_t >( "coarseGridSolverType" );
const uint_t coarseGridSolverVelocityPreconditionerType =
mainConf.getParameter< uint_t >( "coarseGridSolverVelocityPreconditionerType" );
const bool coarseGridSolverVerbose = mainConf.getParameter< bool >( "coarseGridSolverVerbose" );
const bool blockLowRank = mainConf.getParameter< bool >( "blockLowRank" );
const real_t blockLowRankTolerance = mainConf.getParameter< real_t >( "blockLowRankTolerance" );
const bool coarseGridSolverVerbose = mainConf.getParameter< bool >( "coarseGridSolverVerbose" );
const bool blockLowRank = mainConf.getParameter< bool >( "blockLowRank" );
const real_t blockLowRankTolerance = mainConf.getParameter< real_t >( "blockLowRankTolerance" );
const std::string gkoExecutor = mainConf.getParameter< std::string >( "gkoExecutor" );
const bool agglomeration = mainConf.getParameter< bool >( "agglomeration" );
const std::string agglomerationStrategy = mainConf.getParameter< std::string >( "agglomerationStrategy" );
......@@ -2427,6 +2456,7 @@ void setup( int argc, char** argv )
coarseGridSolverVerbose,
blockLowRank,
blockLowRankTolerance,
gkoExecutor,
agglomeration,
agglomerationStrategy,
agglomerationNumProcesses,
......@@ -2487,6 +2517,7 @@ void setup( int argc, char** argv )
coarseGridSolverVerbose,
blockLowRank,
blockLowRankTolerance,
gkoExecutor,
agglomeration,
agglomerationStrategy,
agglomerationNumProcesses,
......
......@@ -95,16 +95,21 @@ Parameters
// 2: MINRES (HyTeG)
// 3: pressure preconditioned MINRES (HyTeG)
// 4: SuperLU (dist) (PETSc)
coarseGridSolverType 1;
// 5: block preconditioned GMRes (Ginkgo)
coarseGridSolverType 5;
coarseGridSolverVerbose true;
// for solver type 1:
// 0: PCGAMG
// 1: PCJACOBI
// for solver type 1 (* also for type 5):
// 0*: GAMG/AMGx
// 1*: Jacobi
// 2: Schur complement
// 3: HYPRE
coarseGridSolverVelocityPreconditionerType 0;
// executor for solver type 5
// choice between: reference, omp, cuda, hip, dpcpp
gkoExecutor cuda;
// BLR options for MUMPS
blockLowRank true;
blockLowRankTolerance 1e-5;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment