This is an interesting idea, but unfortunately not directly compatible with 
libMesh filling up the finite element part of the matrix. Plus it appears 
MatGetLocalSubMatrix() is only implemented for IS and Nest matrices :-(

   You could create  a MATNEST reusing exactly the matrix from lib mesh as the 
first block and call MatConvert() to MPIAIJ format. This is easier I guess then 
coding the conversion yourself. (Still has the memory and copy issues but if 
that is the best we can do). Note that MatNest() requires that all its matrices 
live on all the ranks of the MPI_Comm, so for your A B and C you will need to 
declare them on the MPI_Comm with zero rows and columns for most ranks (maybe 
all but one).

   Barry


    



> On May 29, 2019, at 6:43 PM, Matthew Knepley <knep...@gmail.com> wrote:
> 
> On Wed, May 29, 2019 at 7:30 PM Manav Bhatia via petsc-users 
> <petsc-users@mcs.anl.gov> wrote:
> 
> I would not choose Nest if you want to eventually run MUMPS, since that will 
> not work. I would
> try to build your matrix using
> 
>   
> https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatGetLocalSubMatrix.html
> 
> obtained from your bigger matrix. This is our interface to assembling into 
> portions or your matrix as if
> its the entire matrix.
> 
>   Thanks,
> 
>     Matt
>  
>   Also, I am currently using MUMPS for all my parallel solves. 
> 
>    I would appreciate any advice. 
> 
> Regards,
> Manav
> 
> 
> > On May 29, 2019, at 6:07 PM, Smith, Barry F. <bsm...@mcs.anl.gov> wrote:
> > 
> > 
> >  Manav,
> > 
> >  For parallel sparse matrices using the standard PETSc formats the matrix 
> > is stored in two parts on each process (see the details in MatCreateAIJ()) 
> > thus there is no inexpensive way to access directly the IJ locations as a 
> > single local matrix. What are you hoping to use the information for? 
> > Perhaps we have other suggestions on how to achieve the goal.
> > 
> >   Barry
> > 
> > 
> >> On May 29, 2019, at 2:27 PM, Manav Bhatia via petsc-users 
> >> <petsc-users@mcs.anl.gov> wrote:
> >> 
> >> Hi, 
> >> 
> >>   Once a MPI-AIJ matrix has been assembled, is there a method to get the 
> >> nonzero I-J locations? I see one for sequential matrices here: 
> >> https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatGetRowIJ.html
> >>  , but not for parallel matrices. 
> >> 
> >> Regards,
> >> Manav
> >> 
> >> 
> > 
> 
> 
> 
> -- 
> What most experimenters take for granted before they begin their experiments 
> is infinitely more interesting than any results to which their experiments 
> lead.
> -- Norbert Wiener
> 
> https://www.cse.buffalo.edu/~knepley/

Reply via email to