Memory reporting, questionable cast to int

Jed Brown jed at 59A2.org
Fri Jun 5 06:50:04 CDT 2009


plog.c:1557:

|  ierr = PetscFPrintf(comm, fd, "%20s %5d          %5d  %9d     %g\n", stageLog->classLog->classInfo[oclass].name,
|                      classInfo[oclass].creations, classInfo[oclass].destructions, (int) classInfo[oclass].mem,
|                      classInfo[oclass].descMem);CHKERRQ(ierr);

Why cast classInfo[oclass].mem to int?  Any reason not to change to %9f
and remove the cast?

Note that memory usage can be much larger than 2^31 before 64-bit
indices are needed so casting to PetscInt isn't right either.

| --- Event Stage 0: Main Stage
| 
|                  Vec    38             38  176360064     0
|          Vec Scatter     1              1        460     0
|               Matrix     2              2  -2147483648     0
|        Krylov Solver     1              1      18056     0
|       Preconditioner     1              1        760     0
|               Viewer     1              1        552     0
|            Index Set     4              4    9281568     0


Jed

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20090605/ae1c2d61/attachment.sig>


More information about the petsc-dev mailing list