[petsc-users] Preallocation Memory of Finite Element Method's Sparse Matrices

吕超 luchao at mail.iggcas.ac.cn
Thu Mar 20 21:36:20 CDT 2014

Your faithfully:

     program src/ksp/ksp/examples/tutorials/ex3.c.html is about Bilinear elements on the unit square for Laplacian.

     After preallocation using   

     "ierr  = MatMPIAIJSetPreallocation(A,9,NULL,5,NULL);CHKERRQ(ierr); /* More than necessary */",

     Results of commands of "mpiexec -n 2 ./ex3" and "mpiexec -n 2 ./ex3" are "Norm of error 2.22327e-06 Iterations 6" and "Norm of error 3.12849e-07 Iterations 8". Both results is good!

     However, if I use "mpiexec -n 4 ./ex3" or 5,6,7...precesses, error "[2]PETSC ERROR: New nonzero at (4,29) (here is for process 4, other positions for different processes) caused a malloc!" appear!. For me, this error is unbelievable, because first, the preallocation is more than necessary,how can the new malloc appear? Second, the global number 4 point originally have no neighbor vertices whose global number is 29! This error have tortured me for long times.

     This error seems meaningless, however, my recent 3d finite element method cannot be caculated by more processesowing to the new nonzero malloc!And this is why I want to use 4 or much more processes to compute ex3.c.

     Thank you for all previous assistence and hope you have a good life!

your sincerely



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

More information about the petsc-users mailing list