[petsc-users] Converting a Parallel(MPI) Matrix to a Sequential Matrix

Matthew Knepley knepley at gmail.com
Mon Sep 7 10:12:25 CDT 2020


On Mon, Sep 7, 2020 at 11:00 AM Anthony Dowling <dowlinah at clarkson.edu>
wrote:

> Hello all,
>
> Is there a method to convert a parallel(MPI) dense matrix to a sequential
> dense matrix? Also to do the same in reverse? The code I am using needs to
> be able to convert a float** matrix to a Petsc matrix, and then later
> convert that Petsc matrix between MPI dense and sequential dense. How might
> this be achieved? The code seems to be converting float** matrices to Petsc
> properly, but I am unable to find a method to convert between MPI and
> sequential matrices.
>

If you want the serial matrix everywhere, this is easy:
https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreateRedundantMatrix.html
If you want it just on 1 process, you can use:
https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreateSubMatrices.html

  Thanks,

    Matt


> Thanks in advance,
> Anthony Dowling
>


-- 
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/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200907/9b4ab217/attachment.html>


More information about the petsc-users mailing list