On Thu, Feb 17, 2011 at 11:18 AM, Ethan Coon <span dir="ltr">&lt;<a href="mailto:ecoon@lanl.gov">ecoon@lanl.gov</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Thu, 2011-02-17 at 10:35 -0600, Matthew Knepley wrote:<br>
&gt; On Thu, Feb 17, 2011 at 10:06 AM, Ethan Coon &lt;<a href="mailto:ecoon@lanl.gov">ecoon@lanl.gov</a>&gt; wrote:<br>
&gt;         So I thought I understood how VecScatters worked, but<br>
&gt;         apparently not.<br>
&gt;         Is it possible to create a general VecScatter from an<br>
&gt;         arbitrarily<br>
&gt;         partitioned (MPI) Vec to another arbitrarily partitioned (MPI)<br>
&gt;         Vec with<br>
&gt;         the same global sizes (or same global IS sizes) but different<br>
&gt;         local<br>
&gt;         sizes?  Shouldn&#39;t this just be a matter of relying upon the<br>
&gt;         implied<br>
&gt;         LocalToGlobalMapping?<br>
&gt;<br>
&gt;<br>
&gt; No, the way you have to do this is to map a global Vec to a bunch of<br>
&gt; sequential local Vecs with the sizes you want. This is also how we map<br>
&gt; to overlapping arrays.<br>
&gt;<br>
<br>
</div>So effectively I need two scatters -- a scatter from the global Vec to<br>
the sequential local Vecs, then a scatter (which requires no<br>
communication) to inject the sequential Vecs into the new global Vec?<br></blockquote><div><br></div><div>No, just wrap up the pieces of your global Vec as local Vecs and scatter</div><div>straight into that storage using VecCreateSeqWithArray().</div>
<div><br></div><div>   Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Why?  Am I missing something that makes the MPI to MPI scatter ill-posed<br>
as long as the global sizes (but not local sizes) are equal?<br>
<br>
This is mostly curiosity on my part... I think I have to do two scatters<br>
anyway since I&#39;m working with multiple comms -- scatter from an MPI Vec<br>
on one sub-comm into local, sequential Vecs, then scatter those<br>
sequential Vecs into an MPI Vec on PETSC_COMM_WORLD. That&#39;s the correct<br>
model for injecting an MPI Vec on one comm into an MPI Vec on<br>
PETSC_COMM_WORLD, correct?<br>
<font color="#888888"><br>
Ethan<br>
</font><div><div></div><div class="h5"><br>
&gt;<br>
&gt;    Matt<br>
&gt;<br>
&gt;         See below snippet (and its errors):<br>
&gt;<br>
&gt;         Ethan<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;         Vec vA<br>
&gt;         Vec vB<br>
&gt;         VecScatter scatter_AB<br>
&gt;<br>
&gt;         PetscInt np<br>
&gt;         PetscInt rank<br>
&gt;         PetscErrorCode ierr<br>
&gt;<br>
&gt;         if (rank.eq.0) np = 3<br>
&gt;         if (rank.eq.1) np = 1<br>
&gt;<br>
&gt;         call VecCreateMPI(PETSC_COMM_WORLD, 2, PETSC_DETERMINE, vA,<br>
&gt;         ierr)<br>
&gt;         call VecCreateMPI(PETSC_COMM_WORLD, np, PETSC_DETERMINE, vB,<br>
&gt;         ierr)<br>
&gt;<br>
&gt;         call VecScatterCreate(vA, PETSC_NULL_OBJECT, vB,<br>
&gt;         PETSC_NULL_OBJECT,<br>
&gt;                scatter_AB, ierr)<br>
&gt;<br>
&gt;         ...<br>
&gt;<br>
&gt;         $&gt; mpiexec -n 2 ./test<br>
&gt;<br>
&gt;         [0]PETSC ERROR: --------------------- Error Message<br>
&gt;         ------------------------------------<br>
&gt;         [0]PETSC ERROR: Nonconforming object sizes!<br>
&gt;         [0]PETSC ERROR: Local scatter sizes don&#39;t match!<br>
&gt;         [0]PETSC ERROR:<br>
&gt;         ------------------------------------------------------------------------<br>
&gt;         [1]PETSC ERROR: --------------------- Error Message<br>
&gt;         ------------------------------------<br>
&gt;         [1]PETSC ERROR: Nonconforming object sizes!<br>
&gt;         [1]PETSC ERROR: Local scatter sizes don&#39;t match!<br>
&gt;         [0]PETSC ERROR: Petsc Development HG revision:<br>
&gt;         5dbe1264252fb9cb5d8e033d620d18f7b0e9111f  HG Date: Fri Feb 11<br>
&gt;         15:44:04<br>
&gt;         2011 -0600<br>
&gt;         [0]PETSC ERROR: See docs/changes/index.html for recent<br>
&gt;         updates.<br>
&gt;         [0]PETSC ERROR: See docs/faq.html for hints about trouble<br>
&gt;         shooting.<br>
&gt;         [0]PETSC ERROR: See docs/index.html for manual pages.<br>
&gt;         [0]PETSC ERROR:<br>
&gt;         ------------------------------------------------------------------------<br>
&gt;         [0]PETSC ERROR: ./test on a linux-gnu named tama1 by ecoon Thu<br>
&gt;         Feb 17<br>
&gt;         08:14:57 2011<br>
&gt;         [0]PETSC ERROR: Libraries linked<br>
&gt;         from /packages/petsc/petsc-dev3.0-mpich2-local-gcc-4.3.3/debug-shared/lib<br>
&gt;         [0]PETSC ERROR: Configure run at Fri Feb 11 16:15:14 2011<br>
&gt;         [0]PETSC ERROR: Configure options --with-debugging=1<br>
&gt;         --prefix=/packages/petsc/petsc-dev3.0-mpich2-local-gcc-4.3.3/debug-shared --download-mpich=1 --download-ml=1 --download-umfpack=1 --with-blas-lapack-dir=/usr/lib --download-parmetis=yes PETSC_ARCH=linux-gnu-c-debug-shared --with-clanguage=c --download-hypre=1 --with-shared-libraries=1 --download-hdf5=1<br>

