Memory allocated by PETSC?

Shi Jin jinzishuai at yahoo.com
Wed Feb 28 17:16:15 CST 2007


Thank you very much.
This is very helpful.
So the mismatch in size only comes from MatLoad()?
I am actually not a big fan of loading the matrices
either. I used it just to do some test. There is no
need to change the implementation for me at all.

So can I say that if I am going to construct the same
Matrix in the code using MatCreateMPIAIJ() and if I do
the preallocation exactly, then I should see roughly
15MB of memory used? 

Thank you.

Shi

--- Barry Smith <bsmith at mcs.anl.gov> wrote:

> 
>   Shi,
> 
>     The current algorithm used to do a
> MatLoad_MPIAIJ requires 
> memory on each process of about TWICE the memory
> required just for
> the matrix. For example, if a matrix requires 40
> megabytes total,
> after it is completely loaded on 4 processes it will
> take about 
> 10 megabytes on each process, BUT during MatLoad
> each process will
> use 20 megabytes (10 for the final matrix and 10 for
> work space
> to receive message in). This is why the total is 29
> meg: 15meg for the final
> matrix and around 18meg for the MatLoad.
> 
>   Barry
> 
> We could work hard and reduce the amount of memory
> used during the
> load process if this is problem for you. We are not
> fans of loading
> huge matrices from files so generally this is not a
> problem.
> 
> 
> On Wed, 28 Feb 2007, Shi Jin wrote:
> 
> > Hi, 
> > I am curious how much extra memory PETSc allocates
> in
> > the background. Since my estimate of memory usage
> of
> > the code is much smaller than what I see when it
> runs.
> > So I did this simple test:
> > First I used PETSc to dump a matrix in binary
> format
> > into a file. The file has a size of 13MB. I assume
> > this should be the same size that is used to store
> the
> > matrix in memory. Then I wrote a simple code that
> does
> > nothing but to load this matrix from the file by
> > MatLoad(). However, I found that the code consumes
> > 29MB of memory (VIRT=29M from top) using single
> > process. 
> > This is confirmed by the -malloc_log option where
> it
> > says
> >  Maximum memory PetscMalloc()ed 29246912 maximum
> size
> > of entire process 0
> > I've attached the output of the code with detailed
> > malloc information.
> > Could you please explain to me about the 
> difference
> > of  over two time?
> > I don't want to criticize anything but need an
> clear
> > idea of how much memory is needed so that I know
> > whether there is a chance for me to reduce the
> memory
> > usage of my production code.
> > Thank you very much.
> > 
> > Shi
> > 
> > 
> >  
> >
>
____________________________________________________________________________________
> > Need a quick answer? Get one in minutes from
> people who know.
> > Ask your question on www.Answers.yahoo.com
> 
> 



 
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com




More information about the petsc-users mailing list