<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><br><div><br></div><div>   Older versions of PETSc have generally less error checking and debug versions have more error checking than optimized version. Once you update the code for newer versions it should work clearly for both debug and optimized versions of PETSc.</div><div><br></div><div>  Barry</div><div><br><blockquote type="cite"><div>On Jun 24, 2023, at 12:08 PM, Paweł Stebliński <psteb@bobolin.com.pl> wrote:</div><br class="Apple-interchange-newline"><div>
  
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  
  <div><p>Welcome</p><p>Thank You for Your answer.<br>
    </p><p>I understand the error. When You setValues in Vector, it must be
      assembled. The same in matrices. But exception is not thrown in
      3.17.5 (no debuging switch) and is thrown from 3.18.0 to 3.19.2
      (with or without debugging switch). Error is not thrown in old
      version of petsc 3.1-p8.</p><p>Moreover the exception is thrown in 3.17.5 version (
      --with-debuging=yes) but is not thrown in the version with switch
      --with-debuging=no. Don't You think that it doesn't matter which
      version is considered: with or without debbuging. The exception
      should be thrown in both cases. <br>
    </p><p>If some of the vectores were not assembled it should be thrown
      exception in older version 3.1-p8. But there is no exception in
      older version.</p><p>The code adjustment which is compatible to new petsc was not done
      in such fundamentals details like vector acssembling. The
      programmer should mostly change the names of variables and
      functions from old to new. <br>
    </p><p>Best regards</p><p>Paul<br>
    </p><p><br>
    </p>
    <div class="moz-cite-prefix">W dniu 24.06.2023 o 16:32, Barry Smith
      pisze:<br>
    </div>
    <blockquote type="cite" cite="mid:97F06775-EF0D-4720-BB14-BAE52182267C@petsc.dev">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div><br>
      </div>
        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<br>
      <div><br>
        <blockquote type="cite">
          <div>On Jun 23, 2023, at 6:57 PM, Paweł Stebliński
            <a class="moz-txt-link-rfc2396E" href="mailto:psteb@bobolin.com.pl"><psteb@bobolin.com.pl></a> wrote:</div>
          <br class="Apple-interchange-newline">
          <div>
            <meta http-equiv="Content-Type" content="text/html;
              charset=UTF-8">
            <div><p>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, <br>
              </p><p>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</p><p>running path: <br>
              </p><p>nice -n -20 pathtompi/bin/mpiexec.gforker -np 80
                pathtomagpar/src/magpar.exe $params<br>
              </p><p>OUTPUT (This output, due to distributed processing
                appears long after point of seqaij matrix init.):</p><p>=================================================================================(START)<br>
              </p><p><br>
              </p><p>[6]PETSC ERROR: --------------------- Error Message
                --------------------------------------------------------------<br>
                [6]PETSC ERROR: Object is in wrong state<br>
                [6]PETSC ERROR: Not for unassembled vector, did you call
                VecAssemblyBegin()/VecAssemblyEnd()?<br>
                [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!<br>
                [6]PETSC ERROR:   Option left: name:-addcalorics value:
                0 source: command line<br>
                [6]PETSC ERROR:   Option left: name:-addhtomeq value: 0
                source: command line<br>
                [6]PETSC ERROR:   Option left: name:-addjtog value: 0
                source: command line<br>
                [6]PETSC ERROR:   Option left: name:-addterm value: 0
                source: command line<br>
                [6]PETSC ERROR:   Option left: name:-condinp_j value:
                1e99 source: file<br>
                [6]PETSC ERROR:   Option left: name:-condinp_t value:
                1e-4 source: command line<br>
                [6]PETSC ERROR:   Option left: name:-countG value: 0
                source: command line<br>
                [6]PETSC ERROR:   Option left: name:-countN value: 0
                source: file<br>
                [6]PETSC ERROR:   Option lef[8]PETSC ERROR:
                --------------------- Error Message
                --------------------------------------------------------------<br>
              </p><p><br>
              </p><p>================================================================================(END)<br>
              </p><p><br>
              </p><p><br>
              </p><p>when you set: --with-debuging=no and add to code:  <br>
              </p><p>ierr =
                PetscMallocSetDebug(PETSC_TRUE,PETSC_TRUE);CHKERRQ(ierr);
                in main.c file before matrix initialization. <br>
              </p><p>You get OUTPUT BELOW: (about the point where function
                initialize matrix). <br>
              </p><p>When you comment matrix initialization the exception
                doesn't appear.<br>
              </p><p><br>
                [0]PETSC ERROR: PetscTrFreeDefault() called from
                PetscEventRegLogRegister() at
/home/psteb/PRACA/LIB_NEW/petsc-3.19.2/src/sys/logging/utils/eventlog.c:363<br>
                [0]PETSC ERROR: Block at address 0x55a6d104bbb0 is
                corrupted; cannot free;<br>
                may be block not allocated with PetscMalloc()<br>
                [0]PETSC ERROR: --------------------- Error Message
                --------------------------------------------------------------<br>
                [0]PETSC ERROR: Memory corruption: <a class="moz-txt-link-freetext" href="https://petsc.org/release/faq/#valgrind" moz-do-not-send="true">https://petsc.org/release/faq/#valgrind</a><br>
                [0]PETSC ERROR: Bad location or corrupted memory<br>
                [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!<br>
                [0]PETSC ERROR:   Option left: name:-addcalorics value:
                0 source: command line<br>
                [0]PETSC ERROR:   Option left: name:-addhtomeq value: 0
                source: command line<br>
                [0]PETSC ERROR:   Option left: name:-addjtog value: 0
                source: command line<br>
                [0]PETSC ERROR:   Option left: name:-addterm value: 0
                source: command line<br>
                [0]PETSC ERROR:   Option left: name:-condinp_j value:
                1e99 source: file<br>
                [0]PETSC ERROR:   Option left: name:-condinp_t value:
                1e-4 source: command line<br>
                [0]PETSC ERROR:   Option left: name:-countG value: 0
                source: command line<br>
                [0]PETSC ERROR:   Option left: name:-countN value: 0
                source: file<br>
                [0]PETSC ERROR:   Option left: name:-D value: 20.0
                source: file<br>
                [0]PETSC ERROR:   Option left: name:-demag value: 0
                source: command line<br>
                [0]PETSC ERROR:   Option left: name:-dmi value: 2
                source: command line<br>
                [0]PETSC ERROR:   Option left: name:-dmi_xyzfile value:
                dmi.xyz source[server]: PMIU_parse_keyvals: unexpected
                key delimiter at character 48 in cmd<br>
                <br>
              </p><p>IN POLAND is midnight so I go sleep. Tommorow i will
                check --with-cflags='-g -O0'   --with-cxxflags='-g -O0'
                --with-fflags='-g -O0'</p><p>Best Regards</p><p>Paul Steblinski<br>
              </p><p><br>
              </p><p><br>
              </p>
              <div class="moz-cite-prefix">W dniu 23.06.2023 o 23:41,
                Barry Smith pisze:<br>
              </div>
              <blockquote type="cite" cite="mid:ACE3B0C6-BAA1-4CE4-857A-21A4AC65F667@petsc.dev">
                <meta http-equiv="content-type" content="text/html;
                  charset=UTF-8">
                <div><br>
                </div>
                  Could you send us the exact error output that occurs?
                Cut and paste the run command and the entire error
                message.
                <div><br>
                </div>
                <div>   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?</div>
                <div><br>
                </div>
                <div>  Barry</div>
                <div><br>
                  <div><br>
                  </div>
                  <div><br>
                    <div><br>
                      <blockquote type="cite">
                        <div>On Jun 23, 2023, at 5:30 PM, Paweł
                          Stebliński via petsc-users <a class="moz-txt-link-rfc2396E" href="mailto:petsc-users@mcs.anl.gov" moz-do-not-send="true"><petsc-users@mcs.anl.gov></a>
                          wrote:</div>
                        <br class="Apple-interchange-newline">
                        <div>
                          <meta http-equiv="content-type" content="text/html; charset=UTF-8">
                          <div><p>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. <span class="Y2IQFc" lang="en">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.</span></p><p><span class="Y2IQFc" lang="en">The
                                exception is not thrown if we comment
                                code fragment below.<br>
                              </span></p><p><span class="Y2IQFc" lang="en">ierr =
                                MatCreateSeqAIJ(<br>
                                    PETSC_COMM_SELF,<br>
                                    nvert,nvert,<br>
                                    0,ia,<br>
                                    &mat<br>
                                  );CHKERRQ(ierr);<br>
                                  ierr =
                                MatSetFromOptions(mat);CHKERRQ(ierr);</span></p><p><span class="Y2IQFc" lang="en">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.<br>
                              </span></p>
                          </div>
                        </div>
                      </blockquote>
                    </div>
                    <br>
                  </div>
                </div>
              </blockquote>
            </div>
          </div>
        </blockquote>
      </div>
      <br>
    </blockquote>
  </div>

</div></blockquote></div><br></body></html>