<div>Hi Jed,</div>We didn't see obvious memory corruption with valgrind. <div>We printed matrix A and B and they both appear correct. </div><div>We think it may be related to the matrices being non-square. Could it be related to that?</div>
<div><br></div><div>Also, if we run outside the debugger, we get the following error, but I'm not sure which line that is coming from.</div><div><div>terminate called after throwing an instance of 'std::runtime_error'</div>
<div> what(): [PetscMatrixNemo<cplx>] PETSc gave error with code 73:</div><div> Object is in wrong state</div>
<div><br></div>Thanks,</div><div>Jim<br><div class="gmail_quote">On Tue, Jan 15, 2013 at 1:00 PM, Jed Brown <span dir="ltr"><<a href="mailto:jedbrown@mcs.anl.gov" target="_blank">jedbrown@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 dir="ltr">This looks like memory corruption. Can you run in valgrind?<div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jan 15, 2013 at 11:54 AM, Jim Fonseca <span dir="ltr"><<a href="mailto:jefonseca@gmail.com" target="_blank">jefonseca@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Hi,</div>We are in the process of upgrading from Petsc 3.2 to 3.3p5.<div><br></div><div>We are creating matrices A and B in this way.<br>
<div><font face="courier new, monospace"> petsc_matrix = new Mat;</font></div>
<div><font face="courier new, monospace"> ierr = MatCreateDense(comm, m, num_cols ,num_rows,num_cols,data,A);<br clear="all"></font><div><br></div><div>Elsewhere, we have this. It gets called a few times, and on the 4th time, the size of matrix is C is wrong. Please see the output below. What could be the problem?</div>
<div><div><font face="courier new, monospace"> C = new Mat;</font></div>
<div><font face="courier new, monospace"> double fill = PETSC_DEFAULT;</font></div></div><div><div><font face="courier new, monospace"> MatMatMult(A,B,MAT_INITIAL_MATRIX, fill, C);</font></div><div><font face="courier new, monospace"> {</font></div>
<div><div><font face="courier new, monospace"> int m,n;</font></div><div><font face="courier new, monospace"> MatGetOwnershipRange(A, &m, &n);</font></div>
<div><font face="courier new, monospace"> cerr << "A.m = " << m << "\n";</font></div><div><font face="courier new, monospace"> cerr << "A.n = " << n << "\n";</font></div>
<div><font face="courier new, monospace"> MatGetSize(A,&m,&n);</font></div>
<div><font face="courier new, monospace"> cerr << "A global rows = " << m << "\n";</font></div><div><font face="courier new, monospace"> cerr << "A global cols = " << n << "\n";</font></div>
<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace"> MatGetOwnershipRange(B, &m, &n);</font></div>
<div><font face="courier new, monospace"> cerr << "B.m = " << m << "\n";</font></div><div><font face="courier new, monospace"> cerr << "B.n = " << n << "\n";</font></div>
<div><font face="courier new, monospace"> MatGetSize(B,&m,&n);</font></div>
<div><font face="courier new, monospace"> cerr << "B global rows = " << m << "\n";</font></div><div><font face="courier new, monospace"> cerr << "B global cols = " << n << "\n";</font></div>
<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace"> MatGetOwnershipRange(*C, &m, &n);</font></div>
<div><font face="courier new, monospace"> cerr << "C.m = " << m << "\n";</font></div><div><font face="courier new, monospace"> cerr << "C.n = " << n << "\n";</font></div>
<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace"> MatGetSize(*C,&m,&n);</font></div>
<div><font face="courier new, monospace"> cerr << "C global rows = " << m << "\n";</font></div><div><font face="courier new, monospace"> cerr << "C global cols = " << n << "\n";</font></div>
</div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace"> }</font></div>
</div><div><font face="courier new, monospace"><br></font></div><div><div><font face="courier new, monospace">A.m = 0</font></div><div><font face="courier new, monospace">A.n = 59</font></div><div><font face="courier new, monospace">A global rows = 59</font></div>
<div><font face="courier new, monospace">A global cols = 320</font></div><div><font face="courier new, monospace">B.m = 0</font></div><div><font face="courier new, monospace">B.n = 320</font></div><div><font face="courier new, monospace">B global rows = 320</font></div>
<div><font face="courier new, monospace">B global cols = 320</font></div>
<div><font face="courier new, monospace">C.m = 0</font></div><div><font face="courier new, monospace">C.n = 59</font></div><div><font face="courier new, monospace">C global rows = 59</font></div><div><font face="courier new, monospace">C global cols = 320</font></div>
<div><font face="courier new, monospace">A.m = 0</font></div><div><font face="courier new, monospace">A.n = 59</font></div><div><font face="courier new, monospace">A global rows = 59</font></div><div><font face="courier new, monospace">A global cols = 320</font></div>
<div><font face="courier new, monospace">B.m = 0</font></div><div><font face="courier new, monospace">B.n = 320</font></div>
<div><font face="courier new, monospace">B global rows = 320</font></div><div><font face="courier new, monospace">B global cols = 59</font></div><div><font face="courier new, monospace">C.m = 10922</font></div><div><font face="courier new, monospace">C.n = -1389327096</font></div>
<div><font face="courier new, monospace">C global rows = -1389327112</font></div><div><font face="courier new, monospace">C global cols = -1389327112</font></div></div><div><br></div><div><br></div><div>Thanks,</div><div>
Jim</div><span><font color="#888888"><div><div>-- </div>
</div>Jim Fonseca, PhD<div>
Research Scientist</div><div>Network for Computational Nanotechnology</div><div>Purdue University</div><div><a href="tel:765-496-6495" value="+17654966495" target="_blank">765-496-6495</a><br><div><a href="http://www.jimfonseca.com" target="_blank">www.jimfonseca.com</a></div>
<div><br><div>
<br></div></div></div>
</font></span></div>
</div>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Jim Fonseca, PhD<div>Research Scientist</div><div>Network for Computational Nanotechnology</div><div>Purdue University</div><div><a href="tel:765-496-6495" value="+17654966495" target="_blank">765-496-6495</a><br>
<div><a href="http://www.jimfonseca.com" target="_blank">www.jimfonseca.com</a></div>
<div><br><div><br></div></div></div>
</div>