Hi Jose,
Sorry, it took me a while to test these settings in the new builds. I am getting good improvement in performance using the preconditioned solvers, so thanks for the suggestions! But I have some questions related to the usage.
We are using SLEPc to solve the acoustic modal eigenvalue problem. Attached is a simple standalone program that computes acoustic modes in a simple rectangular box. This program illustrates the general setup I am using, though here the shell matrix and the preconditioner matrix are the same, while in my actual program the shell matrix computes A*x without explicitly forming A, and the preconditioner is a 0th order approximation of A.
In the attached program I have tested both
1) the Krylov-Schur with inexact shift-and-invert (implemented under the option sinvert);
2) the JD solver with preconditioner (implemented under the option usejd)
Both the solvers seem to work decently, compared to no preconditioning. This is how I run the two solvers (for a mesh size of 1600x400):
$ ./acoustic_box_test.o -nx 1600 -ny 400 -usejd 1 -deflate 1 -eps_target 0
$ ./acoustic_box_test.o -nx 1600 -ny 400 -sinvert 1 -deflate 1 -eps_target 0
Both finish in about ~10 minutes on my system in serial. JD seems to be slightly faster and more accurate (for the imaginary part of eigenvalue).
The program also runs in parallel using mpiexec. I use complex builds, as in my main program the matrix can be complex.
Now here are my questions:
1) For this particular problem type, could you please check if these are the best settings that one could use? I have tried different combinations of KSP/PC types e.g. GMRES, GAMG, etc, but BCGSL + BJACOBI seems to work the best in serial and parallel.
2) When I tested these settings in my main program, for some reason the JD solver was not converging. After further testing, I found the issue was related to the setting of "-eps_target 0". I have included "EPSSetTarget(eps,0.0);" in the program and I assumed this is equivalent to passing "-eps_target 0" from the command line, but that doesn't seem to be the case. For instance, if I run the attached program without "-eps_target 0" in the command line then it doesn't converge.
$ ./acoustic_box_test.o -nx 1600 -ny 400 -usejd 1 -deflate 1 -eps_target 0
the above finishes in about 10 minutes
$ ./acoustic_box_test.o -nx 1600 -ny 400 -usejd 1 -deflate 1
the above doesn't converge even though "EPSSetTarget(eps,0.0);" is included in the code
This only seems to affect the JD solver, not the Krylov shift-and-invert (-sinvert 1) option. So is there any difference between passing "-eps_target 0" from the command line vs using "EPSSetTarget(eps,0.0);" in the code? I cannot pass any command line arguments in my actual program, so need to set everything internally.
3) Also, another minor related issue. While using the inexact shift-and-invert option, I was running into the following error:
""
Missing or incorrect user input
Shift-and-invert requires a target 'which' (see EPSSetWhichEigenpairs), for instance -st_type sinvert -eps_target 0 -eps_target_magnitude
""
I already have the below two lines in the code:
EPSSetWhichEigenpairs(eps,EPS_SMALLEST_MAGNITUDE);
EPSSetTarget(eps,0.0);
so shouldn't these be enough? If I comment out the first line "EPSSetWhichEigenpairs", then the code works fine.
I have some more questions regarding setting the preconditioner for a quadratic eigenvalue problem, which I will ask in a follow-up email.
Thanks for your help!
-Varun