[petsc-users] MatSetValues problem

Sanjay Govindjee s_g at berkeley.edu
Tue Mar 12 12:19:45 CDT 2013


Matt, I take it then that I should ignore the indicies that are printed 
and just chase
the values I found up the stack to see why my preallocation missed them.

James, thanks for the comment on MatSetOptions -- that option does 
remove the malloc-error-warning.
I guess I now need to determine the why.

-sanjay

> On Tue, Mar 12, 2013 at 1:14 AM, Sanjay Govindjee <s_g at berkeley.edu 
> <mailto:s_g at berkeley.edu>> wrote:
>
>     I am having a problem with MatSetValues.  I have a two processor
>     run that spits the following error:
>
>     [0]PETSC ERROR: MatSetValues_MPIAIJ() line 564 in
>     /Users/sg/petsc-3.3-p5/src/mat/impls/aij/mpi/mpiaij.c New nonzero
>     at (1,1) caused a malloc
>     [1]PETSC ERROR: MatSetValues_MPIAIJ() line 564 in
>     /Users/sg/petsc-3.3-p5/src/mat/impls/aij/mpi/mpiaij.c New nonzero
>     at (18,-1) caused a malloc
>
>
> It is giving you local indices. This error occurs down inside the 
> macro in aij.h for setting a value
> in a serial AIJ matrix. We have not found an easy way to do index 
> translation on the way up.
>
>   Thanks,
>
>      Matt


On 3/12/13 5:38 AM, Ramsey, James J CIV (US) wrote:
> ________________________________________
>
> The "New nonzero at <fill in the blank> caused a malloc" error looks like what happens if the preallocation is not exact. What happens if you add
>
> call MatSetOption(Kglobal, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE, ierr)
>
> after your call to your preallocation subroutine?
> ________________________________________
>
> Oh, of course Kglobal should be replaced by whatever matrix you are trying to set the values of.
>

-- 
-----------------------------------------------
Sanjay Govindjee, PhD, PE
Professor of Civil Engineering
Vice Chair for Academic Affairs

779 Davis Hall
Structural Engineering, Mechanics and Materials
Department of Civil Engineering
University of California
Berkeley, CA 94720-1710

Voice:  +1 510 642 6060
FAX:    +1 510 643 5264
s_g at berkeley.edu
http://www.ce.berkeley.edu/~sanjay
-----------------------------------------------

New Books:

Engineering Mechanics of Deformable
Solids: A Presentation with Exercises
http://www.oup.com/us/catalog/general/subject/Physics/MaterialsScience/?view=usa&ci=9780199651641
http://ukcatalogue.oup.com/product/9780199651641.do
http://amzn.com/0199651647


Engineering Mechanics 3 (Dynamics)
http://www.springer.com/materials/mechanics/book/978-3-642-14018-1
http://amzn.com/3642140181

-----------------------------------------------

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130312/8e9f53d0/attachment.html>


More information about the petsc-users mailing list