<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, May 23, 2018 at 7:18 PM, Hector E Barrios Molano <span dir="ltr"><<a href="mailto:hectorb@utexas.edu" target="_blank">hectorb@utexas.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <font face="Droid Serif">Thanks Jed for the Answer.<br>
      <br>
      I am still having problems with this code. In summary what I
      changed from PETSc 3.7 to 3.9 was:<br>
      <br>
      - use of PETSC_NULL_MAT to evaluate if the matrix was defined<br>
      <br>
      mat = PETSC_NULL_MAT<br>
      ...<br>
      if(mat .eq. PETSC_NULL_MAT)then<br>
          create matrix,vectors, ksp<br>
      else<br>
          KSPSetInitialGuessNonzero<br>
          VecResetArray<br>
      end if<br>
      <br>
      - modified MatSetValuesBlocked call<br>
      Previously it was:<br>
      <br>
      call
      MatSetValuesBlocked(mat,1,N-1,<wbr>IROW,LC(nnz),BB(nnz),INSERT_<wbr>VALUES,ierr)<br>
      <br>
      with N-1, LC(nnz), and BB(nnz) scalar values, the elements where
      inserted one at a time<br>
      <br>
      Modified to:<br>
      <br>
      call
MatSetValuesBlocked(mat,1,[N-<wbr>1],IROW,[LC(nnz)],[BB(nnz)],<wbr>INSERT_VALUES,ierr)<br>
      <br>
      After the matrix is built there is a call to <br>
      <br>
      KSPSolve<br>
      <br>
      When I run the program I get a lot of these errors:<br>
      <br>
      [0]PETSC ERROR: --------------------- Error Message
      ------------------------------<wbr>------------------------------<wbr>--<br>
      [0]PETSC ERROR: Object is in wrong state<br>
      [0]PETSC ERROR: Matrix is missing diagonal entry 1<br>
      [0]PETSC ERROR: See
      <a class="m_4165897495604093569moz-txt-link-freetext" href="http://www.mcs.anl.gov/petsc/documentation/faq.html" target="_blank">http://www.mcs.anl.gov/petsc/<wbr>documentation/faq.html</a> for trouble
      shooting.<br>
      [0]PETSC ERROR: Petsc Release Version 3.9.2, unknown <br>
      [0]PETSC ERROR: ../../../UTCOMPRS on a  named bandera by hector
      Wed May 23 18:08:07 2018<br>
      [0]PETSC ERROR: Configure options
      --prefix=/home/hector/<wbr>installed/petsc_git-intel-<wbr>debug
      --PETSC_DIR=/home/hector/<wbr>dwnld_prog/petsc
      --PETSC_ARCH=linux-intel-debug --CC=mpiicc --FC=mpiifort
      --CXX=mpiicpc --with-openmp=1 --with-valgrind=1
      --with-valgrind-dir=/home/<wbr>hector/installed
      --with-parmetis-dir=/home/<wbr>hector/installed/parmetis/
      --with-metis-dir=/home/hector/<wbr>installed/parmetis/
      --with-zoltan-dir=/home/<wbr>hector/installed/zoltan/
      --with-hypre-dir=/home/hector/<wbr>installed/hypre --download-ptscotch
--with-blaslapack-lib="[/home/<wbr>hector/installed/intel/<wbr>compilers_and_libraries_2019.<wbr>0.046/linux/mkl/lib/intel64/<wbr>libmkl_intel_lp64.a,/home/<wbr>hector/installed/intel/<wbr>compilers_and_libraries_2019.<wbr>0.046/linux/mkl/lib/intel64/<wbr>libmkl_core.a,/home/hector/<wbr>installed/intel/compilers_and_<wbr>libraries_2019.0.046/linux/<wbr>mkl/lib/intel64/libmkl_intel_<wbr>thread.a]"
--with-scalapack-include=/<wbr>home/hector/installed/intel/<wbr>compilers_and_libraries_2019.<wbr>0.046/linux/mkl/include
--with-scalapack-lib="[/home/<wbr>hector/installed/intel/<wbr>compilers_and_libraries_2019.<wbr>0.046/linux/mkl/lib/intel64/<wbr>libmkl_scalapack_lp64.a,/home/<wbr>hector/installed/intel/<wbr>compilers_and_libraries_2019.<wbr>0.046/linux/mkl/lib/intel64/<wbr>libmkl_blacs_intelmpi_lp64.a]"
      --with-shared-libraries=0 --FC_LINKER_FLAGS="-qopenmp
      -qopenmp-link static" --FFLAGS="-qopenmp -qopenmp-link static"
      --LIBS="-Wl,--start-group
