On Wed, Apr 8, 2009 at 11:12 AM, Andreas Grassl <span dir="ltr"><<a href="mailto:Andreas.Grassl@student.uibk.ac.at">Andreas.Grassl@student.uibk.ac.at</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello,<br>
<br>
I got some success on the localtoglobalmapping, but now I'm stuck with writing<br>
to/reading from files. In a sequential code I write out some matrices with<br>
<br>
PetscViewerBinaryOpen(comms,matrixname,FILE_MODE_WRITE,&viewer);<br>
for (k=0;k<np;k++){<br>
MatView(AS[k],viewer);}<br>
PetscViewerDestroy(viewer);<br>
<br>
and want to read them in in a parallel program, where each processor should own<br>
one matrix:<br>
<br>
ierr =<br>
PetscViewerBinaryOpen(PETSC_COMM_WORLD,matrixname,FILE_MODE_READ,&viewer);CHKERRQ(ierr);</blockquote><div><br>The Viewer has COMM_WORLD, but you are reading a matrix with COMM_SELF. You need to create<br>a separate viewer for each process to do what you want.<br>
<br> Matt<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
ierr = MatLoad(viewer,MATSEQAIJ,&AS[rank]);CHKERRQ(ierr);<br>
ierr = MatAssemblyBegin(AS[rank], MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);<br>
ierr = MatAssemblyEnd(AS[rank], MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);<br>
ierr = PetscViewerDestroy(viewer);CHKERRQ(ierr);<br>
<br>
The program is hanging in the line with MatLoad and giving following output on<br>
every node:<br>
<br>
[0]PETSC ERROR: --------------------- Error Message<br>
------------------------------------<br>
[0]PETSC ERROR: Argument out of range!<br>
[0]PETSC ERROR: Comm must be of size 1!<br>
<br>
I tried to sequentialize with PetscSequentialPhaseBegin(PETSC_COMM_WORLD,1) and<br>
performing the file read with a loop.<br>
<br>
Any suggestions what could go wrong?<br>
<br>
thank you<br>
<br>
ando<br>
<font color="#888888"><br>
--<br>
/"\ Grassl Andreas<br>
\ / ASCII Ribbon Campaign Uni Innsbruck Institut f. Mathematik<br>
X against HTML email Technikerstr. 13 Zi 709<br>
/ \ +43 (0)512 507 6091<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener<br>