Hi Matt,

I think there is a typo in the following code (line 633 and 636 in plexpreallocate.c).

==================
  } else {
    /* Only loop over blocks of rows */
    for (r = rStart/bs; r < rEnd/bs; ++r) {
      const PetscInt row = r*bs;
      PetscInt       numCols, cStart, c;

      ierr = PetscSectionGetDof(sectionAdj, row, &numCols);CHKERRQ(ierr);
      ierr = PetscSectionGetOffset(sectionAdj, row, &cStart);CHKERRQ(ierr);
      for (c = cStart; c < cStart+numCols; ++c) {
        if ((cols[c] >= rStart*bs) && (cols[c] < rEnd*bs)) {
          ++dnz[r-rStart];
if (cols[c] >= row) ++dnzu[r-rStart]; // I think "dnzu[r-rStart]" should be "dnzu[r-rStart/bs]", right?
        } else {
          ++onz[r-rStart];
if (cols[c] >= row) ++onzu[r-rStart]; // I think "onzu[r-rStart]" should be "onzu[r-rStart/bs]" , right?
        }
      }
    }
    for (r = 0; r < (rEnd - rStart)/bs; ++r) {
      dnz[r]  /= bs;
      onz[r]  /= bs;
      dnzu[r] /= bs;
      onzu[r] /= bs;
    }
  }
==================

Best,
Rongliang

On 08/18/2016 06:08 PM, Matthew Knepley wrote:
On Thu, Aug 18, 2016 at 5:05 AM, Rongliang Chen <rongliang.c...@gmail.com <mailto:rongliang.c...@gmail.com>> wrote:

    Hi Matt,

    The log of the valgrind is attached. When I run with valgrind, the
    following error message comes up.


The valgrind log says your code is writing over memory. Fix that first.

   Matt

    -------------------------
    [1]PETSC ERROR: --------------------- Error Message
    --------------------------------------------------------------
    [1]PETSC ERROR: Arguments are incompatible
    [1]PETSC ERROR: Cannot change block size 3670016 to 7
    [1]PETSC ERROR: See
    http://www.mcs.anl.gov/petsc/documentation/faq.html
    <http://www.mcs.anl.gov/petsc/documentation/faq.html> for trouble
    shooting.
    [1]PETSC ERROR: Petsc Release Version 3.6.3, Dec, 03, 2015
    [1]PETSC ERROR: ./fsi on a 64bit-debug named rlchen by rlchen Thu
    Aug 18 17:59:43 2016
    [1]PETSC ERROR: Configure options --download-blacs
    --download-scalapack --download-metis --download-parmetis
    --download-exodusii --download-netcdf --download-hdf5
    --with-mpi-dir=/home/rlchen/soft/Program/mpich2-shared
    --with-debugging=1 --download-fblaslapack --with-64-bit-indices
    [1]PETSC ERROR: #1 PetscLayoutSetBlockSize() line 424 in
    /home/rlchen/soft/petsc-3.6.3/src/vec/is/utils/pmap.c
    [1]PETSC ERROR: #2 MatSetBlockSize() line 6920 in
    /home/rlchen/soft/petsc-3.6.3/src/mat/interface/matrix.c
    [1]PETSC ERROR: #3 MatXAIJSetPreallocation() line 282 in
    
/home/rlchen/soft/3D_fluid/FSI/Spmcs-v1.5/Fluid-petsc-3.6/src/application/Fluid/gcreate.c
    ----------------------

    Best regards,
    Rongliang

    On 08/18/2016 05:52 PM, Matthew Knepley wrote:
    Run with valgrind and send the log.

      Thanks,

         Matt

    On Thu, Aug 18, 2016 at 3:59 AM, Rongliang Chen
    <rongliang.c...@gmail.com <mailto:rongliang.c...@gmail.com>> wrote:

        Dear All,

        I try to use the block matrix (BAIJ) for the dmplex data
        structure with the option "-dm_mat_type baij" (the block size
        is 7). The code works fine when np = 1 but the following
        error comes up when np>1. And the code also works fine for
        np>1 if I set the block size to be 1. Any suggestions are
        highly appreciated.

        ----------------------------------------------------
        [1]PETSC ERROR: PetscMallocValidate: error detected at
        VecAXPY_Seq() line 89 in
        /home/rlchen/soft/petsc-3.6.3/src/vec/vec/impls/seq/bvec1.c
        [1]PETSC ERROR: Memory at address 0x1332571 is corrupted
        [1]PETSC ERROR: Probably write past beginning or end of array
        [1]PETSC ERROR: Last intact block allocated in
        PetscStrallocpy() line 188 in
        /home/rlchen/soft/petsc-3.6.3/src/sys/utils/str.c
        [1]PETSC ERROR: --------------------- Error Message
        --------------------------------------------------------------
        [1]PETSC ERROR: Memory corruption:
        http://www.mcs.anl.gov/petsc/documentation/installation.html#valgrind
        <http://www.mcs.anl.gov/petsc/documentation/installation.html#valgrind>
        [1]PETSC ERROR:
        [1]PETSC ERROR: See
        http://www.mcs.anl.gov/petsc/documentation/faq.html
        <http://www.mcs.anl.gov/petsc/documentation/faq.html> for
        trouble shooting.
        [1]PETSC ERROR: Petsc Release Version 3.6.3, Dec, 03, 2015
        [1]PETSC ERROR: ./fsi on a 64bit-debug named rlchen by rlchen
        Thu Aug 18 16:42:34 2016
        [1]PETSC ERROR: Configure options --download-blacs
        --download-scalapack --download-metis --download-parmetis
        --download-exodusii --download-netcdf --download-hdf5
        --with-mpi-dir=/home/rlchen/soft/Program/mpich2-shared
        --with-debugging=1 --download-fblaslapack --with-64-bit-indices
        [1]PETSC ERROR: #1 PetscMallocValidate() line 136 in
        /home/rlchen/soft/petsc-3.6.3/src/sys/memory/mtr.c
        [1]PETSC ERROR: #2 VecAXPY_Seq() line 89 in
        /home/rlchen/soft/petsc-3.6.3/src/vec/vec/impls/seq/bvec1.c
        [1]PETSC ERROR: #3 VecAXPY() line 640 in
        /home/rlchen/soft/petsc-3.6.3/src/vec/vec/interface/rvector.c
        ---------------------------------------------------

        Best regards,
        Rongliang




-- What most experimenters take for granted before they begin their
    experiments is infinitely more interesting than any results to
    which their experiments lead.
    -- Norbert Wiener




--
What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
-- Norbert Wiener

Reply via email to