[petsc-users] hdf5 viewer and zero sized local vectors

Mohamad M. Nasr-Azadani mmnasr at gmail.com
Thu Jan 19 21:54:33 CST 2012


Hi,

I am trying to use VecView() and hdf5 viewer.
I am trying to create a "parallel" vector of size N which has N elements on
only processor zero and 0 elements on all other processors.

This is the code that I have (if it helps):

    PetscViewer    H5viewer;

    // Create the HDF5 viewer

    int ierr = PetscViewerHDF5Open(PCW, "temp.h5", FILE_MODE_WRITE,
&H5viewer); PETScErrAct(ierr);

     Vec x;

    ierr = VecCreate(PCW, &x); PETScErrAct(ierr);

    int n_local = 0;

/* Rank of current processor */

    if (params->rank == MASTER) {

        n_local = N;

    }

    ierr = VecSetSizes(x,n_local, N); PETScErrAct(ierr);

    ierr = VecSetFromOptions(x); PETScErrAct(ierr);

     double *vcoord;

    ierr = VecGetArray(x, &vcoord); PETScErrAct(ierr);

     int i;

    for (i=0; i<n_local; i++) {

        vcoord[i] = coord[i];

    }

    ierr = VecRestoreArray(x, vcoord); PETScErrAct(ierr);

    ierr = PetscObjectSetName((PetscObject) x, gridname); PETScErrAct(ierr);

    // Write the H5 file

    ierr = VecView(x, H5viewer); PETScErrAct(ierr);

    ierr = VecDestroy(x); PETScErrAct(ierr);

     ierr = PetscViewerDestroy(H5viewer); PETScErrAct(ierr);



When I create a viewer and use VecView() to write this vector to file, this
is the error I get. Apparently, it seems it does not like it that other
processors do not have any elements.
Any ideas how to fix that?

HDF5-DIAG: Error detected in HDF5 (1.8.4) HDF5-DIAG: Error detected in HDF5
(1.8.4) HDF5-DIAG: Error detected in HDF5 (1.8.4) MPI-process 2MPI-process
3:
  #000: H5S.c line 1335 in H5Screate_simple(): zero sized dimension for
non-unlimited dimension
:
  #000: H5S.c line 1335 in H5Screate_simple(): zero sized dimension for
non-unlimited dimension
    major: Invalid arguments to routine
    minor: Bad value
    major: Invalid arguments to routine
    minor: Bad value
[2]PETSC ERROR: MPI-process 1--------------------- Error Message
------------------------------------
[3]PETSC ERROR: --------------------- Error Message
------------------------------------
[2]PETSC ERROR: Error in external library!
[3]PETSC ERROR: Error in external library!
[2]PETSC ERROR: Cannot H5Screate_simple()!
[3]PETSC ERROR: Cannot H5Screate_simple()!
[2]PETSC ERROR: [3]PETSC ERROR:
------------------------------------------------------------------------
[2]PETSC ERROR:
------------------------------------------------------------------------
:
  #000: H5S.c line 1335 in H5Screate_simple(): zero sized dimension for
non-unlimited dimension
    major: Invalid arguments to routine
    minor: Bad value
