Look for places where you call VecSetValues(), make sure that after the call 
before you use the vector for some other use you call 
VecAssemblyBegin/VecAssemblyEnd

> On Jun 23, 2023, at 6:57 PM, Paweł Stebliński <ps...@bobolin.com.pl> wrote:
> 
> I'm using petsc 3.19.2 --with-debuging=yes (generated executable a little 
> bigger than with no option). MPICH2 4.1.1. also --download-fblaslapack=1, 
> --with-clanguage=C++, --with-mpi-dir=pathtompi, --with-x=0, 
> --with-precision=DOUBLE, 
> 
> I have changed in PETSC_ARCH directory in file petscvariables: CLANGUAGE = 
> from CXX to C due to fact that I am using CFLAGS variable indicating Include 
> files in Makefile
> 
> running path: 
> 
> nice -n -20 pathtompi/bin/mpiexec.gforker -np 80 pathtomagpar/src/magpar.exe 
> $params
> 
> OUTPUT (This output, due to distributed processing appears long after point 
> of seqaij matrix init.):
> 
> =================================================================================(START)
> 
> 
> 
> [6]PETSC ERROR: --------------------- Error Message 
> --------------------------------------------------------------
> [6]PETSC ERROR: Object is in wrong state
> [6]PETSC ERROR: Not for unassembled vector, did you call 
> VecAssemblyBegin()/VecAssemblyEnd()?
> [6]PETSC ERROR: WARNING! There are option(s) set that were not used! Could be 
> the program crashed before they were used or a spelling mistake, etc!
> [6]PETSC ERROR:   Option left: name:-addcalorics value: 0 source: command line
> [6]PETSC ERROR:   Option left: name:-addhtomeq value: 0 source: command line
> [6]PETSC ERROR:   Option left: name:-addjtog value: 0 source: command line
> [6]PETSC ERROR:   Option left: name:-addterm value: 0 source: command line
> [6]PETSC ERROR:   Option left: name:-condinp_j value: 1e99 source: file
> [6]PETSC ERROR:   Option left: name:-condinp_t value: 1e-4 source: command 
> line
> [6]PETSC ERROR:   Option left: name:-countG value: 0 source: command line
> [6]PETSC ERROR:   Option left: name:-countN value: 0 source: file
> [6]PETSC ERROR:   Option lef[8]PETSC ERROR: --------------------- Error 
> Message --------------------------------------------------------------
> 
> 
> 
> ================================================================================(END)
> 
> 
> 
> 
> 
> when you set: --with-debuging=no and add to code:  
> 
> ierr = PetscMallocSetDebug(PETSC_TRUE,PETSC_TRUE);CHKERRQ(ierr); in main.c 
> file before matrix initialization. 
> 
> You get OUTPUT BELOW: (about the point where function initialize matrix). 
> 
> When you comment matrix initialization the exception doesn't appear.
> 
> 
> [0]PETSC ERROR: PetscTrFreeDefault() called from PetscEventRegLogRegister() 
> at /home/psteb/PRACA/LIB_NEW/petsc-3.19.2/src/sys/logging/utils/eventlog.c:363
> [0]PETSC ERROR: Block at address 0x55a6d104bbb0 is corrupted; cannot free;
> may be block not allocated with PetscMalloc()
> [0]PETSC ERROR: --------------------- Error Message 
> --------------------------------------------------------------
> [0]PETSC ERROR: Memory corruption: https://petsc.org/release/faq/#valgrind
> [0]PETSC ERROR: Bad location or corrupted memory
> [0]PETSC ERROR: WARNING! There are option(s) set that were not used! Could be 
> the program crashed before they were used or a spelling mistake, etc!
> [0]PETSC ERROR:   Option left: name:-addcalorics value: 0 source: command line
> [0]PETSC ERROR:   Option left: name:-addhtomeq value: 0 source: command line
> [0]PETSC ERROR:   Option left: name:-addjtog value: 0 source: command line
> [0]PETSC ERROR:   Option left: name:-addterm value: 0 source: command line
> [0]PETSC ERROR:   Option left: name:-condinp_j value: 1e99 source: file
> [0]PETSC ERROR:   Option left: name:-condinp_t value: 1e-4 source: command 
> line
> [0]PETSC ERROR:   Option left: name:-countG value: 0 source: command line
> [0]PETSC ERROR:   Option left: name:-countN value: 0 source: file
> [0]PETSC ERROR:   Option left: name:-D value: 20.0 source: file
> [0]PETSC ERROR:   Option left: name:-demag value: 0 source: command line
> [0]PETSC ERROR:   Option left: name:-dmi value: 2 source: command line
> [0]PETSC ERROR:   Option left: name:-dmi_xyzfile value: dmi.xyz 
> source[server]: PMIU_parse_keyvals: unexpected key delimiter at character 48 
> in cmd
> 
> 
> IN POLAND is midnight so I go sleep. Tommorow i will check --with-cflags='-g 
> -O0'   --with-cxxflags='-g -O0' --with-fflags='-g -O0'
> 
> Best Regards
> 
> Paul Steblinski
> 
> 
> 
> 
> 
> W dniu 23.06.2023 o 23:41, Barry Smith pisze:
>> 
>>   Could you send us the exact error output that occurs? Cut and paste the 
>> run command and the entire error message.
>> 
>>    Also send the configure options you used. Have you tried configuring the 
>> later PETSc versions with all optimization turned off; use 
>> --with-debugging=1 --with-cflags='-g -O0'   --with-cxxflags='-g -O0' 
>> --with-fflags='-g -O0'  Does the same error occur?
>> 
>>   Barry
>> 
>> 
>> 
>> 
>>> On Jun 23, 2023, at 5:30 PM, Paweł Stebliński via petsc-users 
>>> <petsc-users@mcs.anl.gov> <mailto:petsc-users@mcs.anl.gov> wrote:
>>> 
>>> I am micromagnetic (MAGPAR) software developer. Old Magpar version has been 
>>> using petsc 3.1-p8. I have decided to upgrade to petsc 3.19.2 with avx512 
>>> support. Unfortunately there appeared an error during software testing. 
>>> Error appeares in ranning code after proper compiling and linking. The bug 
>>> is in a code part which initializes matrix in petsc library versions: 
>>> 3.19.2, 3.19.1, 3.19.0 and also from 3.18.5 to 3.18.0. If we use petsc 
>>> version 3.17.5 the error doesn't appear. With this version (3.17.5) all is 
>>> ok and simulation is running without any errors or throwing exceptions. My 
>>> guess is linked to avx512 implementation which is good up to 3.17.5 version 
>>> and buggy in upper mentioned versions with higher numbers. Avx512 is buggy 
>>> according to tested SeqAij matrices.
>>> 
>>> The exception is not thrown if we comment code fragment below.
>>> 
>>> ierr = MatCreateSeqAIJ(
>>>     PETSC_COMM_SELF,
>>>     nvert,nvert,
>>>     0,ia,
>>>     &mat
>>>   );CHKERRQ(ierr);
>>>   ierr = MatSetFromOptions(mat);CHKERRQ(ierr);
>>> 
>>> ia - is number of nonzeros array which is obtained according parmetis 
>>> partitioning. There were the same version of parmetis  (3.1.1) in the all 
>>> considered cases.
>>> 
>> 

Reply via email to