getfem-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Getfem-users] Python interface: memory leak?


From: Yves Renard
Subject: Re: [Getfem-users] Python interface: memory leak?
Date: Fri, 11 Mar 2016 13:24:09 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0


Dear Magnus,

Quite strange memory leak. When I put "b= N.random.rand(50000)" out of the loop, as this :


b= N.random.rand(50000)
for ii in range(1001):
    c=GFspmat.mult(b)
    if ii%100==0:
        print "SPmat: Mem use after %i mult %i kb"%(ii,resource.getrusage(resource.RUSAGE_SELF).ru_maxrss)


Then there is no more leak ... May be it comes from how the python interface deal with numpy arrays. I will have a look.


Yves.






Le 10/03/2016 13:11, Magnus Paulsson a écrit :
Seems that there is a memory leak in SPmat.mult(). The code below shows increasing memory use for getfem 5.0 and 4.? on my linux boxes.
(don’t know if the code works on OSX or windows but runs on windows)

SciPy: Mem use after 0 mult 29588 kb
SciPy: Mem use after 100 mult 29588 kb
SciPy: Mem use after 200 mult 29588 kb
SciPy: Mem use after 300 mult 29588 kb
SciPy: Mem use after 400 mult 29588 kb
SciPy: Mem use after 500 mult 29588 kb
SciPy: Mem use after 600 mult 29588 kb
SciPy: Mem use after 700 mult 29588 kb
SciPy: Mem use after 800 mult 29588 kb
SciPy: Mem use after 900 mult 29588 kb
SciPy: Mem use after 1000 mult 29588 kb
SPmat: Mem use after 0 mult 29588 kb
SPmat: Mem use after 100 mult 65840 kb
SPmat: Mem use after 200 mult 104912 kb
SPmat: Mem use after 300 mult 143984 kb
SPmat: Mem use after 400 mult 183056 kb
SPmat: Mem use after 500 mult 222128 kb
SPmat: Mem use after 600 mult 261200 kb
SPmat: Mem use after 700 mult 300272 kb
SPmat: Mem use after 800 mult 339344 kb
SPmat: Mem use after 900 mult 378416 kb
SPmat: Mem use after 1000 mult 417488 kb




import numpy as N
import getfem as GF
import resource
import scipy.sparse as SS

# Random sparse diagonal 
GFspmat = GF.Spmat('diag', N.random.rand(50000))
GFspmat.to_csc()

# Scipy version
[indptr, indices] =  GFspmat.csc_ind()
data = "">
SciPyspmat = SS.csc_matrix((data,indices,indptr))

for ii in range(1001):
    b=N.random.rand(50000)
    c=SciPyspmat.dot(b)
    if ii%100==0:
        print "SciPy: Mem use after %i mult %i kb"%(ii,resource.getrusage(resource.RUSAGE_SELF).ru_maxrss)

for ii in range(1001):
    b= N.random.rand(50000)
    c=GFspmat.mult(b)
    if ii%100==0:
        print "SPmat: Mem use after %i mult %i kb"%(ii,resource.getrusage(resource.RUSAGE_SELF).ru_maxrss)



-----------------------------------------------
Magnus Paulsson
Associate Professor
Dept. of Physics and Electrical Engineering
Linnaeus University
Phone: +46-480-446308
Mobile: +46-70-6942987



_______________________________________________
Getfem-users mailing list
address@hidden
https://mail.gna.org/listinfo/getfem-users


-- 

  Yves Renard (address@hidden)       tel : (33) 04.72.43.87.08
  Pole de Mathematiques, INSA-Lyon             fax : (33) 04.72.43.85.29
  20, rue Albert Einstein
  69621 Villeurbanne Cedex, FRANCE
  http://math.univ-lyon1.fr/~renard

---------

reply via email to

[Prev in Thread] Current Thread [Next in Thread]