<div dir="ltr"><div dir="ltr"><div dir="ltr">Hello again,<div><br></div><div>I solved the problem for even numbered sized matrices. However when the matrix size is odd, then number of elements in each index set at each processor are different. (For example, for size 4253*4253 and 2 processors, size of index set at processor 0 is 2127 where at processor 1, it is 2126) I think this is why, MatPermute again gives the same "Argument out of range" error. Index sets look like correct but I still did not get why I get this error.</div><div><br></div><div>This is the part of my program:</div><div><br></div><div><div> PetscMPIInt rank,size;</div><div> MPI_Comm_rank(PETSC_COMM_WORLD, &rank);</div><div> MPI_Comm_size(PETSC_COMM_WORLD, &size);</div><div> </div><div> PetscInt mod;</div><div> mod = siz % size;</div><div> </div><div> PetscInt *idxx,ss;</div><div> ss = (siz-mod)/size; </div><div> </div><div> if (mod != 0){</div><div> if (rank<mod){</div><div> PetscMalloc1(ss+1,&idxx); </div><div> } else{</div><div> PetscMalloc1(ss,&idxx);</div><div> }</div><div> }</div><div> </div><div> if (rank != size-1) {</div><div> j =0;</div><div> for (i=rank*ss; i<(rank+1)*ss; i++) {</div><div> idxx[j] = idx[i];</div><div> j++;</div><div> }</div><div><br></div><div> } else {</div><div> </div><div> j =0;</div><div> for (i=rank*ss; i<siz; i++) {</div><div> idxx[j] = idx[i];</div><div> j++;</div><div> }</div><div> </div><div> }</div><div> </div><div> if (mod != 0){</div><div> if (rank<mod){ </div><div> idxx[ss+1] = idx[ss*size+rank+1];</div><div> }</div><div> }</div><div> </div><div> /*Permute matrix L (spy(A(p1,p1))*/</div><div><br></div><div> if (mod != 0){</div><div> if (rank<mod){</div><div> ierr = ISCreateGeneral(PETSC_COMM_WORLD,ss+1,idxx,PETSC_COPY_VALUES,&is);CHKERRQ(ierr);</div><div> } else{</div><div> ierr = ISCreateGeneral(PETSC_COMM_WORLD,ss,idxx,PETSC_COPY_VALUES,&is);CHKERRQ(ierr);</div><div> }</div><div> }</div><div> ierr = ISSetPermutation(is);CHKERRQ(ierr);</div><div><br></div><div> ierr = MatPermute(A,is,is,&PL);CHKERRQ(ierr); </div></div><div><br></div><div>And I get the following error even if I use MatSetOption :</div><div><br></div><div><div>[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------</div><div>[0]PETSC ERROR: Argument out of range</div><div>[0]PETSC ERROR: New nonzero at (0,4252) caused a malloc</div><div>Use MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check</div><div>[0]PETSC ERROR: See <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html">http://www.mcs.anl.gov/petsc/documentation/faq.html</a> for trouble shooting.</div><div>[0]PETSC ERROR: Petsc Release Version 3.10.3, Dec, 18, 2018 </div><div>[0]PETSC ERROR: ./SON_YENI_DENEME_TEMIZ_ENYENI_FINAL on a arch-linux2-c-debug named <a href="http://dd2b.wls.metu.edu.tr">dd2b.wls.metu.edu.tr</a> by edaoktay Mon Apr 8 11:10:59 2019</div><div>[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</div><div>[0]PETSC ERROR: #1 MatSetValues_MPIAIJ() line 617 in /home/edaoktay/petsc-3.10.3/src/mat/impls/aij/mpi/mpiaij.c</div><div>[0]PETSC ERROR: #2 MatSetValues() line 1349 in /home/edaoktay/petsc-3.10.3/src/mat/interface/matrix.c</div><div>[0]PETSC ERROR: #3 MatPermute_MPIAIJ() line 1714 in /home/edaoktay/petsc-3.10.3/src/mat/impls/aij/mpi/mpiaij.c</div><div>[0]PETSC ERROR: #4 MatPermute() line 4997 in /home/edaoktay/petsc-3.10.3/src/mat/interface/matrix.c</div><div>[0]PETSC ERROR: #5 main() line 352 in /home/edaoktay/petsc-3.10.3/arch-linux2-c-debug/share/slepc/examples/src/eda/SON_YENI_DENEME_TEMIZ_ENYENI_FINAL.c</div><div>[0]PETSC ERROR: PETSc Option Table entries:</div><div>[0]PETSC ERROR: -f /home/edaoktay/petsc-3.10.3/share/petsc/datafiles/matrices/binary_files/airfoil1_binary</div><div>[0]PETSC ERROR: -mat_partitioning_type parmetis</div><div>[0]PETSC ERROR: -unweighted</div><div>[0]PETSC ERROR: ----------------End of Error Message -------send entire error message to petsc-maint@mcs.anl.gov----------</div></div><div><br></div><div>Thanks!</div><div><br></div><div>Eda</div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Eda Oktay <<a href="mailto:eda.oktay@metu.edu.tr">eda.oktay@metu.edu.tr</a>>, 25 Mar 2019 Pzt, 13:53 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"><div dir="ltr">I attached whole program I wrote where the problem is in line 285. One of the matrices I used was airfoil1_binary, included in the folder. Also, I included makefile. Is that what you want?</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>>, 25 Mar 2019 Pzt, 13:41 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"><div dir="ltr">That should not happen. Can you send in a small example that we can debug.<div><br></div><div> Thanks,</div><div><br></div><div> Matt</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Mar 25, 2019 at 12:38 AM Eda Oktay via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">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"><div dir="ltr"><div dir="ltr"><div>Hello,</div><div><br></div><div>I am trying to permute a vector A using following lines: </div><div><br></div><div>ierr = ISCreateGeneral(PETSC_COMM_SELF,siz,idx,PETSC_COPY_VALUES,&is);CHKERRQ(ierr);</div><div> ierr = ISSetPermutation(is);CHKERRQ(ierr);</div><div> ierr = ISDuplicate(is,&newIS);CHKERRQ(ierr);</div><div> ierr = MatSetOption(A,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_FALSE);CHKERRQ(ierr); </div><div> ierr = MatPermute(A,is,newIS,&PL);CHKERRQ(ierr); </div><div><br></div><div>However, in MatPermute line, I get the following error even if I used MatSetOption before this line:</div><div><br></div><div><div>[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------</div><div>[0]PETSC ERROR: Argument out of range</div><div>[0]PETSC ERROR: New nonzero at (0,485) caused a malloc</div><div>Use MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check</div><div>[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.</div><div>[0]PETSC ERROR: Petsc Release Version 3.10.3, Dec, 18, 2018 </div><div>[0]PETSC ERROR: ./DENEME_TEMIZ_ENYENI_FINAL on a arch-linux2-c-debug named <a href="http://1232.wls.metu.edu.tr" target="_blank">1232.wls.metu.edu.tr</a> by edaoktay Mon Mar 25 12:15:14 2019</div><div>[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</div><div>[0]PETSC ERROR: #1 MatSetValues_MPIAIJ() line 579 in /home/edaoktay/petsc-3.10.3/src/mat/impls/aij/mpi/mpiaij.c</div><div>[0]PETSC ERROR: #2 MatAssemblyEnd_MPIAIJ() line 807 in /home/edaoktay/petsc-3.10.3/src/mat/impls/aij/mpi/mpiaij.c</div><div>[0]PETSC ERROR: #3 MatAssemblyEnd() line 5340 in /home/edaoktay/petsc-3.10.3/src/mat/interface/matrix.c</div><div>[0]PETSC ERROR: #4 MatPermute_MPIAIJ() line 1723 in /home/edaoktay/petsc-3.10.3/src/mat/impls/aij/mpi/mpiaij.c</div><div>[0]PETSC ERROR: #5 MatPermute() line 4997 in /home/edaoktay/petsc-3.10.3/src/mat/interface/matrix.c</div><div>[0]PETSC ERROR: #6 main() line 285 in /home/edaoktay/petsc-3.10.3/arch-linux2-c-debug/share/slepc/examples/src/eda/DENEME_TEMIZ_ENYENI_FINAL.c</div><div>[0]PETSC ERROR: PETSc Option Table entries:</div><div>[0]PETSC ERROR: -f /home/edaoktay/petsc-3.10.3/share/petsc/datafiles/matrices/binary_files/airfoil1_binary</div><div>[0]PETSC ERROR: -mat_partitioning_type parmetis</div><div>[0]PETSC ERROR: -weighted</div><div>[0]PETSC ERROR: ----------------End of Error Message -------send entire error message to petsc-maint@mcs.anl.gov----------</div></div><div><br></div><div>I'll be glad if you can help me.</div><div><br></div><div>Thanks!</div><div><br></div><div>Eda</div></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail-m_423860031029937633gmail-m_5974688569433282999gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>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</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div>
</blockquote></div>
</blockquote></div>