[petsc-users] About the use of MatMPIAIJSetPreallocation in 3.3
w_ang_temp
w_ang_temp at 163.com
Wed Nov 7 08:43:12 CST 2012
Hello,
Version3.3 makes some change on Preallocation.
(1)In version 3.2, my codes are as follows:
call MatGetOwnershipRange(A,Istart,Iend,ierr)
!premalloc
!find the max non-zero numbers of all rows
maxnonzero=0
do 19,II=Istart+1,Iend
!no-zero numbers of this row
maxnonzeroII=NROWIN(II+1)-NROWIN(II)
if (maxnonzeroII>maxnonzero) then
maxnonzero=maxnonzeroII
endif
19 continue
call MatMPIAIJSetPreallocation(A,maxnonzero,PETSC_NULL_INTEGER,maxnonzero,PETSC_NULL_INTEGER,ierr)
(2)In version 3.3, my codes are as follows:
!premalloc
!find the max non-zero numbers of all rows
maxnonzero=0
do 19,II=1,m
!no-zero numbers of this row
maxnonzeroII=NROWIN(II+1)-NROWIN(II)
if (maxnonzeroII>maxnonzero) then
maxnonzero=maxnonzeroII
endif
19 continue
call MatMPIAIJSetPreallocation(A,maxnonzero,PETSC_NULL_INTEGER,maxnonzero,PETSC_NULL_INTEGER,ierr)
call MatGetOwnershipRange(A,Istart,Iend,ierr)
The modification is:in version3.3, MatMPIAIJSetPreallocation must be in the front of MatGetOwnershipRange.
And then when I call MatMPIAIJSetPreallocation, I cannot get "Istart&Iend". So I have to use "do 19,II=1,m"
instead of "do 19,II=Istart+1,Iend" to get the maximum non-zero number of all rows for the use of
MatMPIAIJSetPreallocation.
Is this reasonable of using MatMPIAIJSetPreallocation?
Thanks.
Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20121107/bcda4bb4/attachment.html>
More information about the petsc-users
mailing list