Matrix input file format

Matthew Knepley knepley at gmail.com
Wed Jun 7 08:30:52 CDT 2006


On 6/7/06, Evrim Dizemen <gudik at ae.metu.edu.tr> wrote:
>
> Hi all,
>
> First thanks for your comments. I still have the same problem but i
> agree with you all that reading a matrix from a file is not parallel
> programming. So i wonder if you can recommend an efficient and faster
> way to read a 30000x30000 sparse matrix where i got those values from my
> fortran code on aeroacoustics similation. I tried calling MatSetValues
> as i attached below. I found that way from the ex11f.F in the matrix
> examples and not sure if it is appropriate for my situation.
>
> !      do, i=1,n
> !       do, j=1,n
> !        value=Aval(i,j)
> !       if(value .ne. 0)then
> !       l=i-1
> !       m=j-1
> !        call MatSetValues(A,1,l,1,m,value,INSERT_VALUES,ierr)
> !       endif
> !       enddo
> !       enddo
>
> Thanks soooooo much


1) You should set an entire row at a time at least, not a single value

2) You need to preallocate the matrix for good performance:


http://www-unix.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MatMPIAIJSetPreallocation.html

3) You are here setting all values from one process. You should do as Randy
suggests and set only the values
     which are owned by each process.

4) I would consult an example, such as:


http://www-unix.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/src/ksp/ksp/examples/tutorials/ex2.c.html

    Matt

EVRIM
>
-- 
"Failure has a thousand explanations. Success doesn't need one" -- Sir Alec
Guiness
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20060607/a8041122/attachment.htm>


More information about the petsc-users mailing list