<div class="gmail_extra">On Sun, Nov 11, 2012 at 8:35 AM, Jed Brown <span dir="ltr"><<a href="mailto:jedbrown@mcs.anl.gov" target="_blank">jedbrown@mcs.anl.gov</a>></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="gmail_extra"><div class="gmail_quote"><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>But I found a very promising solution: PetscVFPrintf. It solves my<br>

problem for my own Print function. But I do not seem to find a<br>
corresponding function for synchronized printing (PetscFPrintf). Any<br>
clues how to use PetscVFPrintf for synchronized printing please?</div></blockquote></div></div><br></div><div class="gmail_extra">PetscSynchronizedVFPrintf is missing, but should be added.</div></blockquote></div><br></div>
<div class="gmail_extra">There is actually an implementation issue. The current version dynamically sizes the local buffer by calling PetscVSNPrintf repeatedly, increasing the buffer size as necessary [1]. We cannot offer a PetscSynchronizedVFPrintf() without either (a) truncating sufficient long strings or (b) using vasprintf() which is a GNU extension. You can roll your own loop over va_start, vsnprintf(), va_end, resize-array-if-necessary and then call PetscSynchronizedPrintf(), or, if you can use the GNU extension, just use asprintf().</div>
<div class="gmail_extra"><br><br>[1] The implementation is hideous, leaking memory quadratic in the input size for large data volume.</div>