problem of parallel MatAssembled

Lisandro Dalcin dalcinl at
Fri May 30 10:37:00 CDT 2008

On 5/30/08, Gong Ding <gdiso at> wrote:
> Hi,
>  I use MatAssembled to determine if a parallel matrix (MPIAIJ) is assembled.
>  One processor says 1 and another says 0. (Petsc-2.3.3-p2)
>  The correct answer should be the same for all the processor  I think.
>  Is it a bug or I forget something?

Are you completelly sure that you collectively called at ALL processes


Please, note the MAT_FINAL_ASSEMBLY. If you used MAT_FLUSH_ASSEMBLY at
some process, then what you get is expected.

>  BTW. I think a function as MatAddRowToRow is useful.
>  I had implemented with MatGetRow and MatSetValues (or use Mat*Mat?).

Not sure what you are trying to do, please elaborate a bit more. Why a
call like this

PetscInt row = ...
PetscInt ncols = ...
PetscInt *cols_indices = ...
PetscScalar *cols_values = ...

MatSetValues(A, 1, &row, ncols, cols_indices, cols_values, ADD_VALUES)

is not enough for you?

Lisandro Dalcín
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594

More information about the petsc-users mailing list