<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On May 26, 2021, at 10:39 AM, Francesco Brarda <<a href="mailto:brardafrancesco@gmail.com" class="">brardafrancesco@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Thank you very much.<br class=""><blockquote type="cite" class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"> Based on the error message it appears that your code is requesting different times on different MPI ranks. Is that what you intend to do?</div></blockquote>Yes. I want to save different times across a vector built with multiple MPI ranks (PETSC_DECIDE for the local length).<div class="">The function is called only by the first proc (rank=0) and not from the others. Is there a way to force also other ranks to call that routine? </div></div></div></blockquote><div><br class=""></div> Yes, just have all ranks call it and ignore the result on the other ranks. </div><div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">Should I build everything into an external function outside the main?</div></div></div></blockquote><div><br class=""></div> It can be called in main, does not need to be in a different function.</div><div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">Francesco<br class=""><div class=""><br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">Il giorno 26 mag 2021, alle ore 16:20, Barry Smith <<a href="mailto:bsmith@petsc.dev" class="">bsmith@petsc.dev</a>> ha scritto:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><br class=""></div> <div class=""><br class=""></div><div class=""> TSTrajectoryGetVecs() is listed as Collective on TS. This means all ranks must call it with the same times in the same order of operations on all ranks that share the TS. </div><div class=""><br class=""></div><div class=""> You do not need to use VecScatter. Each process must call TSTrajectoryGetVecs with the same time but then you can have only the rank you care about select the entries from the resulting vectors you care about while the other ranks for that time just ignore the vectors since they do not need to values from it. </div><div class=""><br class=""></div><div class=""> Barry</div><div class=""><br class=""></div><div class=""> <br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On May 26, 2021, at 5:20 AM, Francesco Brarda <<a href="mailto:brardafrancesco@gmail.com" class="">brardafrancesco@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi!<div class=""><br class=""></div><div class="">I solved an ODE system with TS. Now I would like to save one of the trajectories in specific times. To do so, I used TSTrajectoryGetVecs. </div><div class="">The values of the variable I am interested in is on one processor. I want to collect these values in a parallel vector, but I had the error:</div><span style="font-size: 11px;" class=""><font face="Menlo" class=""><div class=""><span style="font-size: 11px;" class=""><font face="Menlo" class=""><br class=""></font></span></div>[0]PETSC ERROR: Invalid argument<br class="">[0]PETSC ERROR: Real value must be same on all processes, argument # 2<br class="">[0]PETSC ERROR: See <a href="https://www.mcs.anl.gov/petsc/documentation/faq.html" class="">https://www.mcs.anl.gov/petsc/documentation/faq.html</a> for trouble shooting.<br class="">[0]PETSC ERROR: Petsc Release Version 3.14.4, unknown <br class="">[0]PETSC ERROR: ./petsc_sir on a arch-debug named srvulx13 by fbrarda Wed May 26 12:00:42 2021<br class="">[0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ --with-fc=gfortran --with-openblas-dir=/opt/packages/openblas/0.2.13-gcc --download-mpich PETSC_ARCH=arch-debug<br class="">[0]PETSC ERROR: #1 TSHistoryGetLocFromTime() line 134 in /home/fbrarda/petsc/src/ts/interface/tshistory.c<br class="">[0]PETSC ERROR: #2 TSTrajectoryReconstruct_Private() line 55 in /home/fbrarda/petsc/src/ts/trajectory/utils/reconstruct.c<br class="">[0]PETSC ERROR: #3 TSTrajectoryGetVecs() line 239 in /home/fbrarda/petsc/src/ts/trajectory/interface/traj.c<br class=""></font></span><span class=""><br class=""></span><div class="">Is there any specific routine I can use to overcome this issue? Should I use VecScatter?</div><div class=""><br class=""></div><div class="">I hope I made myself clear.</div><div class="">Best,</div><div class="">Francesco</div></div></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div></div></div></div></blockquote></div><br class=""></body></html>