This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Performance information from LinearVariationalSolver?

+1 vote

Hi Everyone, I'm using LinearVariationalSolver for an elliptic problem in the usual way in a C++ project. Is it possible to get information about what the solver did after solver.solve() is called? In particular the number of Krylov iterations and say the residual at each iteration?

Looking at LinearVariationalSolver.cpp it seems like this is not possible since the instance of KrylovSolver there is deleted after the solution is obtained but I wanted to make sure.

Btw, one option is to parse the log file that FEniCS writes but if you run in parallel this is not possible because all the processes write to the file simultaneously and it is pretty garbled as a result. So in parallel I have the log output turned off.

Thanks,
Dave

asked Aug 1, 2015 by david.bernstein FEniCS User (2,000 points)

1 Answer

0 votes
 
Best answer

Hello David,

I had the same problem but since I only work on one processor, I managed to parse the input file.

While looking for a solution, I found out about the PETScKrylovSolver class.

http://fenicsproject.org/documentation/dolfin/1.6.0/cpp/programmers-reference/la/PETScKrylovSolver.html#PETScKrylovSolver::solve__GenericVectorR.GenericVectorCR

according to the docs, the solve method returns the number of iterations. I have not tried it out, however, and also I work with python but maybe the docs and the code for this class can help you out.

best regards

answered Aug 4, 2015 by multigrid202 FEniCS User (3,780 points)
selected Aug 4, 2015 by david.bernstein

Thanks, Yes I think my best bet is to assemble and solve the linear system by hand rather than use LinearVariationalSolver. It's not clear to me that LinearVariationalSolver should return this kind of detailed information anyway since there are so many solver parameters.

...