[petsc-users] Optimization time parallel version of structural solver

Matthew Knepley knepley at gmail.com
Tue May 9 11:11:24 CDT 2017


On Tue, May 9, 2017 at 11:04 AM, "Leidy Catherine Ramirez Villalba" <
leidy-catherine.ramirez-villalba at ec-nantes.fr> wrote:

> Dear PETSc team,
>
> I'm currently working on the parallelization of the assembling of a
> system, previously assembled in a serial way (manual), but  solved using
> PETSc in parallel.
> The problem I have is that when comparing computational time with the
> previous implementation, it seem that the parallel version is slower than
> the serial one.
>
> The type of matrices we deal with are sparse and might change their size
> in a significant order (kind of contact problems, where relations between
> elements change).
> For the example I'm using, for giving an example, the initial size of the
> matrix is : 139905, after several iteratinos it changes to: 141501 and
> finally to: 254172.
>
> The system is assembled and solved at each iteration and the matrix can
> not be re-used, therefore for each new iteration the matrix is set to zero
> keeping the previous non-zero pattern, and the option
> 'MAT_NEW_NONZERO_LOCATIONS' is set to 'TRUE'.
> In order to do the assembling I use the function 'MatSetValues' ,
> inserting 3 lines and 3 rows, which might not be next to each other, and
> thus might no constitute a block.
>
> I believe that, what makes an important difference in time is the fact of
> adding almost the double of elements (from 139905 to  254172), but i don't
> know how what could I implement to retain a larger preallocation or to
> solve in any other way.
> I don't know, neither, in advance the position of new elements so that I
> can think in placing zeros to, maybe, generate a pre-pattern.
>

1) Conceivably, the difference in parallel might be that you are setting
elements owned by other processes. However for all performance questions,
we need to
    see the output of -log_view

2) Certainly inserting new elements is slow because reallocating the matrix
is slow. It would be faster to

  a) Throw away the first matrix
  b) Count all nonzeros in the second matrix
  c) Set preallocation for the second matrix
  d) Fill in the second matrix

  Thanks,

     Matt


> Do you have any idea of how could I improve the time of the parallel
> version?
>
> Thanks in advance!
>
> Regards,
> Catherine
>
>
>


-- 
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/20170509/f522f18a/attachment.html>


More information about the petsc-users mailing list