[petsc-users] New nonzero caused a malloc
Satish Balay
balay at mcs.anl.gov
Thu Apr 4 15:36:05 CDT 2013
This is fortran where pierr return status is ignored. So the -info for
this run is useless.
You can do the following to tell petsc to go ahead with the malloc -
and not set an error [for the extra mallocs]. Now '-info' should list
the mallocs that took place.
call MatSetOption(petsc_obj%jacmat,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_FALSE,pierr)
Or use a debugger [with a breakpoint in PetscError] to determine the
exact place in code that causes the extra malloc - and then see why
that value was not counted towards preallocation
Satish
On Thu, 4 Apr 2013, George Pau wrote:
> Hi
>
> Just a follow up on the previous email which was sent accidentally. The
> info during assembly indicates there is no mallocs (typo in previous
> email). In addition, mncon is 18 and so the total nonzero column blocks
> per row block is greater than the nonzero blocks shown. If I use a single
> processor, I do not see the above error.
>
> Thanks,
> George
>
>
>
> On Thu, Apr 4, 2013 at 1:01 PM, George Pau <gpau at lbl.gov> wrote:
>
> > Hi,
> >
> > I am trying to determine where there is malloc when I am doing a
> > MatSetValuesBlocked. The following is the error:
> >
> > [1]PETSC ERROR: --------------------- Error Message
> > ------------------------------------
> > [1]PETSC ERROR: Argument out of range!
> > [1]PETSC ERROR: New nonzero at (69216,95036) caused a malloc!
> >
> > However, when I look at the info during the assembly, I have
> >
> > [0] MatAssemblyBegin_MPIBAIJ(): Stash has 0 entries,uses 0 mallocs.
> > [0] MatAssemblyBegin_MPIBAIJ(): Block-Stash has 0 entries, uses 0 mallocs.
> > [1] MatAssemblyEnd_SeqBAIJ(): Matrix size: 381300 X 381300, block size 4;
> > storage space: 14143776 unneeded, 10259424 used
> > [1] MatAssemblyEnd_SeqBAIJ(): Number of mallocs during MatSetValues is 0
> > [1] MatAssemblyEnd_SeqBAIJ(): Most nonzeros blocks in any row is 16
> > [0] MatAssemblyEnd_SeqBAIJ(): Matrix size: 381300 X 381300, block size 4;
> > storage space: 13696176 unneeded, 10707024 used
> > [0] MatAssemblyEnd_SeqBAIJ(): Number of mallocs during MatSetValues is 0
> > [0] MatAssemblyEnd_SeqBAIJ(): Most nonzeros blocks in any row is 11
> >
> > which indicates there is mallocs.
> >
> > The following is how I set up the matrix:
> >
> > call MatCreate(PETSC_COMM_WORLD,petsc_obj%jacmat, pierr)
> > call
> > MatSetSizes(petsc_obj%jacmat,PETSC_DECIDE,PETSC_DECIDE,nel*neq,nel*neq,pierr)
> > call MatSetFromOptions(petsc_obj%jacmat,pierr)
> > call MatSetBlockSize(petsc_obj%jacmat,neq,pierr)
> > call MatSetType(petsc_obj%jacmat,MATBAIJ,pierr)
> > call
> > MatSeqBAIJSetPreallocation(petsc_obj%jacmat,neq,(mncon+1)*neq*neq,PETSC_NULL_INTEGER,pierr)
> > call MatMPIBAIJSetPreallocation(petsc_obj%jacmat,
> > neq,neq*neq,PETSC_NULL_INTEGER,mncon*neq*neq,PETSC_NULL_INTEGER,pierr)
> > call MatSetOption(petsc_obj%jacmat,MAT_ROW_ORIENTED,PETSC_FALSE,pierr)
> > !because of how aval is stored.
> >
> > --
> > George Pau
> > Earth Sciences Division
> > Lawrence Berkeley National Laboratory
> > One Cyclotron, MS 74-120
> > Berkeley, CA 94720
> >
> > (510) 486-7196
> > gpau at lbl.gov
> > http://esd.lbl.gov/about/staff/georgepau/
> >
>
>
>
>
More information about the petsc-users
mailing list