<html><body><div>How can you know what ncv value to set? </div><div><br>Le 20 juillet 2015 à 11:39, "Jose E. Roman" <jroman@dsic.upv.es> a écrit :<br><br></div><div><blockquote type="cite"><div class="msg-quote"><div class="_stretch"><span class="body-text-content"><span class="body-text-content">[Please reply to the list.]<br><br>If you set ncv=n then the computation time will not change, as you are essentially computing all eigenvalues. As I said before, this is not the purpose of SLEPc.<br><br>If you set for instance n=4000, ncv=32, nev=1 then yes you should see an improvement of convergence in the second solve (in fact, it should converge immediately if the initial vector is actually an eigenvector).<br><br>In the case of nconv=1, EPSGetInvariantSubspace() will return the same vector as EPSGetEigenpairs(eps,0), so both can be used.<br><br>Jose<br><br><br>El 20/7/2015, a las 16:37, Marc-André Dubois <<a href="mailto:ma.dubois@me.com" data-mce-href="mailto:ma.dubois@me.com">ma.dubois@me.com</a>> escribió:<br><br></span></span><blockquote class="quoted-plain-text" type="cite">Hi Jose,</blockquote><blockquote class="quoted-plain-text" type="cite">Thank you for your fast reply. So if I take my previous code and change the size of the subspace to 1, should I see an increase of performance? Does the EPSGetInvariantSubspace() is a good method to retreive an initial vector for this method?</blockquote><blockquote class="quoted-plain-text" type="cite"><br></blockquote><blockquote class="quoted-plain-text" type="cite">Thank you,</blockquote><blockquote class="quoted-plain-text" type="cite"><br></blockquote><blockquote class="quoted-plain-text" type="cite">Marc</blockquote><blockquote class="quoted-plain-text" type="cite"><br></blockquote><blockquote class="quoted-plain-text" type="cite">Le 20 juillet 2015 à 09:47, "Jose E. Roman" <<a href="mailto:jroman@dsic.upv.es" data-mce-href="mailto:jroman@dsic.upv.es">jroman@dsic.upv.es</a>> a écrit :</blockquote><blockquote class="quoted-plain-text" type="cite"><br></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">El 20/7/2015, a las 14:54, Marc-André Dubois <<a href="mailto:ma.dubois@me.com" data-mce-href="mailto:ma.dubois@me.com">ma.dubois@me.com</a>> escribió:</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"><br></blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">Hi all, I am currently developing a code in C++ and I try to use SLEPC in conjunction with PETSC to solve an eigenvalue problem. Considering I have a set of similar matrices, my strategy was to solve one problem, and then reuse the starting vector to accelerate the resolution of the next problems. I tested this strategy with a rudimentary code to validate the process, but it does not seems to work. I am afraid I do not fully understand some of the particularities of SLEPC or PETSC. The main.cpp fille of my code goes like this: (see at the bottom of this message). You can see that I create a matrix (A) and two eigensolver contexts (eps and eps2). First a try to solve the problem using eps. I then recall the invariant subspace and use it as a starting vector in eps2. This code seems to work, but eps2 takes systematically more time to converge than eps. Is there something wrong with this code or my understanding of how SLEPC/PETSC works? Thank you,</blockquote></blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"><br></blockquote></blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">Marc</blockquote></blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"><br></blockquote></blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"><br></blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">Currently, Krylov solvers in SLEPc are single-vector iterations. This means that the projection subspace is built from a single vector. If you pass several initial vectors, the Krylov-Schur solver will only use the first one and discard the rest. Other solvers (non-Krylov) may be able to use all initial vectors.</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"><br></blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">The EPSSetInitialSpace() operation will take some time because you are providing a lot of vectors and these must be orthogonalized internally.</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"><br></blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">If you comment out EPSSetInitialSpace() then the two solves should take essentially the same time. Make sure you use an optimized built when analyzing performance, never measure execution times with a debug build.</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"><br></blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">On the other hand, you are setting ncv=n which is not the intended usage of SLEPc solvers.</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"><br></blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite">Jose</blockquote></blockquote><blockquote class="quoted-plain-text" type="cite"><blockquote class="quoted-plain-text" type="cite"><br></blockquote></blockquote></div></div></blockquote></div></body></html>