[petsc-users] How to use PETSc4py/SLEPc4py to solve an eigenvalue problem in parallel

Jose E. Roman jroman at dsic.upv.es
Sun Oct 26 12:21:59 CDT 2014


El 26/10/2014, a las 17:10, Mengqi Zhang escribió:

> Dear all PETSc users,
> 
> I'm new to PETSc/SLEPc. And I'm currently trying to use Python/PETSc4py/SLEPc4py to solve a big generalized eigenvalue problem, A x = B lambda x.
> 
> After several days' digging and trying, I can write a script for solving a smaller eigenvalue problem locally, but when the problem size increases, I realize I should go parallel. My question is how to do it in parallel? How could I preallocate the matrices among the processors? I presume there should be a way to do that, but I couldn't find a clear guide on the Internet. 
> 
> Currently, the matrices are implemented locally, and then I use
> 
> E = SLEPc.EPS(); E.create()
> 
> E.setOperators(A,B)
> 
> E.setProblemType(SLEPc.EPS.ProblemType.GNHEP)
> 
> E.setFromOptions()
> 
> to locally solve the eigenvalue problem. 
> 
> 
> 
> Could you help me and guide me to set the code up?  Any suggestion is welcomed and appreciated. Thank you very much.
> 
> 
> 
> Best regards,
> 
> Mengqi
> 

You may want to do A.setPreallocationNNZ(5) or something like that.
Also, take into account that in generalized eigenproblems you will probably want to use a parallel linear solver, see discussion in section 3.4.1 of SLEPc's users guide.

Jose




More information about the petsc-users mailing list