&gt;         [0]PETSC ERROR:<br>
&gt;         ------------------------------------------------------------------------<br>
&gt;         [0]PETSC ERROR: VecScatterCreate() line 1432 in<br>
&gt;         src/vec/vec/utils/vscat.c<br>
&gt;         application called MPI_Abort(MPI_COMM_WORLD, 60) - process 0<br>
&gt;         [cli_0]: aborting job:<br>
&gt;         application called MPI_Abort(MPI_COMM_WORLD, 60) - process 0<br>
&gt;         [1]PETSC ERROR: APPLICATION TERMINATED WITH THE EXIT STRING:<br>
&gt;         Hangup<br>
&gt;         (signal 1)<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;         --<br>
&gt;         ------------------------------------<br>
&gt;         Ethan Coon<br>
&gt;         Post-Doctoral Researcher<br>
&gt;         Applied Mathematics - T-5<br>
&gt;         Los Alamos National Laboratory<br>
&gt;         505-665-8289<br>
&gt;<br>
&gt;         <a href="http://www.ldeo.columbia.edu/~ecoon/" target="_blank">http://www.ldeo.columbia.edu/~ecoon/</a><br>
&gt;         ------------------------------------<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; What most experimenters take for granted before they begin their<br>
&gt; experiments is infinitely more interesting than any results to which<br>
&gt; their experiments lead.<br>
&gt; -- Norbert Wiener<br>
<br>
</div></div>--<br>
<div><div></div><div class="h5">------------------------------------<br>
Ethan Coon<br>
Post-Doctoral Researcher<br>
Applied Mathematics - T-5<br>
Los Alamos National Laboratory<br>
505-665-8289<br>
<br>
<a href="http://www.ldeo.columbia.edu/~ecoon/" target="_blank">http://www.ldeo.columbia.edu/~ecoon/</a><br>
------------------------------------<br>
<br>
</div></div></blockquote></div><br><br clear="all"><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>