<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Feb 9, 2016 at 7:06 AM, Florian Lindner <span dir="ltr"><<a href="mailto:mailinglists@xgm.de" target="_blank">mailinglists@xgm.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
I use PETSc with 4 MPI processes and I experience different results<br>
when using different distribution of rows amoung ranks. The code looks<br>
like that:<br></blockquote><div><br></div><div>The default PC is BJacobi/ILU. This depends on the parallel layout because each</div><div>subdomain block is approximately factored. ILU is not very reliable, so it can fail</div><div>as you see below. If you change to LU, you will see the problem</div><div><br></div><div> -sub_pc_type lu</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
KSPSetOperators(_solver, _matrixC.matrix, _matrixC.matrix);<br>
// _solverRtol = 1e-9<br>
KSPSetTolerances(_solver, _solverRtol, PETSC_DEFAULT, PETSC_DEFAULT,<br>
PETSC_DEFAULT);<br>
KSPSetFromOptions(_solver);<br>
<br>
// means: MatGetVecs(matrix, nullptr, &vector);<br>
petsc::Vector Au(_matrixC, "Au");<br>
petsc::Vector out(_matrixC, "out");<br>
petsc::Vector in(_matrixA, "in");<br>
<br>
// is an identity mapping here<br>
ierr = VecSetLocalToGlobalMapping(in.vector, _ISmapping);<br>
<br>
// fill and assemble vector in<br>
<br>
in.view();<br>
MatMultTranspose(_matrixA.matrix, in.vector, Au.vector);<br>
Au.view();<br>
KSPSolve(_solver, Au.vector, out.vector);<br>
<br>
out.view();<br>
<br>
I have experimented with two variants. The first one, non-working has<br>
MatrixC rows distributed like that: 3, 4, 2, 2. The other, working, one<br>
has 4, 3, 2, 2.<br>
<br>
All input values: _matrixA, _matrixC, in are identival, Au is identical<br>
too, but out differs. See the results from object::view below.<br>
<br>
Could the bad condition of matrixC be a problem? I'm not using any<br>
special KSP options. matrixC is of type MATSBAIJ, matrixA is MATAIJ.<br>
<br>
Thanks,<br>
Florian<br>
<br>
WRONG<br>
=================<br>
<br>
Vec Object:in 4 MPI processes<br>
type: mpi<br>
Process [0]<br>
1<br>
2<br>
Process [1]<br>
3<br>
4<br>
Process [2]<br>
5<br>
6<br>
Process [3]<br>
7<br>
8<br>
<br>
Vec Object:Au 4 MPI processes<br>
type: mpi<br>
Process [0]<br>
36<br>
74<br>
20<br>
Process [1]<br>
1.09292<br>
2.09259<br>
3.18584<br>
4.20349<br>
Process [2]<br>
5.29708<br>
6.31472<br>
Process [3]<br>
7.24012<br>
8.23978<br>
<br>
// should not be result<br>
Vec Object:out 4 MPI processes<br>
type: mpi<br>
Process [0]<br>
-1.10633e+07<br>
618058<br>
9.01497e+06<br>
Process [1]<br>
0.996195<br>
1.98711<br>
3.01111<br>
4.00203<br>
Process [2]<br>
5.00736<br>
6.01644<br>
Process [3]<br>
6.98534<br>
7.99442<br>
<br>
Mat Object:C 4 MPI processes<br>
type: mpisbaij<br>
row 0: (0, 0) (3, 1) (4, 1) (5, 1) (6, 1) (7, 1) (8, 1) (9, 1) (10, 1)<br>
row 1: (1, 0) (3, 0) (4, 0) (5, 1) (6, 1) (7, 2) (8, 2) (9, 3) (10, 3)<br>
row 2: (2, 0) (3, 0) (4, 1) (5, 0) (6, 1) (7, 0) (8, 1) (9, 0) (10, 1)<br>
row 3: (3, 1) (4, 0.0183156) (5, 0.0183156) (6, 0.000335463) (7, 1.12535e-07) (8, 2.06115e-09)<br>
row 4: (4, 1) (5, 0.000335463) (6, 0.0183156) (7, 2.06115e-09) (8, 1.12535e-07)<br>
row 5: (5, 1) (6, 0.0183156) (7, 0.0183156) (8, 0.000335463) (9, 1.12535e-07) (10, 2.06115e-09)<br>
row 6: (6, 1) (7, 0.000335463) (8, 0.0183156) (9, 2.06115e-09) (10, 1.12535e-07)<br>
row 7: (7, 1) (8, 0.0183156) (9, 0.0183156) (10, 0.000335463)<br>
row 8: (8, 1) (9, 0.000335463) (10, 0.0183156)<br>
row 9: (9, 1) (10, 0.0183156)<br>
row 10: (10, 1)<br>
<br>
Mat Object:A 4 MPI processes<br>
type: mpiaij<br>
1.00000e+00 0.00000e+00 0.00000e+00 1.00000e+00 1.83156e-02 1.83156e-02 3.35463e-04 1.12535e-07 2.06115e-09 0.00000e+00 0.00000e+00<br>
1.00000e+00 0.00000e+00 1.00000e+00 1.83156e-02 1.00000e+00 3.35463e-04 1.83156e-02 2.06115e-09 1.12535e-07 0.00000e+00 0.00000e+00<br>
1.00000e+00 1.00000e+00 0.00000e+00 1.83156e-02 3.35463e-04 1.00000e+00 1.83156e-02 1.83156e-02 3.35463e-04 1.12535e-07 2.06115e-09<br>
1.00000e+00 1.00000e+00 1.00000e+00 3.35463e-04 1.83156e-02 1.83156e-02 1.00000e+00 3.35463e-04 1.83156e-02 2.06115e-09 1.12535e-07<br>
1.00000e+00 2.00000e+00 0.00000e+00 1.12535e-07 2.06115e-09 1.83156e-02 3.35463e-04 1.00000e+00 1.83156e-02 1.83156e-02 3.35463e-04<br>
1.00000e+00 2.00000e+00 1.00000e+00 2.06115e-09 1.12535e-07 3.35463e-04 1.83156e-02 1.83156e-02 1.00000e+00 3.35463e-04 1.83156e-02<br>
1.00000e+00 3.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 1.12535e-07 2.06115e-09 1.83156e-02 3.35463e-04 1.00000e+00 1.83156e-02<br>
1.00000e+00 3.00000e+00 1.00000e+00 0.00000e+00 0.00000e+00 2.06115e-09 1.12535e-07 3.35463e-04 1.83156e-02 1.83156e-02 1.00000e+00<br>
<br>
<br>
<br>
RIGHT<br>
=================<br>
<br>
Vec Object:in 4 MPI processes<br>
type: mpi<br>
Process [0]<br>
1<br>
2<br>
Process [1]<br>
3<br>
4<br>
Process [2]<br>
5<br>
6<br>
Process [3]<br>
7<br>
8<br>
<br>
Vec Object:Au 4 MPI processes<br>
type: mpi<br>
Process [0]<br>
36<br>
74<br>
20<br>
1.09292<br>
Process [1]<br>
2.09259<br>
3.18584<br>
4.20349<br>
Process [2]<br>
5.29708<br>
6.31472<br>
Process [3]<br>
7.24012<br>
8.23978<br>
<br>
// should be result<br>
Vec Object:out 4 MPI processes<br>
type: mpi<br>
Process [0]<br>
0<br>
0<br>
0<br>
1<br>
Process [1]<br>
2<br>
3<br>
4<br>
Process [2]<br>
5<br>
6<br>
Process [3]<br>
7<br>
8<br>
<br>
<br>
Mat Object:C 4 MPI processes<br>
type: mpisbaij<br>
row 0: (0, 0) (3, 1) (4, 1) (5, 1) (6, 1) (7, 1) (8, 1) (9, 1) (10, 1)<br>
row 1: (1, 0) (3, 0) (4, 0) (5, 1) (6, 1) (7, 2) (8, 2) (9, 3) (10, 3)<br>
row 2: (2, 0) (3, 0) (4, 1) (5, 0) (6, 1) (7, 0) (8, 1) (9, 0) (10, 1)<br>
row 3: (3, 1) (4, 0.0183156) (5, 0.0183156) (6, 0.000335463) (7, 1.12535e-07) (8, 2.06115e-09)<br>
row 4: (4, 1) (5, 0.000335463) (6, 0.0183156) (7, 2.06115e-09) (8, 1.12535e-07)<br>
row 5: (5, 1) (6, 0.0183156) (7, 0.0183156) (8, 0.000335463) (9, 1.12535e-07) (10, 2.06115e-09)<br>
row 6: (6, 1) (7, 0.000335463) (8, 0.0183156) (9, 2.06115e-09) (10, 1.12535e-07)<br>
row 7: (7, 1) (8, 0.0183156) (9, 0.0183156) (10, 0.000335463)<br>
row 8: (8, 1) (9, 0.000335463) (10, 0.0183156)<br>
row 9: (9, 1) (10, 0.0183156)<br>
row 10: (10, 1)<br>
<br>
Mat Object:A 4 MPI processes<br>
type: mpiaij<br>
1.00000e+00 0.00000e+00 0.00000e+00 1.00000e+00 1.83156e-02 1.83156e-02 3.35463e-04 1.12535e-07 2.06115e-09 0.00000e+00 0.00000e+00<br>
1.00000e+00 0.00000e+00 1.00000e+00 1.83156e-02 1.00000e+00 3.35463e-04 1.83156e-02 2.06115e-09 1.12535e-07 0.00000e+00 0.00000e+00<br>
1.00000e+00 1.00000e+00 0.00000e+00 1.83156e-02 3.35463e-04 1.00000e+00 1.83156e-02 1.83156e-02 3.35463e-04 1.12535e-07 2.06115e-09<br>
1.00000e+00 1.00000e+00 1.00000e+00 3.35463e-04 1.83156e-02 1.83156e-02 1.00000e+00 3.35463e-04 1.83156e-02 2.06115e-09 1.12535e-07<br>
1.00000e+00 2.00000e+00 0.00000e+00 1.12535e-07 2.06115e-09 1.83156e-02 3.35463e-04 1.00000e+00 1.83156e-02 1.83156e-02 3.35463e-04<br>
1.00000e+00 2.00000e+00 1.00000e+00 2.06115e-09 1.12535e-07 3.35463e-04 1.83156e-02 1.83156e-02 1.00000e+00 3.35463e-04 1.83156e-02<br>
1.00000e+00 3.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 1.12535e-07 2.06115e-09 1.83156e-02 3.35463e-04 1.00000e+00 1.83156e-02<br>
1.00000e+00 3.00000e+00 1.00000e+00 0.00000e+00 0.00000e+00 2.06115e-09 1.12535e-07 3.35463e-04 1.83156e-02 1.83156e-02 1.00000e+00<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div>
</div></div>