[petsc-users] Starting vector
Jose E. Roman
jroman at dsic.upv.es
Mon Jul 20 11:47:12 CDT 2015
You can just let SLEPc set it for you, pass PETSC_DEFAULT in the argument. The same for the mpd parameter.
Jose
El 20/7/2015, a las 18:45, Marc-André Dubois <ma.dubois at me.com> escribió:
> How can you know what ncv value to set?
>
> Le 20 juillet 2015 à 11:39, "Jose E. Roman" <jroman at dsic.upv.es> a écrit :
>
>> [Please reply to the list.]
>>
>> 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.
>>
>> 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).
>>
>> In the case of nconv=1, EPSGetInvariantSubspace() will return the same vector as EPSGetEigenpairs(eps,0), so both can be used.
>>
>> Jose
>>
>>
>> El 20/7/2015, a las 16:37, Marc-André Dubois <ma.dubois at me.com> escribió:
>>
>>> Hi Jose,
>>> 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?
>>>
>>> Thank you,
>>>
>>> Marc
>>>
>>> Le 20 juillet 2015 à 09:47, "Jose E. Roman" <jroman at dsic.upv.es> a écrit :
>>>
>>>> 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.
>>>>
>>>> Jose
>>>>
More information about the petsc-users
mailing list