[petsc-users] About efficiency in MatAssembling

Matthew Knepley petsc-maint at mcs.anl.gov
Tue Nov 8 07:58:32 CST 2011


On Tue, Nov 8, 2011 at 1:49 PM, PEREZ CERQUERA MANUEL RICARDO <
manuel.perezcerquera at polito.it> wrote:

> Hi all,
>
> I'm having problems with the efficiency of my code, I mean, it's taken so
> much time when  I'm running in 2 processors than in 1 Processor. My guess
> is that the communications at low level inside PETSC Directives, because
> I'm generating the elements on wrong processes and this is killing me,
> moreover I'm over estimated my memory occupancy,  so my questions are:
>

Please send the output of -log_summary with all performance questions.


> 1. For The Memory Occupancy , I Know the NonZero Pattern of my Matrix, so
> I'm calling
>    CALL MatCreateMPIAIJ(PETSC_COMM_**WORLD,LocalNOfBEMFunctions,**
> LocalTotalRank,**NOfTotalBEMFunctions,**GlobalTotalRank,&
>                                        PETSC_NULL_INTEGER,NNZ_**
> diagonal(:),&
>                                        PETSC_NULL_INTEGER,NNZ_**
> outofdiagonal(:),UFar,ierr)
>   So I have a doubt if when I'm doing this Should I specify just one
> NNZ_diagonal(:) or  NNZ_outofdiagonal(:) ?, not both of them as I'm doing.
>

Use MatSetOption(MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_TRUE) to make sure
you are not causing mallocs.


> 2. For the time efficiency, When I'm calling, MatSetValues() The Global
> Index is out of the range set in MatCreateMPIAIJ, I mean for example if the
> range is between 1 and 10 in a Matrix of 100 The Global index are let's say
> 1 20 25 2 5 60 85 90 100 3 so there are some elements out of the range,
> moreover I ran with -info option and I got this:
> [0] MatAssemblyBegin_MPIAIJ(): Stash has 84088 entries, uses 3 mallocs.
> And in the manual is written this actually means I'm generating entries in
> the wrong process,not because of the mollocs but because of the entries, Do
> I'm right ?
>

You are sending a lot of values. I would reorganize my code to compute the
values on the owner.

   Matt


>  So is this indeed not efficient?. If not, Can you suggest me a possible
> way to improve it? , Or there are some special way for indexing the
> elements in order to put them in order to solve the system?
>
> Thanks!
>
> Manuel.
>
>
>
>  I realized with -info option in run time
>
>
>
>
>
> Eng. Manuel Ricardo Perez Cerquera. MSc. Ph.D student
> Antenna and EMC Lab (LACE)
> Istituto Superiore Mario Boella (ISMB)
> Politecnico di Torino
> Via Pier Carlo Boggio 61, Torino 10138, Italy
> Email: manuel.perezcerquera at polito.it
> Phone: +39 0112276704
> Fax: +39 011 2276 299
>



-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111108/0b1d6904/attachment-0001.htm>


More information about the petsc-users mailing list