Why does gmres command run for quite a long time?
이전 댓글 표시
Hi,
I solved a system
with gmres and preconditioners. It worked for several meshes and converged after 2 iteration steps for all A of dimensions up to
and only needed a few seconds to solve the system. Refining the mesh again yields A of size
. When I now try to solve the system, gmres needs 22 minutes and 2 iteration steps (instead of a few seconds). Does anyone have any ideas why gmres takes much longer for the finer mesh?
Thanks in advance!
댓글 수: 6
John D'Errico
2025년 11월 19일
편집: John D'Errico
2025년 11월 19일
Is A sparse? How sparse? Is A stored as a sparse matrix?
Harald
2025년 11월 19일
Hi,
have a look at the RAM usage on your machine.
If A is a double full matrix (i.e., not stored as sparse), it will require about 12.8 GB of memory (40000^2 * 8 bytes, to be precise). This may be pushing the limits of your machine to the extent that the system starts to swap, meaning hard disk space is used to extend RAM. This avoids out of memory errors but slows things down significantly.
Best wishes,
Harald
t=fsolve(@(t)(40/10)^2*t/60-22,30)
If the solution time were about 1 minute, it would be almost linearly scaled with problem size even without any disk swapping. Certainly doesn't seem unreasonable.
@Philip Johann, besides @John D'Errico query about sparseness, see how it changes if you take several intermediate mesh sizes and whether it at some point takes a quantum leap or is otherwise some power law relationship.
Philip Johann
2025년 11월 22일
John D'Errico
2025년 12월 29일
편집: John D'Errico
2025년 12월 29일
@Torsten I assume when @Philip Johann said lu was used, it could only have been an incomplete LU, used to build a preconditioner, because of the droptol comment.
A very low drop tolerance makes the incomplete LU nearly a complete LU. There is a tradeoff in this. As you make the ILU nearly complete (a droptol of zero should be effectively a complete LU) you will see a geat deal of fill-in, therefore using a great deal of memory. That may be just pushing the limits of your memory. A better preconditioner should make convergence better/faster, but if you are incurring serious memory problems, it matters little. Just trying to use/build that incomplete LU is probably the issue.
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Sparse Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!