Search through all your code looking for calls to
VecGetArray()/VecRestoreArray(). For all uses where you only need to read from
the array, replace
the calls with VecGetArrayRead()/VecRestoreArrayRead(). And add the const
modifier to the array declaration.
> On Jun 24, 2023, at 5:32 AM, Paweł Stebliński <[email protected]> wrote:
>
> Welcome
>
> If library nr 3.17.5 is compiled --with-debuging=yes there apears an error.
> This exception is not thrown, and all system seems to work well when one
> compiles --with-debugging=no.
>
> ------ Error Message
> --------------------------------------------------------------
> [79]PETSC ERROR: Object is in wrong state
> [79]PETSC ERROR: Vec is already locked for read-only or read/write access,
> argument # 1
> [79]PETSC ERROR: See https://petsc.org/release/faq/ for trouble shooting.
> [79]PETSC ERROR: Petsc Release Version 3.17.5, Sep 30, 2022
> [79]PETSC ERROR:
> /home/psteb/PRACA/KODY/SYMETRYLLBINTERTWOMODELS_NEW3.9/src/magpar.exe on a
> PETSc-config-magpar named magmain-1 by root Sat Jun 24 11:18:46 2023
> [79]PETSC ERROR: Configure options --with-precision=double
> --download-fblaslapack=1 --with-avx512-kernels=1
> --with-mpi-dir=/home/psteb/PRACA/LIB_NEW3.9/../LIB_NEW/mpi --with-x=0
> --with-clanguage=C++ --with-debugging=yes PETSC_ARCH=PETSc-config-magpar
> [79]PETSC ERROR: #1 VecSetErrorIfLocked() at
> /home/psteb/PRACA/LIB_NEW3.9/petsc-3.17.5.DEBUG/include/petscvec.h:618
> [79]PETSC ERROR: #2 VecGetArray() at
> /home/psteb/PRACA/LIB_NEW3.9/petsc-3.17.5.DEBUG/src/vec/vec/interface/rvector0e+00
> 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> 9.930000e-04 0.000000e+00 3.110177e+00 0.000000e+00 2.353828e-45
> 0.000000e+00 0.000000e+00 0.000000e+00 3.000000e+02 0.000000e+00
> 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 -7.952733e-40
> 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> 0.000000e+00
> 9.940000e-04 0.000000e+00 3.110177e+00 0.000000e+00 1.558555e-45
> 0.000000e+00 0.000000e+00 0.000000e+00 3.000000e+02 0.000000e+00
> 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 -5.271514e-40
> 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> 0.000000e+00
> 9.950000e-04 0.000000e+00 3.110177e+00 0.000000e+00 1.031404e-45
> 0.000000e+00 0.000000e+00 0.000000e+00 3.000000e+02 0.000000e+00
> 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 -3.492309e-40
> 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> 0.000000e+00]PETSC ERROR: #3 JAC3() at
> /home/psteb/PRACA/KODY/SYMETRYLLBINTERTWOMODELS_NEW3.9/src/llb/countmeq.c:161
> [0]PETSC ERROR: #4 TaoComputeJacobian() at
> /home/psteb/PRACA/LIB_NEW3.9/petsc-3.17.5.DEBUG/src/tao/interface/taosolver_hj.c:316
> [0]PETSC ERROR: #5 Tao_SSLS_FunctionGradient() at
> /home/psteb/PRACA/LIB_NEW3.9/petsc-3.17.5.DEBUG/src/tao/complementarity/impls/ssls/ssls.c:51
> [0]PETSC ERROR: #6 TaoLineSearchComputeObjectiveAndGradient() at
> /home/psteb/PRACA/LIB_NEW3.9/petsc-3.17.5.DEBUG/src/tao/linesearch/interface/taolinesearch.c:938
> [0]PETSC ERROR: #7 TaoSolve_SSILS() at
> /home/psteb/PRACA/LIB_NEW3.9/petsc-3.17.5.DEBUG/src/tao/complementarity/impls/ssls/ssils.c:54
> [0]PETSC ERROR: #8 TaoSolve() at
> /home/psteb/PRACA/LIB_NEW3.9/petsc-3.17.5.DEBUG/src/tao/interface/taosolver.c:136
> [0]PETSC ERROR: #9 createMeq() at
> /home/psteb/PRACA/KODY/SYMETRYLLBINTERTWOMODELS_NEW3.9/src/llb/countmeq.c:259
> [0]PETSC ERROR: #10 countMeq() at
> /home/psteb/PRACA/KODY/SYMETRYLLBINTERTWOMODELS_NEW3.9/src/llb/countmeq.c:296
> [0]PETSC ERRO[server]: PMIU_parse_keyvals: unexpected key delimiter at
> character 48 in cmd
>
>
> For petsc nr from 3.19.2 to 3.18.0 for options
>
> --with-debugging=1 --with-cflags='-g -O0' --with-cxxflags='-g -O0'
> --with-fflags='-g -O0'
>
> or
>
> without these options, during execution
>
> There is an error:
>
> [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 --------------------------------------------------------------
>
>
>
>
>
>
> 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
>>> <[email protected]> <mailto:[email protected]> 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.
>>>
>>