<div>Hi, Satish,</div>
<div>It is very illustrating! </div>
<div>Thank you very much!</div>
<div> </div>
<div>Yan<br><br></div>
<div class="gmail_quote">On Mon, May 4, 2009 at 2:45 PM, Satish Balay <span dir="ltr"><<a href="mailto:balay@mcs.anl.gov">balay@mcs.anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">If you have a 3x3 block [i.e 9 values]. And compare MatSetValues() vs<br>MatSetValuesBlocked() - then the differences are:<br>
<br>1. 9 row,col indices provided for MatSetValues() vs 1-row,col index<br>for the block<br><br>2. The internal code for MatSetValues might have to loop over all 9<br>indices and do 9 searches/checks [for the correct location with the<br>
matrix]. In the MatSetValuesBlocked() case - its just 1 search/check -<br>and all the 9 values copied into the internal structure..<br><br>3. there could potentiall be 9 function calls with MatSetValues() vs 1<br>for MatSetValuesBlocked()<br>
<br>Even if you have to format the data a bit [perhaps copy into array[9]]<br>that overhead might be less than the loop-search/insert overhead of<br>MatSetValues().<br><font color="#888888"><br>Satish<br></font>
<div>
<div></div>
<div class="h5"><br>On Mon, 4 May 2009, Ryan Yan wrote:<br><br>> Hi Barry,<br>> My matrix is read from files stroing a matrix in the Block CRS format. So a<br>> natural way to create the matrix is MPIBAIJ. However, if I want to<br>
> use MatSetValuesBlocked() for the newly created MPIBAIJ, I still need<br>> to load a tempary arrary(from Block CRS file) with the length of blocksize^2<br>> and pass it into the Matrix via MatSetValuesBlocked(). This process is<br>
> similar to the MatSetValues. Could you make a little bit more clarification<br>> on why the MatSetValuesBlocked() have some advantage on blocked structure?<br>><br>> Thanks,<br>><br>> Yan<br>><br>><br>
><br>> On Fri, May 1, 2009 at 6:12 PM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br>><br>> ><br>> > Support for MatSetValuesBlocked() for AIJ matrices was added in PETSc<br>
> > 3.0.0<br>> ><br>> > Note that if your matrix is truly blocked you should use BAIJ matrices, if<br>> > your matrix is not truly blocked then there is no benefit to using<br>> > MatSetValuesBlocked() it was added so people could easily switch between AIJ<br>
> > and BAIJ for testing.<br>> ><br>> > Barry<br>> ><br>> ><br>> > On May 1, 2009, at 5:04 PM, Ryan Yan wrote:<br>> ><br>> > Hi, all,<br>> >> I am using MPIAIJ for my matrix A, but when I call the function<br>
> >> MatSetValuesBlocked, I got the error:<br>> >><br>> >> PetscPrintf(PETSC_COMM_WORLD, "breakpoint 1\n");<br>> >> ierr =<br>> >> MatSetValuesBlocked(A,1,&irow,1,(col_ind+icol),temp_vector,INSERT_VALUES);<br>
> >> PetscPrintf(PETSC_COMM_WORLD, "breakpoint 2\n");<br>> >><br>> >><br>> >> breakpoint 1<br>> >> [0]PETSC ERROR: --------------------- Error Message<br>> >> ------------------------------------<br>
> >> [0]PETSC ERROR: No support for this operation for this object type!<br>> >> [0]PETSC ERROR: Mat type mpiaij!<br>> >> [0]PETSC ERROR:<br>> >> ------------------------------------------------------------------------<br>
> >> [0]PETSC ERROR: Petsc Release Version 2.3.3, Patch 15, Tue Sep 23 10:02:49<br>> >> CDT 2008 HG revision: 31306062cd1a6f6a2496fccb4878f485c9b91760<br>> >> [0]PETSC ERROR: See docs/changes/index.html for recent updates.<br>
> >> [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.<br>> >> [0]PETSC ERROR: See docs/index.html for manual pages.<br>> >> [0]PETSC ERROR:<br>> >> ------------------------------------------------------------------------<br>
> >> [0]PETSC ERROR:<br>> >> /home/vyan2000/local/PPETSc/petsc-2.3.3-p15/src/ksp/ksp/examples/tutorials/ttt2/kspex1reader_binmpiaij<br>> >> on a linux-gnu named vyan2000-linux by vyan2000 Fri May 1 17:58:48 2009<br>
> >> [0]PETSC ERROR: Libraries linked from<br>> >> /home/vyan2000/local/PPETSc/petsc-2.3.3-p15/lib/linux-gnu-c-debug<br>> >> [0]PETSC ERROR: Configure run at Thu Feb 5 21:10:10 2009<br>> >> [0]PETSC ERROR: Configure options --with-mpi-dir=/usr/lib/<br>
> >> --with-debugger=gdb --with-shared=0 --download-hypre=1 --download-parmetis=1<br>> >> [0]PETSC ERROR:<br>> >> ------------------------------------------------------------------------<br>> >> [0]PETSC ERROR: MatSetValuesBlocked() line 1289 in<br>
> >> src/mat/interface/matrix.c<br>> >> breakpoint 2<br>> >><br>> >> Is it the reason that MatSetValuesBlocked only works for MPIBAIJ or<br>> >> SeqBAIJ?<br>> >><br>> >> Thanks,<br>
> >><br>> >> Yan<br>> >><br>> ><br>> ><br>><br><br></div></div></blockquote></div><br>