Re: [petsc-users] VecScatter() causing processes hanging

2024-12-08 Thread Qiyue Lu
Yes, I got the right Vector local size using the code below and I am also sure all processes entered that function by printing out a message, which shows up the number of processes times. But the hanging problem is still there. I need to spend more time and do more tests. int vec_local_size; // vec

Re: [petsc-users] VecScatter() causing processes hanging

2024-12-08 Thread Qiyue Lu
Yes, it seems the global_vec has some problems. It is passed by as a function parameter. And the original vector is declared as in the code. However, I got some print-out as below, while I am expecting to get evenly-distributed values. process 0 has 5422 entries. process 1 has 0 entries. process 2

Re: [petsc-users] VecScatter() causing processes hanging

2024-12-08 Thread Barry Smith
Where does global_vec come from, and are you sure that all MPI processes that share global_vec enter this code region? > On Dec 8, 2024, at 4:52 PM, Qiyue Lu wrote: > > Thank you all for the reply. Here is the code. Since I need to fetch data > from the local_vec, so I set the type as VE

Re: [petsc-users] VecScatter() causing processes hanging

2024-12-08 Thread Qiyue Lu
Thank you all for the reply. Here is the code. Since I need to fetch data from the local_vec, so I set the type as VECSEQ, so I can use VecGetValues(). std::vector> vc(numNodesSurface, std::vector(numDimsProb)); // 2-D matrix storing velocity u, v. PetscScalar *ptr_vc = NULL; // memory storing the

Re: [petsc-users] VecScatter() causing processes hanging

2024-12-08 Thread Barry Smith
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 a

Re: [petsc-users] VecScatter() causing processes hanging

2024-12-08 Thread Mark Adams
You want to look at example codes and docs ( https://urldefense.us/v3/__https://petsc.org/release/manualpages/PetscSF/VecScatterCreate/__;!!G_uCfscf7eWS!ZfPM2-JGiNd8Yo2xIkHZlQtcjvcJFjXXbMbQPIZ3C5d-RVC-yfvFjoiEm5yaWLcKxfLTPhKkdLX9BM2atRAJ6eg$ ) but I am guessing global_vec and local_vec do not have

[petsc-users] VecScatter() causing processes hanging

2024-12-07 Thread Qiyue Lu
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,