<div dir="ltr"><div>My code seems tob running correctly with threads but I get this error in PetscFinalize.</div><div><br></div><div>I Looked at this in DDT and got an error in free here:</div><div><br></div><div>PetscErrorCode PetscStackDestroy(void)<br>{<br>  if (PetscStackActive()) {<br>    free(petscstack);<br>    petscstack = NULL;<br>  }<br>  return 0;<br>}<br></div><div><br></div><div>This error did not happen with one thread.</div><div><br></div><div>Any ideas?</div><div>Thanks,</div><div><br></div>*** Error in `./ex11': corrupted size vs. prev_size: 0x0000000043fb8070 ***<br>======= Backtrace: =========<br>/lib64/libc.so.6(+0x92344)[0x200022e72344]<br>/lib64/libc.so.6(cfree+0xa5c)[0x200022e7a19c]<br>/autofs/nccs-svm1_sw/summit/.swci/1-compute/opt/spack/20180914/linux-rhel7-ppc64le/gcc-6.4.0/spectrum-mpi-10.3.1.2-20200121-awz2q5brde7wgdqqw4ugalrkukeub4eb/container/../lib/spectrum_mpi/mca_pml_pami.so(mca_pml_pami_del_comm+0xc0)[0x2000269f7690]<br>/autofs/nccs-svm1_sw/summit/.swci/1-compute/opt/spack/20180914/linux-rhel7-ppc64le/gcc-6.4.0/spectrum-mpi-10.3.1.2-20200121-awz2q5brde7wgdqqw4ugalrkukeub4eb/container/../lib/libmpi_ibm.so.3(+0x4d830)[0x200022c0d830]<br>/autofs/nccs-svm1_sw/summit/.swci/1-compute/opt/spack/20180914/linux-rhel7-ppc64le/gcc-6.4.0/spectrum-mpi-10.3.1.2-20200121-awz2q5brde7wgdqqw4ugalrkukeub4eb/container/../lib/libmpi_ibm.so.3(ompi_comm_free+0x244)[0x200022c10354]<br>/autofs/nccs-svm1_sw/summit/.swci/1-compute/opt/spack/20180914/linux-rhel7-ppc64le/gcc-6.4.0/spectrum-mpi-10.3.1.2-20200121-awz2q5brde7wgdqqw4ugalrkukeub4eb/container/../lib/libmpi_ibm.so.3(PMPI_Comm_free+0xb4)[0x200022c5ae54]<br>/ccs/home/adams/petsc/arch-summit-dbg-gnu-cuda-omp/lib/libpetsc.so.3.013(+0x16c65a4)[0x2000017b65a4]<br>/ccs/home/adams/petsc/arch-summit-dbg-gnu-cuda-omp/lib/libpetsc.so.3.013(PetscPartitionerDestroy+0x73c)[0x2000017a750c]<br>/ccs/home/adams/petsc/arch-summit-dbg-gnu-cuda-omp/lib/libpetsc.so.3.013(+0x164c474)[0x20000173c474]<br>/ccs/home/adams/petsc/arch-summit-dbg-gnu-cuda-omp/lib/libpetsc.so.3.013(DMDestroy+0x2bcc)[0x200001b006a4]<br>/ccs/home/adams/petsc/arch-summit-dbg-gnu-cuda-omp/lib/libpetsc.so.3.013(PetscDualSpaceDestroy+0x95c)[0x200001a5a314]<br>/ccs/home/adams/petsc/arch-summit-dbg-gnu-cuda-omp/lib/libpetsc.so.3.013(+0x196919c)[0x200001a5919c]<br>/ccs/home/adams/petsc/arch-summit-dbg-gnu-cuda-omp/lib/libpetsc.so.3.013(PetscDualSpaceDestroy+0x750)[0x200001a5a108]<br>/ccs/home/adams/petsc/arch-summit-dbg-gnu-cuda-omp/lib/libpetsc.so.3.013(PetscFEDestroy+0xb1c)[0x200001a89734]<br>/ccs/home/adams/petsc/arch-summit-dbg-gnu-cuda-omp/lib/libpetsc.so.3.013(PetscObjectDereference+0x494)[0x200000241484]<br>/ccs/home/adams/petsc/arch-summit-dbg-gnu-cuda-omp/lib/libpetsc.so.3.013(PetscDSDestroy+0x8cc)[0x200001acded0]<br>/ccs/home/adams/petsc/arch-summit-dbg-gnu-cuda-omp/lib/libpetsc.so.3.013(DMClearDS+0x30c)[0x200001b387ac]<br>/ccs/home/adams/petsc/arch-summit-dbg-gnu-cuda-omp/lib/libpetsc.so.3.013(DMDestroy+0x2a30)[0x200001b00508]<br>/ccs/home/adams/petsc/arch-summit-dbg-gnu-cuda-omp/lib/libpetsc.so.3.013(+0x164cb58)[0x20000173cb58]<br>/ccs/home/adams/petsc/arch-summit-dbg-gnu-cuda-omp/lib/libpetsc.so.3.013(DMDestroy+0x2bcc)[0x200001b006a4]<br>/ccs/home/adams/petsc/arch-summit-dbg-gnu-cuda-omp/lib/libpetsc.so.3.013(+0x149066c)[0x20000158066c]<br>/ccs/home/adams/petsc/arch-summit-dbg-gnu-cuda-omp/lib/libpetsc.so.3.013(+0x1475908)[0x200001565908]<br>/ccs/home/adams/petsc/arch-summit-dbg-gnu-cuda-omp/lib/libpetsc.so.3.013(DMDestroy+0x2bcc)[0x200001b006a4]<br>/ccs/home/adams/petsc/arch-summit-dbg-gnu-cuda-omp/lib/libpetsc.so.3.013(PetscObjectDereference+0x494)[0x200000241484]<br>/ccs/home/adams/petsc/arch-summit-dbg-gnu-cuda-omp/lib/libpetsc.so.3.013(PetscObjectListDestroy+0x1c8)[0x20000022ebe8]<br>/ccs/home/adams/petsc/arch-summit-dbg-gnu-cuda-omp/lib/libpetsc.so.3.013(PetscHeaderDestroy_Private+0x628)[0x20000023b50c]<br>/ccs/home/adams/petsc/arch-summit-dbg-gnu-cuda-omp/lib/libpetsc.so.3.013(VecDestroy+0x794)[0x200000b70e50]<br>./ex11[0x1000f6c8]<br>/lib64/libc.so.6(+0x25200)[0x200022e05200]<br>/lib64/libc.so.6(__libc_start_main+0xc4)[0x200022e053f4]<br>======= Memory map: ========<br>10000000-10020000 r-xp 00000000 00:30 155767402                          /autofs/nccs-svm1_home1/adams/petsc/src/dm/impls/plex/tutorials/ex11<br>10020000-10030000 r--p 00010000 00:30 155767402                          /autofs/nccs-svm1_home1/adams/petsc/src/dm/impls/plex/tutorials/ex11<br>10030000-10040000 rw-p 00020000 00:30 155767402                          /autofs/nccs-svm1_home1/adams/petsc/src/dm/impls/plex/tutorials/ex11<br>43330000-43800000 rw-p 00000000 00:00 0                                  [heap]<br>43800000-43810000 rw-p 00000000 00:00 0                                  [heap]<br></div>