[petsc-users] MatAssemblyEnd hangs during a parallel calculation with PETSc>3.3

Jed Brown jed at jedbrown.org
Thu Jan 16 08:12:59 CST 2014


Projet_TRIOU <triou at cea.fr> writes:

> Sorry a typo, it is really MatMPISBAIJSetPreallocation()
>
> Yes, I call MatMPISBAIJSetPreallocation() on ALL processes and
> sometimes a local part of the matrix has zero rows. It worked well
> with Petsc 3.3 and before in this particular case.

I believe this is the relevant conditional:

  if (nz >= 0 || nnz) realalloc = PETSC_TRUE;

Instead of this:

       if (nb_rows==0) // Local matrix is empty
          ierr = MatMPISBAIJSetPreallocation(MatricePetsc, block_size_, 0, NULL, 0, NULL);
       else
          ierr = MatMPISBAIJSetPreallocation(MatricePetsc, block_size_, PETSC_DEFAULT, d_nnz.addr(), PETSC_DEFAULT, o_nnz.addr());

can you just call the following?

          ierr = MatMPISBAIJSetPreallocation(MatricePetsc, block_size_, 0, d_nnz.addr(), 0, o_nnz.addr());

If you are passing an nnz array (can be empty if there are zero rows),
we will trust that.  PETSC_DEFAULT is only intended to be used if you
don't pass an array, though we're currently being tolerant by ignoring
it if the array is non-NULL.  The problem arises because we can't tell
the difference between a zero-length semantically-meaningful array and
an "I'm not passing this argument" NULL.

Is this something we can fix in the documentation or should we guard in
the code?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140116/6451b7d1/attachment-0001.pgp>


More information about the petsc-users mailing list