[petsc-users] Efficiently move matrix from single processor to multiple

Jed Brown jed at jedbrown.org
Tue Feb 18 14:49:32 CST 2020


Hector E Barrios Molano <hectorb at utexas.edu> writes:

> Dear PETSc Experts!
>
> Do you know if there is an efficient way to move a matrix from a single 
> processor (MatCreateSeqBAIJ) to a matrix contained in all processors?

How did you create the original SeqBAIJ?  Could you just call
MatSetValues on a parallel matrix instead (even if only setting values
from rank 0)?  Many of our tutorials suggest this mode if you can't
parallelize your assembly.

> As a little bit of context, I have a code in which only one processor 
> creates a matrix and a vector for a linear system of equations. Then we 
> want to use a parallel solver to get the solution and give it back to a 
> single processor
>
> I tried MatView to create a binary file and MatLoad to load the matrix 
> in parallel. This seems to work but performance is significantly 
> decreased independent of the number of processors used.
>
> I have some questions:
>
> Can I share the matrix without having to write it to a file, for 
> example, through a buffer?
> Is there a way to efficiently avoid the overhead of writing, reading 
> loading matrices to and from processors?
>
> Thanks for your comments,
>
> Hector
> -- 
> *Hector Barrios*
> PhD Student, Graduate Research Assistant
> Hildebrand Department of Petroleum and Geosystems Engineering
> The University of Texas at Austin
> hectorb at utexas.edu <mailto:hectorb at utexas.edu>


More information about the petsc-users mailing list