[petsc-users] Memory corruption with two-dimensional array and PetscMemzero

Jed Brown jed at jedbrown.org
Wed May 21 08:55:40 CDT 2014


Christophe Ortiz <christophe.ortiz at ciemat.es> writes:
> For the moment, dof is small (dof=4). Still doing some tests with the
> classes and methods. But should reach 1000-10000 in production.

This is a huge difference.  It's a waste of time to profile cases that
don't matter, so try to profile the cases that matter (even if the
"physics" is mocked).

Note that for 4x4, you can use

  PetscScalar emat[4][4];

> Ahhh...did not think about it ! This would allow to create the vector only
> once in the main (after dof is determined) and pass it as argument to
> FormIJacobian(). I will try. Thanks !

Yes, that's what the context is for.
-------------- 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/20140521/a5b132b3/attachment-0001.pgp>


More information about the petsc-users mailing list