[petsc-users] Starting vector

Jose E. Roman jroman at dsic.upv.es
Mon Jul 20 08:46:52 CDT 2015

El 20/7/2015, a las 14:54, Marc-André Dubois <ma.dubois at me.com> escribió:

> 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,
> Marc

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.

The EPSSetInitialSpace() operation will take some time because you are providing a lot of vectors and these must be orthogonalized internally.

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.

On the other hand, you are setting ncv=n which is not the intended usage of SLEPc solvers.


More information about the petsc-users mailing list