<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I gather I’d use something like this?<div class=""><br class=""></div><div class="">VecGetArray(x, &xarray);</div><div class="">VecGetArray(y, &yarray);</div><div class=""><br class=""></div><div class="">MPI_Scan(array, array, nglobal, MPIU_SCALAR, MPI_SUM, PETSC_COMM_WORLD);</div><div class=""><br class=""></div><div class=""><div class="">VecRestoreArray(x, &xarray);</div><div class="">VecRestoreArray(y, &yarray);</div></div><div class=""><br class=""></div><div class=""><br class=""><div class="">
<span class="Apple-style-span" style="border-collapse: separate; font-variant-ligatures: normal; font-variant-position: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; line-height: normal; border-spacing: 0px;">-gideon</span>

</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On Feb 14, 2017, at 3:48 PM, Matthew Knepley <<a href="mailto:knepley@gmail.com" class="">knepley@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote">On Tue, Feb 14, 2017 at 2:46 PM, Gideon Simpson <span dir="ltr" class=""><<a href="mailto:gideon.simpson@gmail.com" target="_blank" class="">gideon.simpson@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Is there a clever way to handle a prefix (cumulative) sum in petsc?  I think I can see how to do with using some underlying MPI, but I was wondering if there were some built in routines that could be useful.</div></blockquote><div class=""><br class=""></div><div class="">It is one MPI call (MPI_Scan), but you could do it by assigning sizes to a PetscLayout (which is how I have done it several places).</div><div class=""><br class=""></div><div class="">  Thanks,</div><div class=""><br class=""></div><div class="">    Matt</div><div class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><span class="HOEnZb"><font color="#888888" class=""><div class=""><div class="">
<span class="m_-7788129563055749796Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant-ligatures: normal; font-variant-position: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">-gideon</span>

</div>

<br class=""></div></font></span></div></blockquote></div><br class=""><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div class="gmail_signature" data-smartmail="gmail_signature">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">-- Norbert Wiener</div>
</div></div>
</div></blockquote></div><br class=""></div></body></html>