<div dir="ltr">On Tue, Jan 15, 2013 at 4:21 PM, Weston Lowrie <span dir="ltr"><<a href="mailto:wlowrie@u.washington.edu" target="_blank">wlowrie@u.washington.edu</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><font face="verdana,sans-serif">That's interesting.  If I understand you correctly, I would create a vector of the size I want specifically for calculating the ownership range, then use that on the real vectors.  </font><span style="font-family:verdana,sans-serif">Sounds like that would work.</span><div>

<span style="font-family:verdana,sans-serif"><br></span></div><div><span style="font-family:verdana,sans-serif">In my case, with many vectors, it does not make sense to copy them to a resized vector every time I want them to grow leading to many creates and destroys.</span></div>
</blockquote><div><br></div><div style>You can't dynamically resize vectors like that, and the global offsets change when you resize.</div><div style><br></div><div style>Please profile before jumping to the conclusion that there is some terrible inefficiency here. Unless all your loop does is create Vecs of different sizes, chances are that the VecCreate is insignificant. If you have a profile in which it's a big deal, please send the profile and explain what you are doing and why.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><font face="verdana, sans-serif"><br></font></div><div><font face="verdana, sans-serif">Wes<br></font><div><div class="h5"><div><font face="verdana,sans-serif"><br></font><br><div class="gmail_quote">On Tue, Jan 15, 2013 at 5:15 PM, Jed Brown <span dir="ltr"><<a href="mailto:jedbrown@mcs.anl.gov" target="_blank">jedbrown@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"><div dir="ltr">VecGetOwnershipRange()<div><br></div><div>You can use VecCreateMPIWithArray() using your own array preallocated to be as long as you want. If you profile, you'll probably find this is not a meaningful optimization.</div>


</div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jan 15, 2013 at 4:12 PM, Weston Lowrie <span dir="ltr"><<a href="mailto:wlowrie@uw.edu" target="_blank">wlowrie@uw.edu</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<font face="verdana,sans-serif">Hi,</font><div><font face="verdana, sans-serif"><br></font></div><div><font face="verdana, sans-serif">I have a problem where I want to grow the size of a Vec (or Mat) many times during program execution.  I think for efficiency purposes I would just want to allocate a maximum size, and then only use the portion that I need.  In the vector case, it is rather simple, just use the beginning of the vector, and add values to the end.</font></div>



<div><font face="verdana, sans-serif"><br></font></div><div><font face="verdana, sans-serif">This leads to me to the problem of processor ownership ranges.  From a previous email I noticed one could use the PetscLayout object and keep adjusting it as the useful part of the vector grows.  Does this sound like a good approach?  </font></div>



<div><font face="verdana, sans-serif"><br></font></div><div><font face="verdana, sans-serif">I noticed the PetscLayout is not available in Fortran bindings.  Any workarounds for this?  I suppose I can just manually calculate the processor ranges?</font></div>



<div><font face="verdana, sans-serif"><br></font></div><div><font face="verdana, sans-serif">Thanks for the help,</font></div><div><font face="verdana, sans-serif">Wes</font></div><div><font face="verdana, sans-serif"><br>



</font></div><div><font face="verdana, sans-serif"><br></font><div><font face="verdana,sans-serif"><br></font></div><div><font face="verdana,sans-serif"><br></font></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div></div>
</blockquote></div><br></div></div>