Hi,

please consider the attached script. Following this <https://bitbucket.org/fenics-project/dolfin/pull-request/2/use-cholesky-rather-than-lu-decomposition/diff#chg-dolfin/fem/LinearVariationalSolver.cpp> discussion, if method is mumps, petsc or pastix and we have symmetric=True the linear system is solved with Cholesky factorization (it this so?). While testing different method/symmetry combinations I noticed that PETSc's own symmetric solver is easily 10 times slower then mumps (I don't have pastix to compare against). Can anyone else reproduce
this? Thanks.

Regards, Miro
from dolfin import *

method = 'mumps'
symmetric = False

for N in (320, 384, 448, 512):
    mesh = UnitSquareMesh(N, N)

    V = FunctionSpace(mesh, 'CG', 1)
    u = TrialFunction(V)
    v = TestFunction(V)
    
    a = inner(grad(u), grad(v))*dx
    L = inner(Constant(2), v)*dx
    u = Function(V)
    bc = DirichletBC(V, Constant(0), DomainBoundary())
    
    A, b = PETScMatrix(), PETScVector()
    assemble_system(a, L, bc, A_tensor=A, b_tensor=b)
    U = Function(V).vector()
    solver = PETScLUSolver(A, method)
    solver.parameters['symmetric'] = symmetric
    # 
    timer = Timer('solver')
    timer.start()
    solver.solve(U, b)
    print timer.stop()

# MUMPS symmetric < MUMPS not-symmetric < PETSc not-symmetic << PETSc symmetric
# 1.17892622948 1.76611208916 2.52074193954 3.348279953
# 1.27664494514 1.93275213242 2.79323792458 3.74768614769
# 1.33259105682 2.27041697502 3.53542280197 5.21441793442
# 23.6192109585 too long
_______________________________________________
fenics mailing list
[email protected]
http://fenicsproject.org/mailman/listinfo/fenics

Reply via email to