Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
hyteg
hyteg
Commits
57a9e19e
Commit
57a9e19e
authored
Jan 12, 2022
by
Marcel Koch
Browse files
adjust ginkgo block preconditioner test
parent
8f6b22d6
Changes
1
Show whitespace changes
Inline
Side-by-side
tests/hyteg/composites/P2P1Stokes3DGinkgoSolveTest.cpp
View file @
57a9e19e
...
...
@@ -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
,
...
...
@@ -103,10 +107,27 @@ void petscSolveTest( std::shared_ptr< const gko::Executor > exec,
WALBERLA_LOG_INFO_ON_ROOT
(
"localDoFs: "
<<
localDoFs1
<<
" globalDoFs: "
<<
globalDoFs1
<<
", 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"
);
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
)
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment