On Mon, Jan 25, 2021 at 4:40 AM Roland Richter <roland.richter@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