[petsc-users] Collect Trajectories components

Francesco Brarda brardafrancesco at gmail.com
Wed May 26 10:39:23 CDT 2021


Thank you very much.
>  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?
Yes. I want to save different times across a vector built with multiple MPI ranks (PETSC_DECIDE for the local length).
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? Should I build everything into an external function outside the main?

Francesco


> Il giorno 26 mag 2021, alle ore 16:20, Barry Smith <bsmith at petsc.dev> ha scritto:
> 
> 
>  
> 
>   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. 
> 
>   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. 
> 
>   Barry
> 
>   
> 
>> On May 26, 2021, at 5:20 AM, Francesco Brarda <brardafrancesco at gmail.com <mailto:brardafrancesco at gmail.com>> wrote:
>> 
>> Hi!
>> 
>> 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. 
>> 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:
>> 
>> [0]PETSC ERROR: Invalid argument
>> [0]PETSC ERROR: Real value must be same on all processes, argument # 2
>> [0]PETSC ERROR: See https://www.mcs.anl.gov/petsc/documentation/faq.html <https://www.mcs.anl.gov/petsc/documentation/faq.html> for trouble shooting.
>> [0]PETSC ERROR: Petsc Release Version 3.14.4, unknown 
>> [0]PETSC ERROR: ./petsc_sir on a arch-debug named srvulx13 by fbrarda Wed May 26 12:00:42 2021
>> [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
>> [0]PETSC ERROR: #1 TSHistoryGetLocFromTime() line 134 in /home/fbrarda/petsc/src/ts/interface/tshistory.c
>> [0]PETSC ERROR: #2 TSTrajectoryReconstruct_Private() line 55 in /home/fbrarda/petsc/src/ts/trajectory/utils/reconstruct.c
>> [0]PETSC ERROR: #3 TSTrajectoryGetVecs() line 239 in /home/fbrarda/petsc/src/ts/trajectory/interface/traj.c
>> 
>> Is there any specific routine I can use to overcome this issue? Should I use VecScatter?
>> 
>> I hope I made myself clear.
>> Best,
>> Francesco
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20210526/161bad85/attachment.html>


More information about the petsc-users mailing list