[firedrake] disentangling solver setup costs
Lawrence Mitchell
lawrence.mitchell at imperial.ac.uk
Tue Apr 21 11:49:47 BST 2015
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 21/04/15 11:42, Eike Mueller wrote:
> Hi Lawrence,
>
> it looks like I’m setting up the same operator multiple times in
> my code, so this is very wasteful and explains why my setup costs
> are so high.
>
> Basically I need four assembled operators which describe the 2x2
> matrix of the velocity-pressure system in several parts of my
> code. What happens if I construct those centrally, but then use
> them in different parts of the code? For example, I might want to
> apply the UU,UP,PU and PP-operators when I apply the mixed system
> matrix in the outer loop of the iterative solver (and I would do
> this in my MixedOperator class). For this I would extract the
> handles with .M.handle as below. But somewhere else I need to solve
> for the velocity mass matrix (I would do this in the class
> Mutilde), so I would throw the same UU operator into a LinearSolver
> class. Would the operator be built multiple times in this case? Or
> can I call mat.M once, and this will then be the only time where
> the operator gets assembled? If that is the case, then I need some
> class which holds the UU,UP,PU and PP operators and then feed them
> to the other classes appropriately.
So you build UU, UP, PU, and PP separately?
Given they never change, I would assemble them up front and then just
use them as and where. If you always do (whereever you need it):
UU = assemble(...)
Then you will pay the cost multiple times.
If you build everything up front then calling mat.M a second time
doesn't reassemble (since now the promise to assemble is fulfilled)
and the operator is ready.
Lawrence
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQEcBAEBAgAGBQJVNitHAAoJECOc1kQ8PEYvrB8H/0SW4RYh7IEIsv2UjU9O6vyW
DEVlLdiHMJTmbgJu9kJ7N9/6LabdPqBOVr15AB/IpRbm3GD0BahOevCaFbI3Ck+r
7hyhgZyBAsZXzggI+cjXKPOTJtvmXrvCzM4uoK0EHbK496gKwoa4o8xc6JrUKt+5
7J6594g6PH6nudIzd51Gm6YRpF0ldPU6HvJ5Hg9EUuSV1R5mtlPvhM8BU9cxpB4N
Cq+BR0EnSvruL238nTvSHMyRitrqPe01eHFPby426xAzPFrcdy3WERLOO6GQXN1k
IVuGl1cFV5L8ylsocxOlv/6odNEJX7+06dvPqLizu+haSoqbMtb8t3k2Uqq1LOw=
=g9Oo
-----END PGP SIGNATURE-----
More information about the firedrake
mailing list