Matrix input file format
Evrim Dizemen
gudik at ae.metu.edu.tr
Thu Jun 15 03:37:17 CDT 2006
Hi all,
Again thanks for your comments. I guess i can not define the problem
correctly. I have a sequantial fortran code giving me the global matrix
of 200000x200000. The code writes the matrix in a binary file at little
endian mode (i can write only the nonzero terms or the entire matrix). I
tried to change the binary mode to big endian and read the global matrix
by a c program as in the example /src/mat/example/tests/ex31.c. However
the program reads binary file wrong and gives the following error
message but the true value of no-nonzero in the binary file is 6 (for
the test case 3x3 matrix) :
reading matrix in binary from matrix.dat ...
------------------------------------------------------------------------
Petsc Release Version 2.3.1, Patch 13, Wed May 10 11:08:35 CDT 2006
BK revision: balay at asterix.mcs.anl.gov|ChangeSet|20060510160640|13832
See docs/changes/index.html for recent updates.
See docs/faq.html for hints about trouble shooting.
See docs/index.html for manual pages.
------------------------------------------------------------------------
./ex31 on a linux named akbaba.ae.metu.edu.tr by evrim Thu Jun 15
09:26:36 2006
Libraries linked from /home/evrim/petsc-2.3.1-p13/lib/linux
Configure run at Tue May 30 10:26:48 2006
Configure options --with-scalar-type=complex --with-shared=0
------------------------------------------------------------------------
[0]PETSC ERROR: MatLoad_SeqAIJ() line 3055 in src/mat/impls/aij/seq/aij.c
[0]PETSC ERROR: Read from file failed!
[0]PETSC ERROR: Inconsistant matrix data in file. no-nonzeros =
100663296, sum-row-lengths = 234300
!
[0]PETSC ERROR: MatLoad() line 149 in src/mat/utils/matio.c
[0]PETSC ERROR: main() line 37 in src/mat/examples/tests/ex31.c
I want to send the global matrix at once to Petsc by a written input
file (as i'm working on now) or by sending the matrix array from my
fortran code and then partition it and solve iteratively. After the
solution i also want to get the solution vector back to my fortran code.
As i told in the previous mails i tried to send the matrix array to
Petsc and used MatSetValues as reading one value at time in a do loop
but it took about 2,5 hours to read the global matrix. Additionally i
tried to read a row at a time but can not figure out a algorithm for
this. Hence i do not prefer to create the matrix again in Petsc by
MatSetValues.
Aside i figured out that the binary files written in fortran and c are
completely different from each other (fortran adds the size of the
characters to the beginning and end of each character) so i wrote a c
interface code to get the matrix array from the fortran code and write
it to a binary file in c format. By this code i avoided from the
additional information in the binary file but i still have the
endianness problem.
I know that i asked so much but since i'm a rookie in parallel
programming, c language and library using i really need your comments on
my problem. Sorry for this long mail and thanks a lot for your kind
effort on guiding me.
Thanks
EVRIM
More information about the petsc-users
mailing list