[petsc-users] Gathering distributed dense matrix only on rank 0

Matthew Knepley knepley at gmail.com
Mon Jan 25 07:09:49 CST 2021


On Mon, Jan 25, 2021 at 4:40 AM Roland Richter <roland.richter at ntnu.no>
wrote:

> Hei,
>
> is there a way to gather a distributed dense matrix only on rank 0, not
> on the other ranks? My matrix processing/storage routines in my program
> currently are single-threaded and only operate on rank 0, and therefore
> I assume that I can ignore all other ranks. This should also save a bit
> time, I hope (MatCreateRedundantMatrix is currently the by far most
> expensive part of my program).
>
> When executing MatCreateRedundantMatrix(A, size, MPI_COMM_NULL,
> MAT_INITIAL_MATRIX, &B), usually all ranks get the full matrices,
> something I would like to avoid. Therefore, is there another way of
> handling this?
>

I am skeptical that it will save time, but you can do what you want using


https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreateSubMatrices.html

  Thanks,

     Matt


> Thanks!
>
> Regards,
>
> Roland Richter
>
>

-- 
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/20210125/b7bda27a/attachment.html>


More information about the petsc-users mailing list