<div dir="ltr">Thank you. That's cool. Sorry, I'm not good at gdb.<div><br></div><div>I did that. They are the same. One gave</div><div><div>(gdb) p *alpha</div><div>$1 = 0.013169008988739605</div></div><div><br></div><div>and another gave</div><div><div>(gdb) p *alpha</div><div>$1 = 0.013169008988739673</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-03-11 17:35 GMT-04:00 Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Wed, Mar 11, 2015 at 3:39 PM, Song Gao <span dir="ltr"><<a href="mailto:song.gao2@mail.mcgill.ca" target="_blank">song.gao2@mail.mcgill.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks.<br><br>I run with two processes. When the code stop, I'm in      raise()     and alpha is not in the current context.<br></div></blockquote><div><br></div></span><div>Here you would use:</div><div><br></div><div>  (gdb) up 4</div><div><br></div><div>  (gdb) p *alpha</div><div><br></div><div>   Matt</div><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">(gdb)p alpha<div><div>No symbol "alpha" in current context.</div>(gdb)  bt<br>#0  0x0000003764432625 in raise () from /lib64/libc.so.6<br>#1  0x0000003764433e05 in abort () from /lib64/libc.so.6<br>#2  0x00000000015d02f5 in PetscAbortErrorHandler (comm=0x36e17a0, line=1186, <br>    fun=0x279cad4 "VecMAXPY", file=0x279c404 "rvector.c", <br>    dir=0x279c1c8 "src/vec/vec/interface/", n=62, p=PETSC_ERROR_INITIAL, <br>    mess=0x7fff33ffa4c0 "Scalar value must be same on all processes, argument # 3", ctx=0x0) at errabort.c:62<br>#3  0x000000000130cf44 in PetscError (comm=0x36e17a0, line=1186, <br>    func=0x279cad4 "VecMAXPY", file=0x279c404 "rvector.c", <br>    dir=0x279c1c8 "src/vec/vec/interface/", n=62, p=PETSC_ERROR_INITIAL, <br>    mess=0x279c720 "Scalar value must be same on all processes, argument # %d")<br>    at err.c:356<br>#4  0x00000000013f8184 in VecMAXPY (y=0x3b35000, nv=20, alpha=0x3b31840, <br>    x=0x3b33080) at rvector.c:1186<br>#5  0x0000000001581062 in KSPGMRESBuildSoln (nrs=0x3b31840, vs=0x3ab2090, <br>    vdest=0x3ab2090, ksp=0x39a9700, it=19) at gmres.c:345<br><br><br>But I break at VecMAXPY. then print out alpha on both processes. For the first few times that the breakpoint is hit , I checked the values on both processes and they are the same. <div><span style="font-size:12.6666669845581px"><br></span></div></div><div><span style="font-size:12.6666669845581px"><br></span></div><div><div><span style="font-size:12.6666669845581px">(gdb) b VecMAXPY</span></div><div><span style="font-size:12.6666669845581px">Breakpoint 1 at 0x13f73e0: file rvector.c, line 1174.</span></div><div><span style="font-size:12.6666669845581px">(gdb) c</span></div><div><span style="font-size:12.6666669845581px">Continuing.</span></div><div><span style="font-size:12.6666669845581px">Breakpoint 1, VecMAXPY (y=0x3f2b790, nv=1, alpha=0x3f374e0, x=0x3f1fde0)</span></div><div><span style="font-size:12.6666669845581px">    at rvector.c:1174</span></div><div><span style="font-size:12.6666669845581px">1174      PetscFunctionBegin;</span><br></div><div><span style="font-size:12.6666669845581px">(gdb) p alpha</span></div><div><span style="font-size:12.6666669845581px">$1 = (const PetscScalar *) 0x3f374e0</span></div><div><span style="font-size:12.6666669845581px">(gdb) p *alpha</span></div><div><span style="font-size:12.6666669845581px">$2 = -0.54285016977140765</span></div><div><span style="font-size:12.6666669845581px">(gdb) </span></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-03-11 15:52 GMT-04:00 Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Wed, Mar 11, 2015 at 2:33 PM, Song Gao <span dir="ltr"><<a href="mailto:song.gao2@mail.mcgill.ca" target="_blank">song.gao2@mail.mcgill.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello,<div><br></div><div>I'm solving Navier-Stokes equations by finite element method.  I use KSP as the linear system solver. I run with 2 cpu. The code runs fine in non-debug version. But when I switch to the debug version, the code gives the following error.</div><div><br></div><div>I output the matrix and rhs before calling KSPSolve to make sure no NAN or INF in them. The condition number of matrix is ~2e4.  Seems okay.</div><div><br></div><div>I also run the code with valgrind, but didn't find any other errors. The valgrind output is attached. <span style="font-size:12.6666669845581px">Any ideas of what I can do next? </span></div></div></blockquote><div><br></div></span><div>Is there any chance you could spawn the debugger, -start_in_debugger, and when you get the error,</div><div>print out the value of 'alpha' on each process?</div><div><br></div><div>Otherwise the best thing to do is output your Mat and RHS in binary and send them so we can try to reproduce.</div><div><br></div><div>    Matt</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><span><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><span style="font-size:12.6666669845581px">Thanks in advance.</span></div><div><br></div><div><br></div><div><div>[0]PETSC ERROR: --------------------- Error Message ------------------------------------</div><div>[0]PETSC ERROR: Invalid argument!</div><div>[0]PETSC ERROR: Scalar value must be same on all processes, argument # 3!</div><div>[0]PETSC ERROR: ------------------------------------------------------------------------</div><div>[0]PETSC ERROR: Petsc Release Version 3.3.0, Patch 7, Sat May 11 22:15:24 CDT 2013 </div><div>[0]PETSC ERROR: See docs/changes/index.html for recent updates.</div><div>[0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.</div><div>[0]PETSC ERROR: See docs/index.html for manual pages.</div><div>[0]PETSC ERROR: ------------------------------------------------------------------------</div><div>[0]PETSC ERROR: /home/cfd/sgao/mycodes/fensap_new_edge_coefficient/fensapng-mf-newmuscl-overledg_org/bin/fensapMPI_LINUX64_DEBUG on a linux named anakin by sgao Wed Mar 11 15:07:53 2015</div><div>[0]PETSC ERROR: Libraries linked from /tmp/PETSC33/petsc-3.3-p7/linux/lib</div><div>[0]PETSC ERROR: Configure run at Wed Jan 15 12:04:54 2014</div><div>[0]PETSC ERROR: Configure options --with-mpi-dir=/usr/local.linux64/lib64/MPI-openmpi-1.4.5/ --with-shared-libraries=0 --COPTFLAGS=-g --FOPTFLAGS=-g --with-debugging=yes</div><div>[0]PETSC ERROR: ------------------------------------------------------------------------</div><div>[0]PETSC ERROR: VecMAXPY() line 1186 in src/vec/vec/interface/rvector.c</div><div>[0]PETSC ERROR: KSPGMRESBuildSoln() line 345 in src/ksp/ksp/impls/gmres/gmres.c</div><div>[0]PETSC ERROR: KSPGMRESCycle() line 206 in src/ksp/ksp/impls/gmres/gmres.c</div><div>[0]PETSC ERROR: KSPSolve_GMRES() line 231 in src/ksp/ksp/impls/gmres/gmres.c</div><div>[0]PETSC ERROR: KSPSolve() line 446 in src/ksp/ksp/interface/itfunc.c</div></div><div><br></div></div>
</blockquote></span></div><span><font color="#888888"><br><br clear="all"><span><font color="#888888"><div><br></div>-- <br><div>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>
</font></span></font></span></div></div>
</blockquote></div><br></div>
</blockquote></div></div></div><div><div class="h5"><br><br clear="all"><div><br></div>-- <br><div>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></div></div>
</blockquote></div><br></div>