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

Hector E Barrios Molano hectorb at utexas.edu
Wed May 23 20:06:07 CDT 2018


Thanks Barry,

I did that, the problem was when setting values to the matrix.

The matrix is set row by row, although only the first element of the 
vectors is given. Here is how I modified it:

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

Thanks for the help,

Hector


On 05/23/2018 07:15 PM, Smith, Barry F. wrote:
>   Use -mat_view on the new and old code to verify that the same matrix is actually being generated.
>
>     Barry
>
>
>> On May 23, 2018, at 6:18 PM, Hector E Barrios Molano <hectorb at utexas.edu> wrote:
>>
>> 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
>>
>> mat = PETSC_NULL_MAT
>> ...
>> if(mat .eq. PETSC_NULL_MAT)then
>>      create matrix,vectors, ksp
>> else
>>      KSPSetInitialGuessNonzero
>>      VecResetArray
>> 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:
>>
>> call MatSetValuesBlocked(mat,1,[N-1],IROW,[LC(nnz)],[BB(nnz)],INSERT_VALUES,ierr)
>>
>> After the matrix is built there is a call to
>>
>> KSPSolve
>>
>> 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 --prefix=/home/hector/installed/petsc_git-intel-debug --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-parmetis-dir=/home/hector/installed/parmetis/ --with-metis-dir=/home/hector/installed/parmetis/ --with-zoltan-dir=/home/hector/installed/zoltan/ --with-hypre-dir=/home/hector/installed/hypre --download-ptscotch --with-blaslapack-lib="[/home/hector/installed/intel/compilers_and_libraries_2019.0.046/linux/mkl/lib/intel64/libmkl_intel_lp64.a,/home/hector/installed/intel/compilers_and_libraries_2019.0.046/linux/mkl/lib/intel64/libmkl_core.a,/home/hector/installed/intel/compilers_and_libraries_2019.0.046/linux/mkl/lib/intel64/libmkl_intel_thread.a]" --with-scalapack-include=/home/hector/installed/intel/compilers_and_libraries_2019.0.046/linux/mkl/include --with-scalapack-lib="[/home/hector/installed/intel/compilers_and_libraries_2019.0.046/linux/mkl/lib/intel64/libmkl_scalapack_lp64.a,/home/hector/installed/intel/compilers_and_libraries_2019.0.046/linux/mkl/lib/intel64/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/compilers_and_libraries_2019.0.046/linux/mkl/lib/intel64/libmkl_intel_lp64.a /home/hector/installed/intel/compilers_and_libraries_2019.0.046/linux/mkl/lib/intel64/libmkl_core.a /home/hector/installed/intel/compilers_and_libraries_2019.0.046/linux/mkl/lib/intel64/libmkl_intel_thread.a -Wl,--end-group -liomp5 -ldl -lpthread -lm"
>> [0]PETSC ERROR: #305869 MatILUFactorSymbolic_SeqBAIJ() line 369 in /home/hector/dwnld_prog/petsc/src/mat/impls/baij/seq/baijfact2.c
>> [0]PETSC ERROR: #305870 MatILUFactorSymbolic() line 6522 in /home/hector/dwnld_prog/petsc/src/mat/interface/matrix.c
>> [0]PETSC ERROR: #305871 PCSetUp_ILU() line 144 in /home/hector/dwnld_prog/petsc/src/ksp/pc/impls/factor/ilu/ilu.c
>> [0]PETSC ERROR: #305872 PCSetUp() line 923 in /home/hector/dwnld_prog/petsc/src/ksp/pc/interface/precon.c
>> [0]PETSC ERROR: #305873 KSPSetUp() line 381 in /home/hector/dwnld_prog/petsc/src/ksp/ksp/interface/itfunc.c
>> [0]PETSC ERROR: #305874 KSPSolve() line 612 in /home/hector/dwnld_prog/petsc/src/ksp/ksp/interface/itfunc.c
>>
>>
>> What could be the problem?
>>
>> Thanks for your help,
>>
>> Hector
>>
>>
>>
>> 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/f632dca3/attachment-0001.html>


More information about the petsc-dev mailing list