[1]PETSC ERROR: --------------------- Error Message
------------------------------------
[1]PETSC ERROR: Error in external library!
[1]PETSC ERROR: Cannot H5Screate_simple()!
[1]PETSC ERROR:
------------------------------------------------------------------------
[1]PETSC ERROR: Petsc Release Version 3.1.0, Patch 8, Thu Mar 17 13:37:48
CDT 2011
[1]PETSC ERROR: See docs/changes/index.html for recent updates.
[1]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
[1]PETSC ERROR: See docs/index.html for manual pages.
[1]PETSC ERROR:
------------------------------------------------------------------------
[1]PETSC ERROR: ./gvg on a linux-gnu named mylaptop by mmnasr Thu Jan 19
19:47:49 2012
[1]PETSC ERROR: Libraries linked from
/home/mmnasr/Softwares/petsc-3.1-p8/linux-gnuPetsc Release Version 3.1.0,
Patch 8, Thu Mar 17 13:37:48 CDT 2011
-hdf5/lib
[1]PETSC ERROR: Configure run at Tue Sep  6 18:38:57 2011
[1]PETSC ERROR: Configure options PETSC_ARCH=linux-gnu-hdf5 --with-cc=gcc
--with-fc=gfortran --download-f-blas-lapack=1 --download-mpich=1
--with-debugging=0 COPTFLAGS=-O3 FOPTFLAGS=-O3
--download-hypre=/home/mmnasr/Softwares/hypre-2.7.0b.tar.gz
--download-hdf5=1
[1]PETSC ERROR:
------------------------------------------------------------------------
[1]PETSC ERROR: VecView_MPI_HDF5() line 748 in src/vec/vec/impls/mpi/pdvec.c
[1]PETSC ERROR: VecView_MPI() line 840 in src/vec/vec/impls/mpi/pdvec.c
[1]PETSC ERROR: VecView() line 710 in src/vec/vec/interface/vector.c
[1]PETSC ERROR: Output_grid_hdf5() line 2358 in "unknowndirectory/"Output.c
[2]PETSC ERROR: See docs/changes/index.html for recent updates.
[3]PETSC ERROR: [2]PETSC ERROR: See docs/faq.html for hints about trouble
shooting.
Petsc Release Version 3.1.0, Patch 8, Thu Mar 17 13:37:48 CDT 2011
[2]PETSC ERROR: See docs/index.html for manual pages.
[2]PETSC ERROR: [3]PETSC ERROR: See docs/changes/index.html for recent
updates.
[3]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
[3]PETSC ERROR: See docs/index.html for manual pages.
[3]PETSC ERROR:
------------------------------------------------------------------------
[3]PETSC ERROR: ./gvg on a linux-gnu named mylaptop by mmnasr Thu Jan 19
19:47:49 2012
[3]PETSC ERROR: Libraries linked from
/home/mmnasr/Softwares/petsc-3.1-p8/linux-gnu-hdf5/lib
[3]PETSC ERROR: Configure run at Tue Sep  6 18:38:57 2011
[3]PETSC ERROR: Configure options PETSC_ARCH=linux-gnu-hdf5 --with-cc=gcc
--with-fc=gfortran --download-f-blas-lapack=1 --download-mpich=1
--with-debugging=0 COPTFLAGS=-O3 FOPTFLAGS=-O3
--download-hypre=/home/mmnasr/Softwares/hypre-2.7.0b.tar.gz
--download-hdf5=1
[3]PETSC ERROR:
------------------------------------------------------------------------
[3]PETSC ERROR: VecView_MPI_HDF5() line 748 in src/vec/vec/impls/mpi/pdvec.c
[3]PETSC ERROR: VecView_MPI() line 840 in src/vec/vec/impls/mpi/pdvec.c
[3]PETSC
------------------------------------------------------------------------
ERROR: VecView() line 710 in src/vec/vec/interface/vector.c
[3]PETSC ERROR: Output_grid_hdf5() line 2358 in "unknowndirectory/"Output.c
[2]PETSC ERROR: ./gvg on a linux-gnu named mylaptop by mmnasr Thu Jan 19
19:47:49 2012
[2]PETSC ERROR: Libraries linked from
/home/mmnasr/Softwares/petsc-3.1-p8/linux-gnu-hdf5/lib
[2]PETSC ERROR: Configure run at Tue Sep  6 18:38:57 2011
[2]PETSC ERROR: Configure options PETSC_ARCH=linux-gnu-hdf5 --with-cc=gcc
--with-fc=gfortran --download-f-blas-lapack=1 --download-mpich=1
--with-debugging=0 COPTFLAGS=-O3 FOPTFLAGS=-O3
--download-hypre=/home/mmnasr/Softwares/hypre-2.7.0b.tar.gz
--download-hdf5=1
[2]PETSC ERROR:
------------------------------------------------------------------------
[2]PETSC ERROR: VecView_MPI_HDF5() line 748 in src/vec/vec/impls/mpi/pdvec.c
[2]PETSC ERROR: VecView_MPI() line 840 in src/vec/vec/impls/mpi/pdvec.c
[2]PETSC ERROR: VecView() line 710 in src/vec/vec/interface/vector.c
[2]PETSC ERROR: Output_grid_hdf5() line 2358 in "unknowndirectory/"Output.c
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120119/6263d8be/attachment-0001.htm>


More information about the petsc-users mailing list