[petsc-users] New nonzero caused a malloc

George Pau gpau at lbl.gov
Thu Apr 4 15:01:48 CDT 2013


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/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130404/0f0a408e/attachment.html>


More information about the petsc-users mailing list