/home/hector/installed/intel/<wbr>compilers_and_libraries_2019.<wbr>0.046/linux/mkl/lib/intel64/<wbr>libmkl_intel_lp64.a
/home/hector/installed/intel/<wbr>compilers_and_libraries_2019.<wbr>0.046/linux/mkl/lib/intel64/<wbr>libmkl_core.a
/home/hector/installed/intel/<wbr>compilers_and_libraries_2019.<wbr>0.046/linux/mkl/lib/intel64/<wbr>libmkl_intel_thread.a
      -Wl,--end-group -liomp5 -ldl -lpthread -lm"<br>
      [0]PETSC ERROR: #305869 MatILUFactorSymbolic_SeqBAIJ() line 369 in
      /home/hector/dwnld_prog/petsc/<wbr>src/mat/impls/baij/seq/<wbr>baijfact2.c<br>
      [0]PETSC ERROR: #305870 MatILUFactorSymbolic() line 6522 in
      /home/hector/dwnld_prog/petsc/<wbr>src/mat/interface/matrix.c<br>
      [0]PETSC ERROR: #305871 PCSetUp_ILU() line 144 in
      /home/hector/dwnld_prog/petsc/<wbr>src/ksp/pc/impls/factor/ilu/<wbr>ilu.c<br>
      [0]PETSC ERROR: #305872 PCSetUp() line 923 in
      /home/hector/dwnld_prog/petsc/<wbr>src/ksp/pc/interface/precon.c<br>
      [0]PETSC ERROR: #305873 KSPSetUp() line 381 in
      /home/hector/dwnld_prog/petsc/<wbr>src/ksp/ksp/interface/itfunc.c<br>
      [0]PETSC ERROR: #305874 KSPSolve() line 612 in
      /home/hector/dwnld_prog/petsc/<wbr>src/ksp/ksp/interface/itfunc.c<br>
      <br>
      <br>
      What could be the problem?<br></font></div></blockquote><div><br></div><div>For all  factorizations, you must have diagonal entries, even if they are 0.</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF"><font face="Droid Serif">
      Thanks for your help,<br>
      <br>
      Hector<br>
      <br>
      <br>
    </font><br>
    <div class="m_4165897495604093569moz-cite-prefix">On 05/22/2018 06:28 PM, Jed Brown
      wrote:<br>
    </div>
    <blockquote type="cite">
      <pre>Hector E Barrios Molano <a class="m_4165897495604093569moz-txt-link-rfc2396E" href="mailto:hectorb@utexas.edu" target="_blank"><hectorb@utexas.edu></a> writes:

</pre>
      <blockquote type="cite">
        <pre>Hi PETSc Experts!

I am updating a Fortran code that use PETSc 3.7 to version 3.9.2 (from 
git repository).

Such code declares:

Mat mat

and used it as an integer, for example, to assign an initial value and 
test it to know if the matrix has been created by PETSc.

data mat/-1/
if (mat .eq. -1) then
</pre>
      </blockquote>
      <pre>You can use PETSC_NULL_MAT

</pre>
      <blockquote type="cite">
        <pre>With the new PETSc Fortran modules the compiler complains about this and 
stops.

Is there a better way to achieve this? So that I do not have to set an 
predefined value to Mat type to test if it was already created by PETSc?

If not, Is there a way to access the value in mat?
Looking at the source code type(tMat) has "v" variable, so could I used 
as mat%v?
</pre>
      </blockquote>
      <pre>Please no.
</pre>
    </blockquote>
    <br>
  </div>

</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><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.caam.rice.edu/~mk51/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div>
</div></div>