about MatCreateSeqAIJ and MatCreateMPIAIJ

Satish Balay balay at mcs.anl.gov
Mon Oct 23 22:39:58 CDT 2006

On Tue, 24 Oct 2006, Yixun Liu wrote:

> Hi,
> I am confused with this two routines.
> MatCreateMPIAIJ(PETSC_COMM_WORLD,...) creates a parallel
> matrix,which will be distributed on all the
> processors. MatCreateSeqAIJ(PETSC_COMM_SELF, ...) creates a
> sequential matrix. But because this routine will be called by each
> processor, which processor create this matrix?

If the routine is called on each processor - then each of them will
have a sequential matrix.

Generally one uses SeqAIJ when running the application on only one
processor. Also one can think of a case where someone might want to
store sequential matrices on each processor [the matrix sizes/values
being different on each proc]

For eg: We internally store MPIAIJ mat as a collection of SeqAIJ
matrices on each proc. For additional info - check the 'Example usage'
section at:



More information about the petsc-users mailing list