<div dir="ltr">Check <a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecScatterCreateToAll.html">https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecScatterCreateToAll.html</a> to see if it meets your needs.<div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">--Junchao Zhang</div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Apr 4, 2020 at 3:39 AM Eda Oktay <<a href="mailto:eda.oktay@metu.edu.tr">eda.oktay@metu.edu.tr</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi all,<div><br></div><div>I created a parallel vector UV, by using VecDuplicateVecs since I need row vectors of a matrix. However, I need the whole vector be in all processors, which means I need to gather all and broadcast them to all processors. To gather, I tried to use VecStrideGatherAll:</div><div><br></div><div> Vec UVG; <br> VecStrideGatherAll(UV,UVG,INSERT_VALUES);<br> VecView(UVG,PETSC_VIEWER_STDOUT_WORLD);<br></div><div><br></div><div> however when I try to view the vector, I get the following error.</div><div><br></div><div>[3]PETSC ERROR: Invalid argument<br>[3]PETSC ERROR: Wrong type of object: Parameter # 1<br>[3]PETSC ERROR: See <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html" target="_blank">http://www.mcs.anl.gov/petsc/documentation/faq.html</a> for trouble shooting.<br>[3]PETSC ERROR: Petsc Release Version 3.11.1, Apr, 12, 2019 <br>[3]PETSC ERROR: ./clustering_son_final_edgecut_without_parmetis on a arch-linux2-c-debug named localhost.localdomain by edaoktay Sat Apr 4 11:22:54 2020<br>[3]PETSC ERROR: Wrong type of object: Parameter # 1<br>[0]PETSC ERROR: See <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html" target="_blank">http://www.mcs.anl.gov/petsc/documentation/faq.html</a> for trouble shooting.<br>[0]PETSC ERROR: Petsc Release Version 3.11.1, Apr, 12, 2019 <br>[0]PETSC ERROR: ./clustering_son_final_edgecut_without_parmetis on a arch-linux2-c-debug named localhost.localdomain by edaoktay Sat Apr 4 11:22:54 2020<br>[0]PETSC ERROR: Configure options --download-mpich --download-openblas --download-slepc --download-metis --download-parmetis --download-chaco --with-X=1<br>[0]PETSC ERROR: #1 VecStrideGatherAll() line 646 in /home/edaoktay/petsc-3.11.1/src/vec/vec/utils/vinv.c<br>./clustering_son_final_edgecut_without_parmetis on a arch-linux2-c-debug named localhost.localdomain by edaoktay Sat Apr 4 11:22:54 2020<br>[1]PETSC ERROR: Configure options --download-mpich --download-openblas --download-slepc --download-metis --download-parmetis --download-chaco --with-X=1<br>[1]PETSC ERROR: #1 VecStrideGatherAll() line 646 in /home/edaoktay/petsc-3.11.1/src/vec/vec/utils/vinv.c<br>Configure options --download-mpich --download-openblas --download-slepc --download-metis --download-parmetis --download-chaco --with-X=1<br>[3]PETSC ERROR: #1 VecStrideGatherAll() line 646 in /home/edaoktay/petsc-3.11.1/src/vec/vec/utils/vinv.c<br></div><div><br></div><div>I couldn't understand why I am getting this error. Is this because of UV being created by VecDuplicateVecs? How can I solve this problem?</div><div><br></div><div>The other question is broadcasting. After gathering all elements of the vector UV, I need to broadcast them to all processors. I found PetscSFBcastBegin. However, I couldn't understand the PetscSF concept properly. I couldn't adjust my question to the star forest concept. </div><div><br></div><div>My problem is: If I have 4 processors, I create a matrix whose columns are 4 smallest eigenvectors, say of size 72. Then by defining each row of this matrix as a vector, I cluster them by using k-means clustering algorithm. For now, I cluster them by using MATLAB and I obtain a vector showing which row vector is in which cluster. After getting this vector, to cluster row vectors according to this information, all processors need to have all of the row vectors.</div><div><br></div><div>According to this problem, how can I use the star forest concept? </div><div><br></div><div>I will be glad if you can help me about this problem since I don't have enough knowledge about graph theory. An if you have any idea about how can I use k-means algorithm in a more practical way, please let me know.</div><div><br></div><div>Thanks!</div><div><br></div><div>Eda</div></div>
</blockquote></div>