<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Mar 26, 2014 at 8:28 AM, Mohammad Bahaa <span dir="ltr"><<a href="mailto:m.bahaa.eldein@gmail.com" target="_blank">m.bahaa.eldein@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Actually I tried your suggestion, and it works fine, but it's slightly different from what I need, since each process should have access to other processes' values, since there's some sort of interaction, so I need process 0 (for instance) to be capable of accessing (just reading) value out of its ownership range</div>
</blockquote><div><br></div><div>Random access defeats the purpose of parallel computing. If the access is structured, like a halo region, then</div><div>you can use a VecScatter to map between Vecs with and without a halo. See the manual chapter on the DMDA</div>
<div>object for a discussion of this in the case of structured meshes.</div><div><br></div><div> Thanks,</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">
<div class="gmail_extra"><div class="gmail_quote">On Wed, Mar 19, 2014 at 1:16 AM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>On Tue, Mar 18, 2014 at 11:00 AM, Mohammad Bahaa <span dir="ltr"><<a href="mailto:m.bahaa.eldein@gmail.com" target="_blank">m.bahaa.eldein@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I used <div>call VecCreateMPIWithArray(PETSC_COMM_WORLD,1,nc,ncall,myx,xall,ierr)<br></div><div><br></div>
<div>however, when I use process 0 to write a file containing the combined values (the xall vector), the values seem not to be updated by some processes, eventhough I use PetscBarrier, in other words, values locally owned by processes 0 and 2 are ok, but those owned by process 1 & 3 aren't !</div>
</div></blockquote><div><br></div></div><div>For collective writes, use VecView() or -vec_view</div><div><br></div><div> Matt</div><div><div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="gmail_extra"><div class="gmail_quote">On Tue, Mar 18, 2014 at 3:43 PM, Mohammad Bahaa <span dir="ltr"><<a href="mailto:m.bahaa.eldein@gmail.com" target="_blank">m.bahaa.eldein@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">the second approach of the MPI vector did it for me, thanks</div><div class="gmail_extra"><div><div>
<br><br><div class="gmail_quote">On Tue, Mar 18, 2014 at 3:20 PM, Mohammad Bahaa <span dir="ltr"><<a href="mailto:m.bahaa.eldein@gmail.com" target="_blank">m.bahaa.eldein@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Forgive me as my expression "sum up" was misguiding or misplaced, I didn't mean to literally sum the values in the vectors, I meant I want to put all values from each local vector into one global vector that can be accessed by all processes, "COMM_WORLD" communicator for instance</div>
<div class="gmail_extra"><div><div><br><br><div class="gmail_quote">On Tue, Mar 18, 2014 at 3:09 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>On Tue, Mar 18, 2014 at 7:53 AM, Mohammad Bahaa <span dir="ltr"><<a href="mailto:m.bahaa.eldein@gmail.com" target="_blank">m.bahaa.eldein@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">I'm using "<span style="white-space:pre-wrap">PETSC_COMM_SELF" communicator for running n serial independent processes, I need to sum up a certain vector from the n processes in one vector, however, vectors involved in each process vary in size, and I couldn't find any function to define custom ownership ranges, so assuming I have a 4 processes run with each computing an "x" vector as follows:</span><div>
<font color="#000000"><span style="white-space:pre-wrap"><br></span></font></div><div><font color="#000000"><span style="white-space:pre-wrap">1. process (1) with x of length 51</span></font></div><div><span style="white-space:pre-wrap">2. process (2) with x of length 49</span></div>
<div><span style="white-space:pre-wrap">3. process (3) with x of length 52</span></div><div><span style="white-space:pre-wrap">4. process (4) with x of length 48</span></div></div></blockquote><div><br></div></div><div>Let your local length be n, so that on proc 3 n== 52. Then</div>
<div><br></div><div> VecCreate(comm, &v);</div><div> VecSetSizes(v, n, PETSC_DETERMINE);</div><div> VecSetFromOptions(v);</div><div> <fill up v></div><div> VecSum(v, &sum);</div><div><br></div><div>You could also make a parallel Vec from your Seq vecs:</div>
<div><br></div><div> VecGetArray(lv, &array);</div><div> <span>VecCreateMPIWithArray(comm, 1, n, PETSC_DETERMINE, array, &v);</span></div><div><span><br></span></div>
<div><span> Thanks,</span></div><div><span><br></span></div><div><span> Matt</span></div><div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div><font color="#000000"><span style="white-space:pre-wrap">The processes sum up to 100 elements, when I define a vector "x_all" of size "100" with "</span></font><span style="white-space:pre-wrap">PETSC_COMM_WORLD" communicator, the ownership ranges are equal, which isn't the case, how to customize them ?</span><span><font color="#888888"><font color="#000000"><span style="white-space:pre-wrap"><br>
</span></font><div><br></div>-- <br><div dir="ltr">Mohamamd Bahaa ElDin</div>
</font></span></div></div>
</blockquote></div></div><span><font color="#888888"><br><br clear="all"><div><br></div>-- <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
</font></span></div></div>
</blockquote></div><br><br clear="all"><div><br></div></div></div><span><font color="#888888">-- <br><div dir="ltr">Mohamamd Bahaa ElDin</div>
</font></span></div>
</blockquote></div><br><br clear="all"><span><font color="#888888"><div><br></div></font></span></div></div><span><font color="#888888"><span><font color="#888888">-- <br><div dir="ltr">Mohamamd Bahaa ElDin</div>
</font></span></font></span></div><span><font color="#888888">
</font></span></blockquote></div><span><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Mohamamd Bahaa ElDin</div>
</font></span></div>
</blockquote></div></div></div><div><div><br><br clear="all"><span class="HOEnZb"><font color="#888888"><div><br></div>-- <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
</font></span></div></div></div></div><span class="HOEnZb"><font color="#888888">
</font></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Mohamamd Bahaa ElDin</div>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <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
</div></div>