Commit 57a9e19e authored by Marcel Koch's avatar Marcel Koch
Browse files

adjust ginkgo block preconditioner test

parent 8f6b22d6
......@@ -42,7 +42,11 @@ using walberla::uint_t;
namespace hyteg {
/// \param blockPreconditionerType
/// 0: velocity AMG, pressure lumped mass
/// 1: velocity Jacobi, pressure lumped mass
void petscSolveTest( std::shared_ptr< const gko::Executor > exec,
const uint_t& blockPreconditionerType,
const uint_t& level,
const MeshInfo& meshInfo,
const real_t& resEps,
......@@ -101,12 +105,29 @@ void petscSolveTest( std::shared_ptr< const gko::Executor > exec,
uint_t globalDoFsvelocity = 3 * hyteg::numberOfGlobalDoFs< P2FunctionTag >( *storage, level );
WALBERLA_LOG_INFO_ON_ROOT( "localDoFs: " << localDoFs1 << " globalDoFs: " << globalDoFs1
<< ", global velocity dofs: " << globalDoFsvelocity );
<< ", global velocity dofs: " << globalDoFsvelocity );
GinkgoBlockSolver< P2P1TaylorHoodStokesOperator > solver( storage, level, exec );
std::unique_ptr< Solver< P2P1TaylorHoodStokesOperator > > solver;
std::string precondType;
if ( blockPreconditionerType == 0 )
{
solver = std::make_unique< GinkgoBlockSolver< P2P1TaylorHoodStokesOperator > >( storage, level, exec, 2, 1 );
precondType = "velocity AMG, pressure lumped mass";
}
else if ( blockPreconditionerType == 1 )
{
solver = std::make_unique< GinkgoBlockSolver< P2P1TaylorHoodStokesOperator > >( storage, level, exec, 1, 1 );
precondType = "velocity Jacobi, pressure lumped mass";
}
else
{
WALBERLA_ABORT( "Invalid preconditioner type." );
}
walberla::WcTimer timer;
solver.solve( A, x, b, level );
WALBERLA_LOG_INFO_ON_ROOT( "Block precond. BiCGStab solver (preconditioner: " << precondType << ") ..." )
solver->solve( A, x, b, level );
timer.end();
hyteg::vertexdof::projectMean( x.p, level );
......@@ -135,7 +156,7 @@ void petscSolveTest( std::shared_ptr< const gko::Executor > exec,
//WALBERLA_CHECK_LESS( discr_l2_err_1_p, errEpsP);
}
}
} // namespace hyteg
using namespace hyteg;
......@@ -144,25 +165,31 @@ int main( int argc, char* argv[] )
walberla::Environment walberlaEnv( argc, argv );
walberla::MPIManager::instance()->useWorldComm();
auto level = argc > 2 ? std::stoi( argv[2] ) : 0;
auto level = argc > 2 ? std::stoi( argv[2] ) : 2;
for ( auto tag : tag_list )
{
if(walberla::MPIManager::instance()->rank() != 0 && (tag == exec_tag::cuda || tag == exec_tag::hip || tag == exec_tag::dpcpp)){
if ( walberla::MPIManager::instance()->rank() != 0 &&
( tag == exec_tag::cuda || tag == exec_tag::hip || tag == exec_tag::dpcpp ) )
{
tag = exec_tag::reference;
}
auto exec = get_executor( tag );
if ( walberla::mpi::allReduce(bool(exec), walberla::mpi::Operation::LOGICAL_AND) )
if ( walberla::mpi::allReduce( bool( exec ), walberla::mpi::Operation::LOGICAL_AND ) )
{
try
{
WALBERLA_LOG_INFO_ON_ROOT( "Running test for " << get_executor_name( exec ) << " executor" );
petscSolveTest( exec,
level,
hyteg::MeshInfo::fromGmshFile( "../../data/meshes/3D/cube_center_at_origin_24el.msh" ),
2.9e-12,
0.021,
0.33 );
for ( const auto pt : { 0u, 1u } )
{
petscSolveTest( exec,
pt,
level,
hyteg::MeshInfo::fromGmshFile( "../../data/meshes/3D/cube_center_at_origin_24el.msh" ),
2.9e-12,
0.021,
0.33 );
}
} catch ( const gko::NotImplemented& e )
{
WALBERLA_LOG_INFO_ON_ROOT( e.what() << " for executor " << get_executor_name( exec ) );
......
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