Skip to content

A module to benchmark various solver/preconditioner combinations in FEniCS/DOLFIN

Notifications You must be signed in to change notification settings

funsim/DOLFIN_benchmark

Repository files navigation

Table of Contents

What is DOLFIN_benchmark

DOLFIN_benchmark allows to automatically benchmark various solver/preconditioner options in the Python interface to FEniCS/DOLFIN.

It works by overwritting the dolfin.solver and solving the same problem with various different solvers/preconditioners. The resulting timings are then sorted and the result is reported. A typical benchmark report looks like this:

    ***********************************************
    ********** Solver benchmark results: **********
    ***********************************************
    cg, amg: 0.98 s
    cg, hypre_amg: 0.98 s
    gmres, amg: 0.99 s
    tfqmr, amg: 1.00 s
    .
    .
    .
    gmres, icc: 13.23 s
    gmres, sor: 14.21 s
    gmres, hypre_parasails: 16.72 s
    gmres, jacobi: 37.94 s
    richardson, sor: 42.80 s
    richardson, default: diverged
    richardson, hypre_parasails: diverged
    minres, hypre_parasails: diverged
    tfqmr, icc: diverged

Usage

Copy the file "solver_benchmark.py" in your project directory and import the module in your solver file with:

 from solver_benchmark import *

To run benchmark one of your "solve" calls, simply change

 solve(...) 

to

 solve(..., benchmark = True)

The result of the benchmark will be written to STDOUT.

Sometimes you will see error messages like:

 PETSC ERROR: Unable to find requested PC type ml!

In that case, it is best to exclude this solver/preconditioner manually, see the section.

Exclude a solver/preconditioner

Solvers can be excluded from the benchmark with the optional solver_exclude and preconditioner arguments, e.g.

 solve(..., benchmark = True, solver_exclude = ['lu', 'cg'], preconditioner_exclude = ['ilu'])

Examples

Run demo_poisson.py or demo_navier-stokes.py to see an example.

Known bugs and limitations

Adaptive solves, i.e solve calls that use the 'tol' argument, are currently not supported. But there is no reason why not, see the "How to contribute section.

How to contribute

Fork the project, make your changes and request a merge. Simple.

About

A module to benchmark various solver/preconditioner combinations in FEniCS/DOLFIN

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages