[petsc-users] Problem with MatMPIAIJSetPreallocation

Matthew Thomas matthew.thomas1 at anu.edu.au
Tue Nov 26 20:41:39 CST 2024


Hello,

I found a type elsewhere in my code and have fixed this issue.

Thanks,
Matt

On 27 Nov 2024, at 12:06 PM, Matthew Thomas <Matthew.Thomas1 at anu.edu.au> wrote:

Hello,


When I use MatMPIAIJSetPreallocation I get an argument out of range error, as below,


[15]PETSC ERROR: Argument out of range
[15]PETSC ERROR: New nonzero at (8,421) caused a malloc. Use MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check


However, when I run the code again with identical parameters without MatMPIAIJSetPreallocation, there is no non-zero at the location that caused the error (8, 421). Using -mat_view I can see that row 8 only contains a single value at column 8, which is expected and what I have allocated for.

I have also checked that every time I call MatSetValues that this location is not being set.

I am very confident my dnnz and onnz arrays have been set correctly, do you have any idea why this new non-zero is created?

I am using Petsc version 3.22.1 and Slepc version 3.22.1 with fortran.

This issue does not occur with small number of processors, (1-8), however, this error is consistent when I use >8 processors.

Thanks,
Matt

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


More information about the petsc-users mailing list