geodynamics / pylith

PyLith is a finite element code for the solution of dynamic and quasi-static tectonic deformation problems.
Other
153 stars 96 forks source link

Memory bug in PetscWeakFormSetIndexFunction_Private() #253

Closed baagaard-usgs closed 3 years ago

baagaard-usgs commented 3 years ago

Overview

I am getting a "memory regions overlap" error when trying to run a simple static fault problem MMS test with the new fault integration (single integration patch, no pointwise functions for adjacent faces).

Reproduce

PETSc branch: knepley/pylith PyLith branch: baagaard/fault-integration-dae (forced push)

make install -C libsrc

make check -C tests/mmstests/faults

# To run MMS test in debugger
cd tests/mmstests/faults
lldb .libs/test_faultkin

Error message

pylith::mmstests::TestFaultKin2D_RigidBlocksStatic_TriP1::testDiscretization : OK
pylith::mmstests::TestFaultKin2D_RigidBlocksStatic_TriP1::testResidual[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
[0]PETSC ERROR: Arguments are incompatible
[0]PETSC ERROR: Memory regions overlap: either use PetscMemmov()
              or make sure your copy regions and lengths are correct.
              Length (bytes) 8 first address 140531339881587 second address 140531339881586
[0]PETSC ERROR: See https://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
[0]PETSC ERROR: Petsc Development GIT revision: v3.14.5-832-g1dd008e0f4  GIT Date: 2021-03-22 20:08:06 -0400
[0]PETSC ERROR: /Users/baagaard/scratch/build/clang-3.6.0-py38/cig/pylith/tests/mmstests/faults/.libs/test_faultkin on a arch-clang-3.6.0-py38_debug named igskcicgltgm067 by baagaard Fri Mar 26 14:04:25 2021
[0]PETSC ERROR: Configure options --PETSC_ARCH=arch-clang-3.6.0-py38_debug --with-debugging=1 --with-clanguage=c --with-mpi-compilers=1 --with-shared-libraries=1 --with-64-bit-points=1 --with-large-file-io=1 --with-lgrind=0 --download-chaco=1 --download-parmetis=1 --download-metis=1 --download-triangle --with-blas-lib=/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Versions/Current/libBLAS.dylib --with-lapack-lib=/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Versions/Current/libLAPACK.dylib --download-ml=1 --download-superlu=1 --with-fc=0 --with-hdf5=1 --with-hdf5-include=/Users/baagaard/tools/unix/hdf5-1.12.0/clang-3.6.0/include --with-hdf5-lib=/Users/baagaard/tools/unix/hdf5-1.12.0/clang-3.6.0/lib/libhdf5.dylib --with-zlib=1
[0]PETSC ERROR: #1 PetscMemcpy() line 1806 in /Users/baagaard/tools/unix/petsc-dev/include/petscsys.h
[0]PETSC ERROR: #2 PetscChunkBufferEnlargeChunk() line 64 in /Users/baagaard/tools/unix/petsc-dev/src/dm/dt/interface/dtweakform.c
[0]PETSC ERROR: #3 PetscWeakFormSetIndexFunction_Private() line 194 in /Users/baagaard/tools/unix/petsc-dev/src/dm/dt/interface/dtweakform.c
[0]PETSC ERROR: #4 PetscWeakFormSetIndexBdResidual() line 417 in /Users/baagaard/tools/unix/petsc-dev/src/dm/dt/interface/dtweakform.c
[0]PETSC ERROR: #5 static void pylith::feassemble::_IntegratorInterface::setWeakFormKernels(const pylith::feassemble::IntegratorInterface *, const std::vector<pylith::feassemble::IntegratorInterface::ResidualKernels> &, const pylith::topology::Field &)() line 597 in /Users/baagaard/src/cig/pylith/libsrc/pylith/feassemble/IntegratorInterface.cc
libc++abi.dylib: terminating with uncaught exception of type std::runtime_error: Error detected while in PETSc function.
knepley commented 3 years ago

I pushed a fix to knepley/pylith