[petsc-users] about VecScatter

Jed Brown jed at jedbrown.org
Sat May 10 23:22:04 CDT 2014


likunt at caltech.edu writes:

> Dear Petsc developers,
>
> I have a vector object M, I need all the elements of it in all the
> processors.
>
> Here is a part of my code
>
> //////////////////////////////////////////////////////////////
> Vec M;
> VecScatterCreateToAll(M,&scatter_ctx,&N);
> VecScatterBegin(scatter_ctx,M,N,INSERT_VALUES,SCATTER_FORWARD);
> VecScatterEnd(scatter_ctx,M,N,INSERT_VALUES,SCATTER_FORWARD);
>
> VecGetArray(N, &aM);
>
> for(i=xs; i<xs+xm; i++)

What are xs and xm in this setting.  What do you intend?

> {
>    //within the loop, requires all the elements of aM
> }
> ////////////////////////////////////////////////////////////
>
> but this seems not working well. 

The phrase "not working" should never appear unqualified in polite
conversation.  Send steps to reproduce, what you expect, and what you
observe.

> Would you please suggest a more efficient way? Thank you.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140510/80a83d1e/attachment.pgp>


More information about the petsc-users mailing list