<div dir="ltr"><div><div>Thanks for your suggestion Barry.<br><br></div>Regards,<br></div>Bikash<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 1, 2015 at 9:04 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
  This is a pretty different thing. DMGetLocalVector(da,localX,ierr) gives a vector back with the correct amount of space for local ghosts and if you use DMDA it this the correct way to go. VecCreateGhost() creates a special vector that actually stores both the ghosted and nonghosted values in overlapping regions, but is totally inappropriate for DMDA.<br>
<span class="HOEnZb"><font color="#888888"><br>
  Barry<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
> On Dec 1, 2015, at 7:56 PM, Timothée Nicolas <<a href="mailto:timothee.nicolas@gmail.com">timothee.nicolas@gmail.com</a>> wrote:<br>
><br>
> Btw,<br>
><br>
> If the vector X is created via a DMDA, then the vector localX and the pointer lx obtained via<br>
><br>
> call DMGetLocalVector(da,localX,ierr)<br>
> call DMGlobalToLocalBegin(da,X,INSERT_VALUES,localX,ierr)<br>
> call DMGlobalToLocalEnd(da,X,INSERT_VALUES,localX,ierr)<br>
> call VecGetArrayReadF90(localX,lx,ierr)<br>
><br>
> are automatically ghosted, right ?<br>
><br>
> Thx<br>
><br>
> Timothee<br>
><br>
><br>
> 2015-12-02 10:00 GMT+09:00 Barry Smith <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>>:<br>
><br>
>   Sorry, I could not control myself.<br>
><br>
>   So long as you pass vectors created with VecCreateGhost() to KSPSolve() the vectors passed to the multiply inside the solver will also be ghosted vectors.<br>
><br>
>    Send all output messages etc if it doesn't work for you<br>
><br>
>   Barry<br>
><br>
><br>
><br>
> > On Dec 1, 2015, at 6:47 PM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br>
> ><br>
> ><br>
> >> On Dec 1, 2015, at 5:18 PM, Bikash Kanungo <<a href="mailto:bikash@umich.edu">bikash@umich.edu</a>> wrote:<br>
> >><br>
> >> Hi,<br>
> >><br>
> >> I want to implement a matrix-free KSP solve using user-defined MATOP_MULT and MATOP_MULT_TRANSPOSE. Each of these user-defined functions take in  Mat A, Vec x and Vec y as arguments and store A*x in y. To perform A*x in the user defined fashion, each processor requires access to some non-local nodes of x. So, is there a way I can create these two vectors (x and y) using VecCreateGhost?<br>
> ><br>
> >   Yes, use VecCreateGhost().<br>
> ><br>
> >   Barry<br>
> ><br>
> ><br>
> >><br>
> >> Thanks,<br>
> >> Bikash<br>
> >><br>
> >> --<br>
> >> Bikash S. Kanungo<br>
> >> PhD Student<br>
> >> Computational Materials Physics Group<br>
> >> Mechanical Engineering<br>
> >> University of Michigan<br>
> >><br>
> ><br>
><br>
><br>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div><div><div><div><font color="#666666">Bikash S. Kanungo<br></font></div><font color="#666666">PhD Student<br></font></div><font color="#666666">Computational Materials Physics Group<br></font></div><font color="#666666">Mechanical Engineering <br></font></div><font color="#666666">University of Michigan<br><br></font></div></div>
</div>