non-local values being dropped in MatSetValues

Stephan Kramer s.kramer at imperial.ac.uk
Fri Jul 17 07:44:09 CDT 2009


Hello

We've spend sometime debugging a problem were in the assembly of a 
parallel MPIAIJ matrix, some values that were created on a process other 
than the owner of the row seemed to disappear. I think I narrowed it 
down to what I think is a bug in MatSetValues_MPIAIJ, but please tell me 
if I'm wrong.

The situation is the following: I'm calling MatSetValues with the flag 
ADD_VALUES and with matrix option MAT_IGNORE_ZERO_ENTRIES. I'm inserting 
  multiple values at once, multiple columns and rows, so I provide a 
rank-2 matrix of values. As I'm calling this from fortran I'm also using 
MAT_COLUMN_ORIENTED. Now for provided rows that are not owned by the 
process, it jumps to mpiaij.c:394 (line numbers as in petsc-dev). On 
line 399, it checks for zero entries, but only checks the very first 
entry of the (non-owned) row. If however other entries of that same row 
are nonzero, the entire row is still dropped. Note that this is 
independent of row_oriented/column_oriented as line 396 does exactly the 
same.

If I don't set the option MAT_IGNORE_ZERO_ENTRIES the problem 
disappears. In that case however we would either have to preallocate 
substantially more nonzeros, or complicate the matrix assembly in our 
code by taking out the zero entries ourselves and call MatSetValues for 
each entry seperately.

Your help would be much appreciated,
Cheers
Stephan


-- 
Stephan Kramer  <s.kramer at imperial.ac.uk>
Applied Modelling and Computation Group,
Department of Earth Science and Engineering,
Imperial College London


More information about the petsc-users mailing list