[petsc-users] Valgrind Errors

Dominic Meiser dmeiser at txcorp.com
Fri Sep 12 15:40:09 CDT 2014


On 09/12/2014 02:11 PM, Barry Smith wrote:
>     James (and Hong),
>
>      Do you ever see this problem in parallel runs?
>
>      You are not doing anything wrong.
>
>      Here is what is happening.
>
> MatGetBrowsOfAoCols_MPIAIJ() which is used by MatMatMult_MPIAIJ_MPIAIJ() assumes that the VecScatters for the matrix-vector products are
>
>    gen_to   = (VecScatter_MPI_General*)ctx->todata;
>    gen_from = (VecScatter_MPI_General*)ctx->from data;
>
> but when run on one process the scatters are not of that form; hence the code accesses values in what it thinks is one struct but is actually a different one. Hence the valgrind errors.
>
> But since the matrix only lives on one process there is actually nothing to move between processors hence no error happens in the computation. You can avoid the issue completely by using MATAIJ matrix for the type instead of MATMPIAIJ and then on one process it automatically uses MATSEQAIJ.
>
> I don’t think the bug has anything in particular to do with the MatTranspose.
>
>    Hong,
>
>      Can you please fix this code? Essentially you can by pass parts of the code when the Mat is on only one process. (Maybe this also happens for MPIBAIJ matrices?) Send a response letting me know you saw this.
>
>     Thanks
>
>       Barry
I had to fix a few issues similar to this a while back. The method 
VecScatterGetTypes_Private introduced in pull request 176 might be 
useful in this context.

Cheers,
Dominic



More information about the petsc-users mailing list