problems with MatLoad

Matthew Knepley knepley at gmail.com
Wed Apr 8 11:14:52 CDT 2009


On Wed, Apr 8, 2009 at 11:12 AM, Andreas Grassl <
Andreas.Grassl at student.uibk.ac.at> wrote:

> Hello,
>
> I got some success on the localtoglobalmapping, but now I'm stuck with
> writing
> to/reading from files. In a sequential code I write out some matrices with
>
> PetscViewerBinaryOpen(comms,matrixname,FILE_MODE_WRITE,&viewer);
> for (k=0;k<np;k++){
> MatView(AS[k],viewer);}
> PetscViewerDestroy(viewer);
>
> and want to read them in in a parallel program, where each processor should
> own
> one matrix:
>
> ierr =
>
> PetscViewerBinaryOpen(PETSC_COMM_WORLD,matrixname,FILE_MODE_READ,&viewer);CHKERRQ(ierr);


The Viewer has COMM_WORLD, but you are reading a matrix with COMM_SELF. You
need to create
a separate viewer for each process to do what you want.

  Matt


>
> ierr = MatLoad(viewer,MATSEQAIJ,&AS[rank]);CHKERRQ(ierr);
> ierr = MatAssemblyBegin(AS[rank], MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
> ierr = MatAssemblyEnd(AS[rank], MAT_FINAL_ASSEMBLY);CHKERRQ(ierr);
> ierr = PetscViewerDestroy(viewer);CHKERRQ(ierr);
>
> The program is hanging in the line with MatLoad and giving following output
> on
> every node:
>
> [0]PETSC ERROR: --------------------- Error Message
> ------------------------------------
> [0]PETSC ERROR: Argument out of range!
> [0]PETSC ERROR: Comm must be of size 1!
>
> I tried to sequentialize with PetscSequentialPhaseBegin(PETSC_COMM_WORLD,1)
> and
> performing the file read with a loop.
>
> Any suggestions what could go wrong?
>
> thank you
>
> ando
>
> --
>  /"\                               Grassl Andreas
>  \ /    ASCII Ribbon Campaign      Uni Innsbruck Institut f. Mathematik
>  X      against HTML email        Technikerstr. 13 Zi 709
>  / \                               +43 (0)512 507 6091
>



-- 
What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20090408/904492c2/attachment.htm>


More information about the petsc-users mailing list