You can scatter from a global vector to a local vector; numerous PETSc 
examples demonstrate this. So hanging here is surprising. Please display the 
entire code so we can see the context of the VecScatterCreate() usage. Perhaps 
not all the MPI process that are in the global_vec communicator are involved in 
the call to VecScatterCreate(). 

  To determine where the hang occurs you can run with -start_in_debugger use c 
for continue in each debugger window and then after a long time of hanging do 
control d in the hanging windows and then type bt to see where the code is 
hanging.

  Barry
 

> On Dec 7, 2024, at 9:47 PM, Qiyue Lu <qiyue...@gmail.com> wrote:
> 
> Hello,
> I am trying to fetch 12 entries from a distributed vector global_vec and put 
> them into a local vector on each process. 
> 
>         IS is_source, is_dest;
>         ISCreateGeneral(PETSC_COMM_SELF, 12, idx_global, PETSC_COPY_VALUES, 
> &is_source);
>         ISCreateGeneral(PETSC_COMM_SELF, 12, idx_local, PETSC_COPY_VALUES, 
> &is_dest);
>         Vec local_vec;
>         VecCreate(PETSC_COMM_SELF, &local_vec);
>         VecSetSizes(local_vec, PETSC_DECIDE, 12); 
>         VecSetType(local_vec, VECSEQ);
>         VecScatter scat;
>         VecScatterCreate(global_vec, is_source, local_vec, is_dest, &scat);
> 
> 
> I create the local vector as sequential. However, the last two lines which 
> create a scatter object, will cause more than half processes to hang and no 
> error pops out. 
> 
> Does the scatter have to be VECMPI to VECMPI and cannot VECMPI to VECSEQ?
> 
> Thanks,
> Qiyue Lu

Reply via email to