[petsc-users] New nonzero caused a malloc

Barry Smith bsmith at mcs.anl.gov
Thu Oct 5 03:47:11 CDT 2017


  Please always, always, always include the entire error message not just part of it.

> On Oct 5, 2017, at 8:59 AM, Luca Verzeroli <l.verzeroli at studenti.unibg.it> wrote:
> 
> Good mornig,
> 
> I'm new to PETSc and i'm wondering about this problem.
> 
> When i run my code with 2 processes I have no problem. When i use more than 2 processes I receive this message:
> 
> [1]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
> [1]PETSC ERROR: Argument out of range
> [1]PETSC ERROR: New nonzero at (0,43) caused a malloc
> Use MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check
> 
> This means that a process is trying to write in cell (0,43)?

   It may not be at the global location 0,43 if we had the full error message then we would know more. But at some location it is trying to put in a value and not enough space has been preallocated.
> 
> Then I try with MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) and I
> 
> check with MatView if there's an element in (0,43) but nothing is written there.
> 
> Otherwise, I have checked the index I use to insert element in the matrix but no (0,43) is present.
> 
> 
> Could you give me some advices about the possible solution of this problem?

  Please read up on the whole business of preallocation, http://www.mcs.anl.gov/petsc/documentation/faq.html#efficient-assembly



> 
> Luca
> 



More information about the petsc-users mailing list