[petsc-dev] Mat updating from 3.7 to 3.9.2 Fortran

Hector E Barrios Molano hectorb at utexas.edu
Wed May 23 18:18:54 CDT 2018

Thanks Jed for the Answer.

I am still having problems with this code. In summary what I changed 
from PETSc 3.7 to 3.9 was:

- use of PETSC_NULL_MAT to evaluate if the matrix was defined

if(mat .eq. PETSC_NULL_MAT)then
     create matrix,vectors, ksp
end if

- modified MatSetValuesBlocked call
Previously it was:

call MatSetValuesBlocked(mat,1,N-1,IROW,LC(nnz),BB(nnz),INSERT_VALUES,ierr)

with N-1, LC(nnz), and BB(nnz) scalar values, the elements where 
inserted one at a time

Modified to:


After the matrix is built there is a call to


When I run the program I get a lot of these errors:

[0]PETSC ERROR: --------------------- Error Message 
[0]PETSC ERROR: Object is in wrong state
[0]PETSC ERROR: Matrix is missing diagonal entry 1
[0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html 
for trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.9.2, unknown
[0]PETSC ERROR: ../../../UTCOMPRS on a  named bandera by hector Wed May 
23 18:08:07 2018
[0]PETSC ERROR: Configure options 
--PETSC_DIR=/home/hector/dwnld_prog/petsc --PETSC_ARCH=linux-intel-debug 
--CC=mpiicc --FC=mpiifort --CXX=mpiicpc --with-openmp=1 
--with-valgrind=1 --with-valgrind-dir=/home/hector/installed 
--with-hypre-dir=/home/hector/installed/hypre --download-ptscotch 
--with-shared-libraries=0 --FC_LINKER_FLAGS="-qopenmp -qopenmp-link 
static" --FFLAGS="-qopenmp -qopenmp-link static" 
-Wl,--end-group -liomp5 -ldl -lpthread -lm"
[0]PETSC ERROR: #305869 MatILUFactorSymbolic_SeqBAIJ() line 369 in 
[0]PETSC ERROR: #305870 MatILUFactorSymbolic() line 6522 in 
[0]PETSC ERROR: #305871 PCSetUp_ILU() line 144 in 
[0]PETSC ERROR: #305872 PCSetUp() line 923 in 
[0]PETSC ERROR: #305873 KSPSetUp() line 381 in 
[0]PETSC ERROR: #305874 KSPSolve() line 612 in 

What could be the problem?

Thanks for your help,


On 05/22/2018 06:28 PM, Jed Brown wrote:
> Hector E Barrios Molano <hectorb at utexas.edu> writes:
>> 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
> You can use PETSC_NULL_MAT
>> 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?
> Please no.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20180523/e6079142/attachment-0001.html>

More information about the petsc-dev mailing list