[petsc-users] Writing matrix to file with MPIIO

Barry Smith bsmith at mcs.anl.gov
Sun Feb 28 11:05:02 CST 2016


   Does it work without the PetscViewerBinarySetUseMPIIO(viewer, PETSC_TRUE); ?

  Barry

> On Feb 27, 2016, at 9:57 PM, Guo, Hanqi <hguo at anl.gov> wrote:
> 
> Hi, 
> 
> I am trying to write a sparse matrix to file with MPIIO but failed.  I got the same error on vesta (gpfs), my Macbook (local disk), and a linux machine (nfs).  The followings are my code snippet and error output.  Could anyone help me check the code?  Thanks!  
> 
> ...
>     MatCreate(PETSC_COMM_WORLD, &mat);
>     MatSetType(mat, MATMPIAIJ);
>     MatSetSizes(mat, PETSC_DECIDE, PETSC_DECIDE, n, n);
>     MatSetUp(mat);
> ...
>     // write matrix
> ...
>     MatAssemblyBegin(mat, MAT_FINAL_ASSEMBLY);
>     MatAssemblyEnd(mat, MAT_FINAL_ASSEMBLY);
> 
>     PetscViewer viewer; 
>     PetscViewerCreate(PETSC_COMM_WORLD, &viewer); 
>     PetscViewerSetType(viewer, PETSCVIEWERBINARY);
>     PetscViewerFileSetMode(viewer, FILE_MODE_WRITE);
>     PetscViewerFileSetName(viewer, "sfm.mat");
>     PetscViewerBinarySetUseMPIIO(viewer, PETSC_TRUE);
>     MatView(mat, viewer);
>     PetscViewerDestroy(&viewer);
> ...
> 
> 
> [0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
> [0]PETSC ERROR: Write to file failed
> [0]PETSC ERROR: Error writing to file total size 4 err -1 wsize 16
> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
> [0]PETSC ERROR: Petsc Release Version 3.6.3, Dec, 03, 2015 
> [0]PETSC ERROR: Unknown Name on a arch-linux2-c-debug named compute001 by hguo Sat Feb 27 21:40:04 2016
> [0]PETSC ERROR: Configure options —prefix=(hidden) --with-fc=0 --download-f2cblaslapack --with-mpi-dir=(hidden) --with-precision=single
> [0]PETSC ERROR: #1 PetscBinaryWrite() line 405 in (hidden)/petsc-3.6.3/src/sys/fileio/sysio.c
> [0]PETSC ERROR: #2 MatView_MPIAIJ_Binary() line 1219 in (hidden)/petsc-3.6.3/src/mat/impls/aij/mpi/mpiaij.c
> [0]PETSC ERROR: #3 MatView_MPIAIJ_ASCIIorDraworSocket() line 1385 in (hidden)/petsc-3.6.3/src/mat/impls/aij/mpi/mpiaij.c
> [0]PETSC ERROR: #4 MatView_MPIAIJ() line 1470 in (hidden)/petsc-3.6.3/src/mat/impls/aij/mpi/mpiaij.c
> [0]PETSC ERROR: #5 MatView() line 886 in (hidden)/petsc-3.6.3/src/mat/interface/matrix.c
> 
> 
> ---------------
> Hanqi Guo
> Postdoctoral Appointee
> Mathematics and Computer Science Division
> Argonne National Laboratory
> 9700 S. Cass Ave., Bldg 240
> Argonne, IL 60439
> e-mail: hguo at anl.gov
> web: http://www.mcs.anl.gov/~hguo
> phone: 630-252-7225
> 



More information about the petsc-users mailing list