[petsc-users] memory use of a DMDA

Juha Jäykkä juhaj at iki.fi
Mon Oct 21 07:02:17 CDT 2013


Dear list members,

I have noticed strange memory consumption after upgrading to 3.4 series. I 
never had time to properly investigate, but here is what happens [yes, this 
might be a petsc4py issue, but I doubt it] is

# helpers contains _ProcessMemoryInfoProc routine which just digs the memory
# usage data from /proc
import helpers
procdata=helpers._ProcessMemoryInfoProc()
print procdata.rss/2**20, "MiB /", procdata.os_specific[3][1]
from petsc4py import PETSc
procdata=helpers._ProcessMemoryInfoProc()
print procdata.rss/2**20, "MiB /", procdata.os_specific[3][1]
da = PETSc.DA().create(sizes=[100,100,100],
                       proc_sizes=[PETSc.DECIDE,PETSc.DECIDE,PETSc.DECIDE],
                       boundary_type=[3,0,0],
                       stencil_type=PETSc.DA.StencilType.BOX,
                       dof=7, stencil_width=1, comm=PETSc.COMM_WORLD)
procdata=helpers._ProcessMemoryInfoProc()
print procdata.rss/2**20, "MiB /", procdata.os_specific[3][1]
vec=da.createGlobalVec()
procdata=helpers._ProcessMemoryInfoProc()
print procdata.rss/2**20, "MiB /", procdata.os_specific[3][1]

outputs

48 MiB / 49348 kB
48 MiB / 49360 kB
381 MiB / 446228 kB
435 MiB / 446228 kB

Which is odd: size of the actual data to be stored in the da is just about 56 
megabytes, so why does creating the da consume 7 times that? And why does the 
DA reserve the memory in the first place? I thought memory only gets allocated 
once an associated vector is created and it indeed looks like the 
createGlobalVec call does indeed allocate the right amount of data. But what 
is that 330 MiB that DA().create() consumes? [It's actually the .setUp() 
method that does the consuming, but that's not of much use as it needs to be 
called before a vector can be created.]

Cheers,
Juha



More information about the petsc-users mailing list