help-octave
[Top][All Lists]
Advanced

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

Re: high memory usage by spdet / memory leak?


From: David Bateman
Subject: Re: high memory usage by spdet / memory leak?
Date: Wed, 11 May 2005 10:10:24 +0200
User-agent: Mozilla Thunderbird 0.8 (X11/20040923)

Dmitri A. Sergatskov wrote:

David Bateman wrote:


Try the following patch

2005-04-29  David Bateman  <address@hidden>

   * dSparse.cc (determinant): Free numeric factorization after
   sucessful calculation.
   * CSparse.cc (determinant): ditto.

D.


Thanks.

I tried today's octave cvs snapshot and it does not have memory leak
in spdet. The memory usage during spdet() calculation still high --
something about 300MB. This is for array produced by
octave:1> n=6000; a=speye(n,n)+0.01*sprandn(n,n,0.001);
octave:2> whos a

*** local user variables:

  Prot Name        Size                     Bytes  Class
  ==== ====        ====                     =====  =====
   rwd a        6000x6000                  527572  sparse matrix

Total is 41964 elements using 527572 bytes

Sincerely,

Dmitri.


I think this is intrinsic to the the poor matrix sparsity of the factorization. Try doing an LU decomposition on the matrix as

[l,u,p,q] = lu(a)

and you'll see similar memory usage. The same UMFPACK factorization code is used in lu and spdet. The reason for the large memory usage is that as the matrix "a" is created will sprandn it has no structure and the colamd routine has difficulty selecting a permutation that keeps the LU factorization of the matrix a sparse... To see this look at

octave:1> n=6000; a=speye(n,n)+0.01*sprandn(n,n,0.001);
octave:2> [l,u,p,q] = lu(a);
octave:3> whos l

*** local user variables:

 Prot Name        Size                     Bytes  Class
 ==== ====        ====                     =====  =====
  rwd l        6000x6000                84529324  sparse matrix

Total is 7042110 elements using 84529324 bytes

octave:4> whos u

*** local user variables:

 Prot Name        Size                     Bytes  Class
 ==== ====        ====                     =====  =====
  rwd u        6000x6000                85128232  sparse matrix

Total is 7092019 elements using 85128232 bytes

Try the same thing with a banded matrix, which will stay sparse after the factorization.

octave:1> n= 6000; a = spdiags([ones(n,1),4*ones(n,1),ones(n,1)],[-2,0,2],n,n);
octave:2> [l,u,p,q] = lu(a);
octave:3> whos l

*** local user variables:

 Prot Name        Size                     Bytes  Class
 ==== ====        ====                     =====  =====
  rwd l        6000x6000                  167980  sparse matrix

Total is 11998 elements using 167980 bytes

octave:4> whos u

*** local user variables:

 Prot Name        Size                     Bytes  Class
 ==== ====        ====                     =====  =====
  rwd u        6000x6000                  167980  sparse matrix

Total is 11998 elements using 167980 bytes

Regards
David

--
David Bateman                                address@hidden
Motorola Labs - Paris +33 1 69 35 48 04 (Ph) Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01 (Fax) 91193 Gif-Sur-Yvette FRANCE

The information contained in this communication has been classified as: [x] General Business Information [ ] Motorola Internal Use Only [ ] Motorola Confidential Proprietary



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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