<div dir="ltr"><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif;color:rgb(68,68,68)">A is formed by three arrays IA[NZ], JA[NZ] and VA[NZ]<br></div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif;color:rgb(68,68,68)">
IA[i] is row index, JA[i] is column index and VA[i] is the value in (IA[i], JA[i]).</div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif;color:rgb(68,68,68)"><br></div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif;color:rgb(68,68,68)">
For intel compiler: </div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif;color:rgb(68,68,68)">when I use --with-debugging=0, the VA[] is not correct. I don't know what kind of optimization it does.</div>
<div class="gmail_default" style="font-family:'trebuchet ms',sans-serif;color:rgb(68,68,68)"><br></div><div class="gmail_default"><div class="gmail_default"><font color="#444444" face="trebuchet ms, sans-serif">A[0][0] = 1.000000e-25</font></div>
<div class="gmail_default"><font color="#444444" face="trebuchet ms, sans-serif">A[0][1] = 0.000000e+00</font></div><div class="gmail_default"><font color="#444444" face="trebuchet ms, sans-serif">A[0][2] = 0.000000e+00</font></div>
<div class="gmail_default"><font color="#444444" face="trebuchet ms, sans-serif">A[1][0] = 0.000000e+00</font></div><div class="gmail_default"><font color="#444444" face="trebuchet ms, sans-serif">A[1][1] = -3.479028e+02</font></div>
<div class="gmail_default"><font color="#444444" face="trebuchet ms, sans-serif">A[1][2] = 0.000000e+00</font></div><div class="gmail_default"><font color="#444444" face="trebuchet ms, sans-serif">A[2][0] = 0.000000e+00</font></div>
<div class="gmail_default"><font color="#444444" face="trebuchet ms, sans-serif">A[2][1] = 0.000000e+00</font></div><div class="gmail_default"><font color="#444444" face="trebuchet ms, sans-serif">A[2][2] = -3.479028e+02</font></div>
<div class="gmail_default"><font color="#444444" face="trebuchet ms, sans-serif">A[3][3] = 1.000000e-25</font></div><div style="color:rgb(68,68,68);font-family:'trebuchet ms',sans-serif">...</div><div style="color:rgb(68,68,68);font-family:'trebuchet ms',sans-serif">
<br></div><div style="color:rgb(68,68,68);font-family:'trebuchet ms',sans-serif">CORRECT:</div><div><div><font color="#444444" face="trebuchet ms, sans-serif">A[0][0] = -2.961372e-07</font></div><div><font color="#444444" face="trebuchet ms, sans-serif">A[0][1] = 1.160201e+02</font></div>
<div><font color="#444444" face="trebuchet ms, sans-serif">A[0][2] = 2.744589e+02</font></div><div><font color="#444444" face="trebuchet ms, sans-serif">A[1][0] = 0.000000e+00</font></div><div><font color="#444444" face="trebuchet ms, sans-serif">A[1][1] = -3.479028e+02</font></div>
<div><font color="#444444" face="trebuchet ms, sans-serif">A[1][2] = 0.000000e+00</font></div><div><font color="#444444" face="trebuchet ms, sans-serif">A[2][0] = -8.332708e-08</font></div><div><font color="#444444" face="trebuchet ms, sans-serif">A[2][1] = 0.000000e+00</font></div>
<div><font color="#444444" face="trebuchet ms, sans-serif">A[2][2] = -3.479028e+02</font></div><div><font color="#444444" face="trebuchet ms, sans-serif">A[3][3] = -3.027917e-07</font></div><div style="color:rgb(68,68,68);font-family:'trebuchet ms',sans-serif">
...</div></div><div style="color:rgb(68,68,68);font-family:'trebuchet ms',sans-serif"><br></div><div style="color:rgb(68,68,68);font-family:'trebuchet ms',sans-serif">For gcc-4.7.2:</div><div style="color:rgb(68,68,68);font-family:'trebuchet ms',sans-serif">
when I use --with-debugging=0, the fortran main function cannot read input data before it starts the LOOP, the ksp_solver() is called inside the loop.<br></div><div style="color:rgb(68,68,68);font-family:'trebuchet ms',sans-serif">
===></div><div><font color="#444444" face="trebuchet ms, sans-serif"> ERRONEOUS DATA INITIALIZATION STOP EXECUTION---------</font><br></div></div><div class="gmail_extra"><br clear="all"><div><div dir="ltr">
Best regards,<div>Longxiang Chen</div><div><br></div><div>Do something everyday that gets you closer to being done.</div><div><br>
</div></div></div>
<br><br><div class="gmail_quote">On Thu, Jun 27, 2013 at 6:42 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><br>
On Jun 27, 2013, at 2:23 PM, Tabrez Ali <<a href="mailto:stali@geology.wisc.edu" target="_blank">stali@geology.wisc.edu</a>> wrote:<br>
<br>
> Fortran can be tricky.<br>
><br>
> Try to run the program in valgrind and/or recheck all your arguments. I once forgot MatAssemblyType in the call to MatAssembly and the code still ran fine on one machine but failed on other. It is better to test with at least 2-3 compilers (GNU, Solaris and Open64 Fortran/C compilers are all free on Linux).<br>
><br>
> T<br>
<br>
</div> You can also run both versions with -snes_monitor -ksp_monitor and see if they both start out the same way.<br>
<span><font color="#888888"><br>
Barry<br>
</font></span><div><div><br>
><br>
><br>
> On 27.06.2013 14:52, Longxiang Chen wrote:<br>
>> Dear all,<br>
>><br>
>> I use ksp_solver to solve Ax=b, where A is from an outer loop of PDE.<br>
>> Under debug mode(default), it solves the problem in about 4000<br>
>> iterations.<br>
>> And the final answer is correct (comparing to another solver).<br>
>><br>
>> I use intel compiler.<br>
>> The program is in Fortran (by mpif90), except the solver is in c (by<br>
>> mpicc).<br>
>><br>
>> However, when I re-configure with --with-debugging=0 (the only<br>
>> change),<br>
>> the program terminates in about 30 iterations with the wrong final<br>
>> solution.<br>
>><br>
>> Thank you.<br>
>><br>
>> Best regards,<br>
>> Longxiang Chen<br>
>><br>
>> Do something everyday that gets you closer to being done.<br>
><br>
<br>
</div></div></blockquote></div><br></div></div>