Reuse LU factorization with PETSc?

Asked by Nuno Lopes

Is it already possible to reuse the LU factorization via PETSc backend?
with
"
  LUSolver lu(A);
  lu.parameters["reuse_factorization"] = true;
  . . .
  lu.solve(x, b);
"

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Nuno Lopes
Solved:
Last query:
Last reply:
Revision history for this message
Garth Wells (garth-wells) said :
#1

On 16/07/10 18:52, Nuno Lopes wrote:
> New question #117976 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/117976
>
> Is it already possible to reuse the LU factorization via PETSc backend?
> with
> "
> LUSolver lu(A);
> lu.parameters["reuse_factorization"] = true;
> . . .
> lu.solve(x, b);
> "
>

Yes (in dolfin-dev).

Garth

Revision history for this message
Nuno Lopes (ndlopes) said :
#2

Tried it with the advection-diffusion demo but get the same timings .
It should be faster with
lu.parameters["reuse_factorization"] = true;

Revision history for this message
Garth Wells (garth-wells) said :
#3

On 16/07/10 19:23, Nuno Lopes wrote:
> Question #117976 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/117976
>
> Nuno Lopes posted a new comment:
> Tried it with the advection-diffusion demo but get the same timings .
> It should be faster with
> lu.parameters["reuse_factorization"] = true;
>

It's much faster for me. Make sure that you comment out

     file << std::make_pair(&u, t);

when testing. File output dominates the timing.

Garth

Revision history for this message
Nuno Lopes (ndlopes) said :
#4

humm...nope
File output is commented out in the demo.

uBLAS with factorization is much faster
Can't notice any difference with PETSc backend.

I'm looking to the cpp version of the demo and I'm using dolfin-dev revision 4844 (from yesterday).

Revision history for this message
Garth Wells (garth-wells) said :
#5

On 16/07/10 20:00, Nuno Lopes wrote:
> Question #117976 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/117976
>
> Nuno Lopes posted a new comment:
> humm...nope
> File output is commented out in the demo.
>
> uBLAS with factorization is much faster
> Can't notice any difference with PETSc backend.
>
> I'm looking to the cpp version of the demo and I'm using dolfin-dev
> revision 4844 (from yesterday).
>

Get the latest dolfin, and make sure that you have PETSc configured with
UMFPACK.

Garth

Revision history for this message
Nuno Lopes (ndlopes) said :
#6

No luke for me.
Updated dolfin but still the same results.

Is it suppose to have some different outputs from the solver?
In the uBLAS interface there is an output for the factorizing step.

I just get
'Solving linear system of size 2868 x 2868 (PETSc LU solver, umfpack)'
No factorization output anywhere.

Revision history for this message
Garth Wells (garth-wells) said :
#7

On 16/07/10 22:27, Nuno Lopes wrote:
> Question #117976 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/117976
>
> Nuno Lopes posted a new comment:
> No luke for me.
> Updated dolfin but still the same results.
>
> Is it suppose to have some different outputs from the solver?
> In the uBLAS interface there is an output for the factorizing step.
>

No. PETSc takes care of re-using the factorization, so we can't easily
get output when the factorization is being performed.

Garth

> I just get
> 'Solving linear system of size 2868 x 2868 (PETSc LU solver, umfpack)'
> No factorization output anywhere.
>

Revision history for this message
Nuno Lopes (ndlopes) said :
#8

Still no luke.
Updated dolfin again, and tried with Epetra.
The same timing and output for Epetra with
lu.parameters["reuse_factorization"] = true or false;

Nuno

Revision history for this message
Garth Wells (garth-wells) said :
#9

On 17/07/10 17:11, Nuno Lopes wrote:
> Question #117976 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/117976
>
> Nuno Lopes posted a new comment:
> Still no luke.
> Updated dolfin again, and tried with Epetra.
> The same timing and output for Epetra with
> lu.parameters["reuse_factorization"] = true or false;
>

I'm still working on EpetraLUSolver. It doesn't yet re-use the
factorisation.

Garth

> Nuno
>

Revision history for this message
Nuno Lopes (ndlopes) said :
#10

"This Solved my Problem" :)