<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">It is odd that the columns are not sorted</div><div class=""><br class=""></div><span style="font-size: 13px;" class="">row 125: (125, 0.) (107, 0.)</span><div class=""><font size="2" class=""><br class=""></font></div><div class="">How was this matrix created? </div><div class=""><br class=""></div><div class="">It is erroring because it compares the 125 column in the matrix to the 107 column requested and concludes there is no slot for 107 column. </div><div class=""><br class=""></div><div class="">Barry</div><div class=""><br class=""></div><div class=""><font size="2" class=""><br class=""></font><div><br class=""><blockquote type="cite" class=""><div class="">On Feb 9, 2022, at 10:33 AM, Yann Jobic <<a href="mailto:yann.jobic@univ-amu.fr" class="">yann.jobic@univ-amu.fr</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">I'm struggling for a very simple error that i can not see. I'm running in a sequential program, for the test.<br class=""><br class="">MatView is giving me for the row 125 :<br class="">row 125: (125, 0.) (107, 0.)<br class=""><br class="">I'm getting those values with MatGetRow :<br class=""> row=125<br class=""> CALL MatGetRow(MATGLOB,row,nb,testcols,testvalues,IER)<br class=""> write(*,*)row,testcols(1),testvalues(1),<br class=""> & testcols(2),testvalues(2)<br class=""> CALL MatRestoreRow(MATGLOB,row,nb,testcols,testvalues,IER)<br class=""><br class="">The output is :<br class=""> 125 125 0.000000000000000E+000 107 0.000000000000000E+000<br class="">Which is what i want. It's ok.<br class=""><br class="">Then i'm doing the MatSetValue :<br class=""> val = -1<br class=""> row = 125<br class=""> col = 107<br class=""> CALL MatSetValue(MATGLOB,row,col,val,<br class=""> & INSERT_VALUES, IER)<br class=""><br class="">And i've got the error :<br class="">[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------<br class="">[0]PETSC ERROR: Argument out of range<br class="">[0]PETSC ERROR: New nonzero at (125,107) caused a malloc<br class="">Use MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check<br class="">[0]PETSC ERROR: See <a href="https://petsc.org/release/faq/" class="">https://petsc.org/release/faq/</a> for trouble shooting.<br class="">[0]PETSC ERROR: Petsc Release Version 3.16.4, unknown<br class="">[0]PETSC ERROR: /home/jobic/projet/fe-utils/marcus/3.16/test_MatSetValue_loem_3.16p4_openmpi_intel on a named leto4.iusti-calcul.recherche by jobic Wed Feb 9 16:01:51 2022<br class="">[0]PETSC ERROR: Configure options --prefix=/local/lib/petsc/3.16/p4/17/openmpi_intel-mkl-works --with-single-library=0 --with-large-file-io=1 --with-debugging=0 --with-blacs=1 --with-blacs-dir=/opt/intel/compilers_and_libraries_2017.1.132/linux/compiler/lib/intel64/ --download-scalapack=1 --download-parmetis=1 --download-make=1 --download-mumps=1 --LIBS=" -Wl,-rpath,/opt/intel/compilers_and_libraries_2017.1.132/linux/compiler/lib/intel64/" --with-blaslapack-dir=/opt/intel/compilers_and_libraries_2017.1.132/linux/compiler/lib/intel64/ --download-metis=1 --download-parmetis=1 --download-ptscotch=1 --download-cmake=1 --download-slepc=1 --download-hdf5=1 --with-zlib=1 --download-szlib=1 --download-suitesparse=1 --download-p4est=1 --download-netcdf=1 --download-triangle=1 --with-shared-libraries=0 --with-cxx-dialect=C++11 -CFLAGS=" -O3 -mtune=core-avx2 -mkl" --COPTFLAGS="-D_POSIX_C_SOURCE=199309L" -CXXFLAGS=" -O3 -mtune=core-avx2 -mkl" -FFLAGS=" -O3 -mtune=core-avx2 -mkl" PETSC_ARCH=openmpi_intel-mkl-17-works<br class="">[0]PETSC ERROR: #1 MatSetValues_SeqAIJ() at /home/devel/src_linux/petsc-3.16.4/src/mat/impls/aij/seq/aij.c:520<br class="">[0]PETSC ERROR: #2 MatSetValues() at /home/devel/src_linux/petsc-3.16.4/src/mat/interface/matrix.c:1398<br class="">[0]PETSC ERROR: #3 MatGetRow() at /home/devel/src_linux/petsc-3.16.4/src/mat/interface/matrix.c:558<br class="">[0]PETSC ERROR: #4 MatRestoreRow_Fortran() at /home/devel/src_linux/petsc-3.16.4/src/mat/interface/ftn-custom/zmatrixf.c:582<br class=""><br class="">I'm obviously doing something wrong, but where ?<br class=""><br class="">Thanks,<br class=""><br class="">Yann<br class=""><br class="">Le 2/9/2022 à 1:58 PM, Matthew Knepley a écrit :<br class=""><blockquote type="cite" class="">On Wed, Feb 9, 2022 at 7:24 AM Bruno Rammon Silva Souza via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" class="">petsc-users@mcs.anl.gov</a> <<a href="mailto:petsc-users@mcs.anl.gov" class="">mailto:petsc-users@mcs.anl.gov</a>>> wrote:<br class=""> Hello everyone,<br class=""> I am using the LBFGS type in the SNES solver, and it's working fine.<br class=""> But I want to change the number of stored updates in this method.<br class=""> This variable of quasi-newton methods is usually chosen by the<br class=""> runtime option: -snes_qn_m <m>. However, I would like to change this<br class=""> variable inside my code, when calling a function, for example, but I<br class=""> can't find any kind of PETSc function that changes this variable<br class=""> directly. Is there any function like this? If not, is there some way<br class=""> to do that without using -snes_qn_m <m> at runtime?<br class="">This is an oversight which we will fix. For now you can use<br class=""><a href="https://petsc.org/main/docs/manualpages/Sys/PetscOptionsSetValue.html" class="">https://petsc.org/main/docs/manualpages/Sys/PetscOptionsSetValue.html</a> <<a href="https://petsc.org/main/docs/manualpages/Sys/PetscOptionsSetValue.html" class="">https://petsc.org/main/docs/manualpages/Sys/PetscOptionsSetValue.html</a>><br class="">in your code.<br class=""> Thanks,<br class=""> Matt<br class=""> Best regards,<br class=""> -- Bruno Souza<br class="">-- <br class="">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">-- Norbert Wiener<br class=""><a href="https://www.cse.buffalo.edu/~knepley/" class="">https://www.cse.buffalo.edu/~knepley/</a> <<a href="http://www.cse.buffalo.edu/~knepley/" class="">http://www.cse.buffalo.edu/~knepley/</a>><br class=""></blockquote></div></div></blockquote></div><br class=""></div></body></html>