Optimization of Laplacea Equation Solver

41 views
Skip to first unread message

Oleg Kmechak

unread,
Dec 5, 2019, 9:10:19 AM12/5/19
to deal.II User Group
Dear All, 

I am working on RiverSIM program(https://github.com/okmechak/RiverSim/

This program solves laplace equation on river network geometry, 
then makes some computaion(integration over these dence points on picture and other processing) which result in river network evolution step by step.

test.jpg


Program is quite big, but all Deal.II dependencies are encapsulated into Solver class(https://github.com/okmechak/RiverSim/blob/master/source/river/solver.hpp)

which is adaptation of step-6 from tutorials(https://www.dealii.org/current/doxygen/deal.II/step_6.html)


It works very well, but I need as much perfomance as it is possible :) 


Mesh, as you can see, is very irregular and very dence at some points(see picture above).

On my laptop i5 from wsl(windows subsystem for linux) it takes ~8-10 seconds on DoF with 250,000 degrees(65,000 active cells)

And on cluster with 40 processors even longer - 10-13 seconds


Also is the solver already(by default) multithread or I should somehow configure the Deal.II?


Regards,
Oleg Kmecahk


Bruno Turcksin

unread,
Dec 5, 2019, 11:15:11 AM12/5/19
to deal.II User Group
Oleg,

The first thing to do if you want to speed up you code is to profile your code. How do you know which part of the code is slow? Right now, it sounds that you are assuming that it is in the solver which may be true but it may not be. If you want to speed up your solver, you can 1) get a better preconditioner (maybe using algebraic multigrid) 2) make you code parallel. deal.II is multithreaded by default but not every operation is. On top of that multithreading does not work if the processors need to communicate through the network (which might be the case on the cluster you are testing). In that case, you will need to use MPI. Take a look at step-40 It solves the Laplace equation with 52 millions DoFs in less than 10 seconds on 4000 processors.

Best

Bruno

Oleg Kmechak

unread,
Dec 6, 2019, 8:21:21 AM12/6/19
to deal.II User Group

The first thing to do if you want to speed up you code is to profile your code. How do you know which part of the code is slow?
 
Thank you for this advice, it is a good point to look forward. 
Till this moment I was looking on console log to understand perfomance.
 
In that case, you will need to use MPI.

So I still have to use MPI to make program multihread, even if it is a single machine, with 40 processors inside? 
Maybe it is rough understanding, but I always thought that for multicomputer processing is used MPI and for multiprocessor(on single machine) - OpenMP(Which is embedded in deal.ii as far as I know).

Regards,
Oleg

Bruno Turcksin

unread,
Dec 6, 2019, 8:48:24 AM12/6/19
to dea...@googlegroups.com
Oleg,

Le ven. 6 déc. 2019 à 08:21, Oleg Kmechak <ofcra...@gmail.com> a écrit :
> So I still have to use MPI to make program multihread, even if it is a single machine, with 40 processors inside?
> Maybe it is rough understanding, but I always thought that for multicomputer processing is used MPI and for multiprocessor(on single machine) - OpenMP(Which is embedded in deal.ii as far as I know).
MPI and multithreading are different things. I am not sure what you
mean by multicomputer but you need to use MPI if you have more than
one node. You can use multithreading if all the processors are on the
same motherboard (there are exception to this though). deal.II does
not use OpenMP for multithreading instead it uses TBB but it doesn't
really matter. Also while many operations are multithreaded in deal.II
not all of them are, so if you really want to use all the processors,
you will need to use MPI.

Best,

Bruno

Oleg Kmechak

unread,
Dec 6, 2019, 8:58:16 AM12/6/19
to deal.II User Group
Thank You clarification

Oleg Kmechak

unread,
Dec 10, 2019, 9:16:40 PM12/10/19
to deal.II User Group
Can You describe please, why algebraic multigrid algorithm may be better in this situation? Is it somehow opitmal for Laplacea equation or to my irregular mesh?

Wolfgang Bangerth

unread,
Dec 11, 2019, 9:56:35 AM12/11/19
to dea...@googlegroups.com
On 12/10/19 7:16 PM, Oleg Kmechak wrote:
> Can You describe please, why algebraic multigrid algorithm may be better in
> this situation? Is it somehow opitmal for Laplacea equation or to my irregular
> mesh?

That's a long of difficult question -- there's a reason why I recorded four
video lectures on preconditioning :-) But in short, yes, the algebraic
multigrid method is one of very few algorithms that we know is optimal for the
Laplace equation. That is, at least, true for the cases where your problem
becomes large -- several hundred thousand or millions of unknowns. For small
problems, a direct solver is probably faster.

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

Oleg Kmechak

unread,
Dec 15, 2019, 10:14:33 PM12/15/19
to deal.II User Group
Thank You for answer!

With best, 
Oleg
Reply all
Reply to author
Forward
0 new messages