<div dir="ltr"><div dir="ltr">You have MatSetOption inside of a loop for the number of rows. This is apparently a collective operation. Move it to line 156.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Apr 7, 2019 at 5:44 AM Eda Oktay via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</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">Dear Barry, <div><br></div><div>Thank you for answering. I am sending my code, makefile and 2 PETSc Binary File where airfoil1_binary has odd numbered size (the one I got error) and gr_30_30_binary has even numbered size (I got correct result). I got the error for lines 164 and 169.</div><div><br></div><div>By the way, I think I have done something wrong at line 320 (I tried to allocate an array twice) but I just need to reduce the error in 164 and 169 then I will get to reduce the error in line 320.</div><div><br></div><div>Thanks,</div><div><br></div><div>Eda</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Smith, Barry F. <<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>>, 6 Nis 2019 Cmt, 09:29 tarihinde şunu yazdı:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
  Eda,<br>
<br>
   Can you send us your code (and any needed data files)? We certainly expect PETSc to perform correctly if the size of the matrix cannot be divide by the number of processors. It is possible the problem is due to bugs either in MatStashScatterBegin_BTS() or in your code.<br>
<br>
   Thanks<br>
<br>
    Barry<br>
<br>
<br>
> On Apr 5, 2019, at 7:20 AM, Matthew Knepley via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:<br>
> <br>
> On Fri, Apr 5, 2019 at 3:20 AM Eda Oktay via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:<br>
> Hello,<br>
> <br>
> I am trying to calculate unweighted Laplacian of a matrix by using 2 cores. If the size of matrix is in even number then my program works. However, when I try to use a matrix having odd number for size, I guess since size of the matrix cannot be divided into processors correctly, I get the following error:<br>
> <br>
> [0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------<br>
> [1]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------<br>
> [1]PETSC ERROR: Petsc has generated inconsistent data<br>
> [1]PETSC ERROR: MPI_Allreduce() called in different locations (code lines) on different processors<br>
> [1]PETSC ERROR: See <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html" rel="noreferrer" target="_blank">http://www.mcs.anl.gov/petsc/documentation/faq.html</a> for trouble shooting.<br>
> [1]PETSC ERROR: Petsc Release Version 3.10.3, Dec, 18, 2018 <br>
> [0]PETSC ERROR: Petsc has generated inconsistent data<br>
> [0]PETSC ERROR: MPI_Allreduce() called in different locations (code lines) on different processors<br>
> [0]PETSC ERROR: See <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html" rel="noreferrer" target="_blank">http://www.mcs.anl.gov/petsc/documentation/faq.html</a> for trouble shooting.<br>
> [0]PETSC ERROR: Petsc Release Version 3.10.3, Dec, 18, 2018 <br>
> [0]PETSC ERROR: ./SON_YENI_DENEME_TEMIZ_ENYENI_FINAL on a arch-linux2-c-debug named <a href="http://dfa.wls.metu.edu.tr" rel="noreferrer" target="_blank">dfa.wls.metu.edu.tr</a> by edaoktay Fri Apr  5 09:50:54 2019<br>
> [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ --with-fc=gfortran --with-cxx-dialect=C++11 --download-openblas --download-metis --download-parmetis --download-superlu_dist --download-slepc --download-mpich<br>
> [1]PETSC ERROR: ./SON_YENI_DENEME_TEMIZ_ENYENI_FINAL on a arch-linux2-c-debug named <a href="http://dfa.wls.metu.edu.tr" rel="noreferrer" target="_blank">dfa.wls.metu.edu.tr</a> by edaoktay Fri Apr  5 09:50:54 2019<br>
> [1]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ --with-fc=gfortran --with-cxx-dialect=C++11 --download-openblas --download-metis --download-parmetis --download-superlu_dist --download-slepc --download-mpich<br>
> [1]PETSC ERROR: [0]PETSC ERROR: #1 MatSetOption() line 5505 in /home/edaoktay/petsc-3.10.3/src/mat/interface/matrix.c<br>
> #1 MatStashScatterBegin_BTS() line 843 in /home/edaoktay/petsc-3.10.3/src/mat/utils/matstash.c<br>
> [1]PETSC ERROR: [0]PETSC ERROR: #2 MatSetOption() line 5505 in /home/edaoktay/petsc-3.10.3/src/mat/interface/matrix.c<br>
> #2 MatStashScatterBegin_BTS() line 843 in /home/edaoktay/petsc-3.10.3/src/mat/utils/matstash.c<br>
> [1]PETSC ERROR: #3 MatStashScatterBegin_Private() line 462 in /home/edaoktay/petsc-3.10.3/src/mat/utils/matstash.c<br>
> [0]PETSC ERROR: #3 main() line 164 in /home/edaoktay/petsc-3.10.3/arch-linux2-c-debug/share/slepc/examples/src/eda/SON_YENI_DENEME_TEMIZ_ENYENI_FINAL.c<br>
> [1]PETSC ERROR: #4 MatAssemblyBegin_MPIAIJ() line 774 in /home/edaoktay/petsc-3.10.3/src/mat/impls/aij/mpi/mpiaij.c<br>
> [1]PETSC ERROR: [0]PETSC ERROR: PETSc Option Table entries:<br>
> [0]PETSC ERROR: -f /home/edaoktay/petsc-3.10.3/share/petsc/datafiles/matrices/binary_files/airfoil1_binary<br>
> #5 MatAssemblyBegin() line 5251 in /home/edaoktay/petsc-3.10.3/src/mat/interface/matrix.c<br>
> [1]PETSC ERROR: [0]PETSC ERROR: -mat_partitioning_type parmetis<br>
> [0]PETSC ERROR: -unweighted<br>
> #6 main() line 169 in /home/edaoktay/petsc-3.10.3/arch-linux2-c-debug/share/slepc/examples/src/eda/SON_YENI_DENEME_TEMIZ_ENYENI_FINAL.c<br>
> [1]PETSC ERROR: PETSc Option Table entries:<br>
> [1]PETSC ERROR: [0]PETSC ERROR: ----------------End of Error Message -------send entire error message to petsc-maint@mcs.anl.gov----------<br>
> -f /home/edaoktay/petsc-3.10.3/share/petsc/datafiles/matrices/binary_files/airfoil1_binary<br>
> [1]PETSC ERROR: -mat_partitioning_type parmetis<br>
> [1]PETSC ERROR: -unweighted<br>
> [1]PETSC ERROR: application called MPI_Abort(MPI_COMM_WORLD, 1) - process 0<br>
> ----------------End of Error Message -------send entire error message to petsc-maint@mcs.anl.gov----------<br>
> application called MPI_Abort(MPI_COMM_WORLD, 1) - process 1<br>
> <br>
> <br>
>  where line 164 in my main program is MatSetOption and line 169 is MatAssemblyBegin. I am new to MPI usage so I did not understand why MPI_Allreduce() causes a problem and how can I fix the problem.<br>
> <br>
> You have to call collective methods on all processes in the same order. This is not happening in your code. Beyond that,<br>
> there is no way for us to tell how this happened.<br>
> <br>
>   Thanks,<br>
> <br>
>      Matt<br>
>  <br>
> Thank you,<br>
> <br>
> Eda<br>
> <br>
> <br>
> -- <br>
> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
> -- Norbert Wiener<br>
> <br>
> <a href="https://www.cse.buffalo.edu/~knepley/" rel="noreferrer" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br>
<br>
</blockquote></div>
</blockquote></div>