[petsc-dev] [petsc-users] Column #j is wrong in parallel from message "Inserting a new nonzero (i, j) into matrix"

Eric Chamberland Eric.Chamberland at giref.ulaval.ca
Thu Mar 26 06:01:05 CDT 2015


On 03/25/2015 11:10 PM, Barry Smith wrote:
>> On Mar 25, 2015, at 7:59 PM, Eric Chamberland <Eric.Chamberland at giref.ulaval.ca> wrote:
>>
>> Hi Barry,
>>
>> On 03/25/2015 07:25 PM, Barry Smith wrote:
>>>      This is an issue with any use of "nested" matrices (of which MPIBAIJ is a special, two level case). One way we could handle this is (I think universally) would be to introduce a unique PETSC_ERR_MAT_ENTRY_NONZERO error flag and then when any outer MatSetValues() calls an inner MatSetValues() check the error code and if this one print an error message with its level of row and column indices. So for example
>>>
>>>    Inside MatSetValuesBlocked_MPIBAIJ()
>>>
>>>    ierr = MatSetValuesBlocked_SeqBAIJ(baij->B,1,&row,1,&col,barray,addv);
>>>    if (ierr == PETSC_ERR_MAT_ENTRY_NONZERO) (*PetscErrorPrintf)("%s Matrix row and column block indices (%d %d)\n",__FUNC__,im[i],in[j]);
>>>    CHKERRQ(ierr);
>>>
>>>    The resulting error message would look something like
>>>
>>> [0]PETSC ERROR: MatSetValuesBlocked_SeqBAIJ() line 564 in /home/mefpp_ericc/petsc-3.5.3/src/mat/impls/baij/mpi/mpibaij.c Inserting a new nonzero (135, 9) into matrix
>>> ... a stack trace line or two here
>>> [0] PETSC ERROR: MatSetValuesBlocked_MPIBAIJ() line ... Matrix row and column block indices (135,537)
>> I would prefer either:
>> #1 - Inserting a new nonzero on line 135.  (internal col_identifier(not number, hash??) 9)
>> #2-  and then, for the remaining, what you proposed is correct.
>>
>> Maybe it would worth to mention (or not?) that these (135,537) are global indices...
>    The issue is that there could be any number of levels of nesting and the "outer most one" has no way of knowing that it is the outer most one so it really cannot print definitively that they are the "global indices". As to  the inner setter saying "internal col identifier" or something it also has no way of knowing if it is the an "internal col identifier" or if the values are the global numbers, so again having it print something like "internal col identifier" is not possible.
>
>    Hmm, maybe somehow passing the global indices down through all the levels is the way to go; it is the only way to give a clean concise error message that doesn't require interpretation by the user. But it does require a "weird" calling sequence for MatSetValues() with this extra information.
ok, I see.  Now, maybe only passing the "nesting level" would be enough:

- it allows you to decide if you can display that indices are "global" 
or not
- it allows you to "know" what level you are in
- if you write an error message at each level from first caller to 
deeper one (maybe with a known ierr value?), you will be able to have 
indices printed for each level...

just my thoughts...

Thanks!

Eric


>   Barry
>
>> so there is no possible confusion... anyway, even if this message is long, it is there to help the faulty user... ;-)
>>
>>> In three level nesting there would be three sets of indices.
>>>
>>> We could use a macro to handle the error (to minimize the ugliness of the code).
>>>
>>> Is this worth pursing? The resulting messages are still a bit cryptic and ugly but at least they provide the user with correct information as opposed to the current situations where for nested matrices it is meaningless misleading numbers.
>>>
>>> The only other alternative I see is passing the global numbers all the way down in the calls (as extra variables) which seems pretty bad.
>>>
>>>   Any other thoughts?
>> My thought is:: the time you spend correcting this, will result in time saving to other who encounter the problem...  your paying it forward... ;-)
>>
>> anyway, thanks for the upcoming fix! :-)
>>
>> Eric
>>




More information about the petsc-dev mailing list