<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Thanks Jose, I will try this and will come back to this thread if I have any issue.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Besides, for EPSGetEigenpair, I guess each rank gets its portion of the eigenvector, and I need to put them together afterwards?</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Thanks,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Feng<br>
</div>
<div id="signature_bookmark"></div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> Jose E. Roman <jroman@dsic.upv.es><br>
<b>Sent:</b> 21 September 2022 12:34<br>
<b>To:</b> feng wang <snailsoar@hotmail.com><br>
<b>Cc:</b> Matthew Knepley <knepley@gmail.com>; petsc-users@mcs.anl.gov <petsc-users@mcs.anl.gov><br>
<b>Subject:</b> Re: [petsc-users] Slepc, shell matrix, parallel, halo exchange</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">If you define the MATOP_CREATE_VECS operation in your shell matrix so that it creates a ghost vector, then all vectors within EPS will be ghost vectors, including those that are received as arguments of MatMult(). Not sure if this will
 work.<br>
<br>
A simpler solution is that you store a ghost vector in the context of your shell matrix, and then in MatMult() you receive a regular parallel vector x, then update the ghost points using the auxiliary ghost vector, do the computation and store the result in
 the regular parallel vector y.<br>
<br>
Jose<br>
<br>
<br>
> El 21 sept 2022, a las 14:09, feng wang <snailsoar@hotmail.com> escribió:<br>
> <br>
> Thanks for your reply. <br>
> <br>
> For GMRES, I create a ghost vector and give it to KSPSolve. For Slepc, it only takes the shell matrix for EPSSetOperators. Suppose the shell matrix of the eigensolver defines MatMult(Mat m ,Vec x, Vec y), how does it know Vec x is  a ghost vector and how
 many ghost cells there are?<br>
> <br>
> Thanks,<br>
> Feng<br>
> From: Matthew Knepley <knepley@gmail.com><br>
> Sent: 21 September 2022 11:58<br>
> To: feng wang <snailsoar@hotmail.com><br>
> Cc: petsc-users@mcs.anl.gov <petsc-users@mcs.anl.gov><br>
> Subject: Re: [petsc-users] Slepc, shell matrix, parallel, halo exchange<br>
>  <br>
> On Wed, Sep 21, 2022 at 7:41 AM feng wang <snailsoar@hotmail.com> wrote:<br>
> Hello,<br>
> <br>
> I am using Slepc with a shell matrix. The sequential version seems working and now I am trying to make it run in parallel.<br>
> <br>
> The partition of the domain is done, I am not sure how to do the halo exchange in the shell matrix in Slepc. I have a parallel version of matrix-free GMRES in my code with Petsc. I was using VecCreateGhostBlock to create vector with ghost cells, and then
 used  VecGhostUpdateBegin/End for the halo exchange in the shell matrix, would this be the same for Slepc?<br>
> <br>
> That will be enough for the MatMult(). You would also have to use a SLEPc EPS that only needed MatMult().<br>
> <br>
>   Thanks,<br>
> <br>
>      Matt<br>
>  <br>
> Thanks,<br>
> Feng <br>
> <br>
> <br>
> <br>
> <br>
> -- <br>
> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
> -- Norbert Wiener<br>
> <br>
> <a href="https://www.cse.buffalo.edu/~knepley/" data-auth="NotApplicable">https://www.cse.buffalo.edu/~knepley/</a><br>
<br>
</div>
</span></font></div>
</body>
</html>