<div dir="ltr"><br><div><div class="gmail_extra"><div class="gmail_quote">On 15 March 2016 at 04:46, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Mon, Mar 14, 2016 at 10:05 PM, Steena Monteiro <span dir="ltr"><<a href="mailto:steena.hpc@gmail.com" target="_blank">steena.hpc@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><span style="font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)">Hello,</span><br></div><div><span style="color:rgb(0,0,0)"><font face="arial, helvetica, sans-serif"><br></font></span></div><div><span style="color:rgb(0,0,0)"><font face="arial, helvetica, sans-serif">I am having difficulty getting MatSetSize to work prior to using MatMult.</font></span></div><div><span style="color:rgb(0,0,0)"><font face="arial, helvetica, sans-serif"><br></font></span></div><div><font face="arial, helvetica, sans-serif"><span style="color:rgb(0,0,0)">For matrix A with rows=cols=</span><font color="#000000">1,139,905 and block size = 2, </font></font></div></div></blockquote><div><br></div></span><div>It is inconsistent to have a row/col size that is not divisible by the block size.</div></div></div></div></blockquote><div><br><br>To be honest, I don't think the error message being thrown clearly indicates what the actual problem is (hence the email from Steena). What about<br><br><font color="#000000"><font face="arial, helvetica, sans-serif">"Cannot change/reset row sizes to 400000 local 1139906 global after previously setting them to 400000 local 1139905 global. Local and global sizes must be divisible by the block size"</font></font><br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div> Matt</div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><font face="arial, helvetica, sans-serif"><font color="#000000">rank 0 gets </font><span style="color:rgb(0,0,0)">400000</span><font color="#000000"> rows and rank 1 </font><span style="color:rgb(0,0,0)">739905</span><span style="color:rgb(0,0,0)"> rows, like so:</span></font></div><div><font face="arial, helvetica, sans-serif" color="#000000"><br></font></div><div><font face="arial, helvetica, sans-serif" color="#000000">/*Matrix setup*/</font></div><div><font face="arial, helvetica, sans-serif" color="#000000"><br></font></div><div><font face="arial, helvetica, sans-serif" color="#000000"><div>ierr=PetscViewerBinaryOpen(PETSC_COMM_WORLD,file,FILE_MODE_READ,&fd);</div><div>ierr = MatCreate(PETSC_COMM_WORLD,&A);</div><div>ierr = MatSetFromOptions(A);</div><div>ierr = MatSetType(A,MATBAIJ);</div><div>ierr = MatSetBlockSize(A,2);<br></div></font></div><div><font face="arial, helvetica, sans-serif" color="#000000"><br></font></div><div><font face="arial, helvetica, sans-serif" color="#000000">/*Unequal row assignment*/</font></div><div><font face="arial, helvetica, sans-serif" color="#000000"><br></font></div><div><font face="arial, helvetica, sans-serif" color="#000000"><div> if (!rank) {</div><div> ierr = MatSetSizes(A, 400000, PETSC_DECIDE, 1139905,1139905);CHKERRQ(ierr);</div></font><font color="#000000"><div><font face="arial, helvetica, sans-serif"> } </font></div><div><font face="arial, helvetica, sans-serif">else {</font></div><div><font face="arial, helvetica, sans-serif"> ierr = MatSetSizes(A, 739905, PETSC_DECIDE, 1139905,1139905);CHKERRQ(ierr);</font></div><div><font face="arial, helvetica, sans-serif">}</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">MatMult (A,x,y);</font></div><div><br></div><div><font face="arial, helvetica, sans-serif">/************************************/</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Error message:</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><div><font face="arial, helvetica, sans-serif">1]PETSC ERROR: [0]PETSC ERROR: No support for this operation for this object type</font></div><div><font face="arial, helvetica, sans-serif">Cannot change/reset row sizes to 400000 local 1139906 global after previously setting them to 400000 local 1139905 global</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">[1]PETSC ERROR: [0]PETSC ERROR: Cannot change/reset row sizes to 739905 local 1139906 global after previously setting them to 739905 local 1139905 global</font></div></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">-Without messing with row assignment, MatMult works fine on this matrix for block size = 2, presumably because an extra padded row is automatically added to facilitate blocking.</font><br></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">-The above code snippet works well for block size = 1.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Is it possible to do unequal row distribution <i>while using blocking</i>?</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Thank you for any advice.</font></div><span><font color="#888888"><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">-Steena</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><br></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div style="font-size:medium"><br></div></font></span></font></div></div>
</blockquote></span></div><span class=""><font color="#888888"><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>
</font></span></div></div>
</blockquote></div><br></div></div></div>