<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Mar 15, 2016 at 12:14 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi Matt,</div><div><br></div><div>Yes, the rest of the code is:</div><div><br></div><div> ierr = MatSetBlockSize(A,2);CHKERRQ(ierr); </div><div><div><b> ierr = MatLoad(A,fd);CHKERRQ(ierr);</b></div></div></div></blockquote><div><br></div><div>So, are you saying that</div><div><br></div><div> 1) You have a matrix with odd total dimension</div><div><br></div><div> 2) You set the block size of the initial matrix to 2</div><div><br></div><div> 3) You load the matrix</div><div><br></div><div>and there is no error? Can you make a simple example with a matrix of size 5?</div><div>I can put in the relevant error checking.</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"><div dir="ltr"><div><div> ierr = MatCreateVecs(A, &x, &y);CHKERRQ(ierr);</div><div> </div><div> </div><div> ierr = VecSetRandom(x,NULL); CHKERRQ(ierr);</div><div> ierr = VecSet(y,zero); CHKERRQ(ierr);</div><div> ierr = MatMult(A,x,y); CHKERRQ(ierr);</div><div> </div><div> </div><div> ierr = PetscViewerDestroy(&fd);CHKERRQ(ierr);</div><div> ierr = MatDestroy(&A);CHKERRQ(ierr);</div><div> ierr = VecDestroy(&x);CHKERRQ(ierr);</div><div> ierr = VecDestroy(&y);CHKERRQ(ierr);</div><div><br></div><div>Thanks,</div><div>Steena</div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 15 March 2016 at 09:15, 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: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 Tue, Mar 15, 2016 at 11:04 AM, 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I pass a binary, matrix data file at the command line and load it into the matrix:<div><br></div><div><div>PetscInitialize(&argc,&args,(char*)0,help);</div><div>ierr = MPI_Comm_rank(PETSC_COMM_WORLD,&rank);CHKERRQ(ierr);<br></div><div><br></div><div>/* converted mtx to dat file*/<br></div><div>ierr = PetscOptionsGetString(NULL,"-f",file,PETSC_MAX_PATH_LEN,&flg);</div><div>CHKERRQ(ierr);</div><div> </div><div>if (!flg) SETERRQ(PETSC_COMM_WORLD,PETSC_ERR_USER,"specify matrix dat file with -f");</div><div><br></div><div> /* Load matrices */</div><div>ierr = PetscViewerBinaryOpen(PETSC_COMM_WORLD,file,FILE_MODE_READ,&fd);CHKERRQ(ierr);</div></div><div>ierr = PetscViewerBinaryOpen(PETSC_COMM_WORLD,file,FILE_MODE_READ,&fd);CHKERRQ(ierr);<br></div><div><div>ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr);</div><div>ierr = MatSetFromOptions(A);CHKERRQ(ierr);</div></div></div></blockquote><div><br></div></span><div>Nothing above loads a matrix. Do you also call MatLoad()?</div><div><br></div><div> Matt</div><div><div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Thanks,</div><div>Steena</div><div class="gmail_extra"><br><div class="gmail_quote">On 15 March 2016 at 08:58, 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-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Tue, Mar 15, 2016 at 10:54 AM, 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-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Thank you, Dave.<div><br></div><div>Matt: I understand the inconsistency but MatMult with non divisible block sizes (here, 2) does not throw any errors and fail, when MatSetSize is commented out. Implying that 1139905 global size does work with block size 2. </div></div></blockquote><div><br></div></span><div>If you comment out MatSetSize(), how does it know what size the Mat is?</div><div><br></div><div> Matt</div><div><div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="gmail_extra"><div class="gmail_quote">On 15 March 2016 at 00:12, Dave May <span dir="ltr"><<a href="mailto:dave.mayhem23@gmail.com" target="_blank">dave.mayhem23@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br><div><div class="gmail_extra"><div class="gmail_quote"><span>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-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>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-width:1px;border-left-style:solid;border-left-color: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></span><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><div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color: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><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color: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><font color="#888888"><br><br clear="all"><span><font color="#888888"><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></font></span></div></div><span><font color="#888888"><span><font color="#888888">
</font></span></font></span></blockquote></div></div></div><span><font color="#888888"><span><font color="#888888"><br></font></span></font></span></div></div></div><span><font color="#888888">
</font></span></blockquote></div><span><font color="#888888"><br></font></span></div><span><font color="#888888">
</font></span></blockquote></div></div></div><span><font color="#888888"><div><div><br><br clear="all"><span class="HOEnZb"><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></div></div></font></span></div></div><span class="HOEnZb"><font color="#888888">
</font></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br></font></span></div></div><span class="HOEnZb"><font color="#888888">
</font></span></blockquote></div></div></div><span class="HOEnZb"><font color="#888888"><div><div><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></font></span></div></div>
</blockquote></div><br></div>
</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>