Functionality to avoid creating datasets in HDF5 of zero dimensions
This commit is contained in:
parent
e7581f06d9
commit
ef1e9cce0d
|
@ -374,7 +374,10 @@ end subroutine HDF5_read_pReal_4
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief subroutine for reading dataset of the type pReal with 5 dimensions
|
!> @brief subroutine for reading dataset of the type pReal with 5 dimensions
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine HDF5_read_pReal_5(dataset,loc_id,datasetName)
|
subroutine HDF5_read_pReal_5(dataset,loc_id,datasetName,parallel)
|
||||||
|
use numerics, only: &
|
||||||
|
worldrank, &
|
||||||
|
worldsize
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
real(pReal), intent(out), dimension(:,:,:,:,:) :: dataset
|
real(pReal), intent(out), dimension(:,:,:,:,:) :: dataset
|
||||||
|
@ -383,8 +386,16 @@ subroutine HDF5_read_pReal_5(dataset,loc_id,datasetName)
|
||||||
integer(pInt),dimension(:), allocatable :: myShape
|
integer(pInt),dimension(:), allocatable :: myShape
|
||||||
|
|
||||||
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
||||||
|
logical, intent(in), optional :: parallel
|
||||||
|
|
||||||
|
integer :: ierr
|
||||||
integer(HDF5_ERR_TYPE) :: hdferr
|
integer(HDF5_ERR_TYPE) :: hdferr
|
||||||
|
integer(pInt), dimension(:), allocatable :: &
|
||||||
|
globalShape, & !< shape of the dataset (all processes)
|
||||||
|
localShape, & !< shape of the dataset (this process)
|
||||||
|
readSize !< contribution of all processes
|
||||||
|
integer(HSIZE_T), dimension(5) :: myStart
|
||||||
|
|
||||||
myShape = shape(dataset)
|
myShape = shape(dataset)
|
||||||
|
|
||||||
|
|
||||||
|
@ -392,13 +403,44 @@ subroutine HDF5_read_pReal_5(dataset,loc_id,datasetName)
|
||||||
!creating a property list for transfer properties
|
!creating a property list for transfer properties
|
||||||
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
||||||
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
! determine shape of dataset
|
||||||
|
localShape = shape(dataset)
|
||||||
|
allocate(readSize(worldsize), source = 0_pInt)
|
||||||
|
readSize(worldrank+1) = localShape(5)
|
||||||
|
#ifdef PETSc
|
||||||
|
if (present(parallel)) then; if (parallel) then
|
||||||
|
call h5pset_dxpl_mpio_f(plist_id, H5FD_MPIO_COLLECTIVE_F, hdferr)
|
||||||
|
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_pReal5: h5pset_dxpl_mpio_f')
|
||||||
|
call MPI_allreduce(MPI_IN_PLACE,readSize,worldsize,MPI_LONG,MPI_SUM,PETSC_COMM_WORLD,ierr) ! get total output size over each process
|
||||||
|
if (ierr /= 0) call IO_error(894_pInt,ext_msg='HDF5_read_pReal5: MPI_allreduce')
|
||||||
|
endif; endif
|
||||||
|
#endif
|
||||||
|
myStart = int([0,0,0,0,sum(readSize(1:worldrank))],HSIZE_T)
|
||||||
|
globalShape = [localShape(1:4),sum(readSize)]
|
||||||
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
! open the dataset in the file
|
||||||
call h5dopen_f(loc_id,datasetName,dset_id,hdferr)
|
call h5dopen_f(loc_id,datasetName,dset_id,hdferr)
|
||||||
if (hdferr < 0) call IO_error(0_pInt,ext_msg='HDF5_read_pReal_shape5: h5dopen_f')
|
if (hdferr < 0) call IO_error(0_pInt,ext_msg='HDF5_read_pReal_shape5: h5dopen_f')
|
||||||
call h5dread_f(dset_id,H5T_NATIVE_DOUBLE,dataset,int(myShape,HSIZE_T),hdferr)
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
!get the space_id of dataset in the file
|
||||||
|
call h5dget_space_f(dset_id, filespace_id, hdferr)
|
||||||
|
if (hdferr < 0) call IO_error(0_pInt,ext_msg='HDF5_read_pReal_shape5: h5dget_space_f')
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
! select a hyperslab (the portion of the current process) in the file
|
||||||
|
call h5sselect_hyperslab_f(filespace_id, H5S_SELECT_SET_F, myStart, int(localShape,HSIZE_T), hdferr)
|
||||||
|
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_pReal5: h5sselect_hyperslab_f')
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
! read
|
||||||
|
call h5dread_f(dset_id,H5T_NATIVE_DOUBLE,dataset,int(globalShape,HSIZE_T),hdferr)
|
||||||
if (hdferr < 0) call IO_error(0_pInt,ext_msg='HDF5_read_pReal_shape5: h5dread_f')
|
if (hdferr < 0) call IO_error(0_pInt,ext_msg='HDF5_read_pReal_shape5: h5dread_f')
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
! close property lists and datatypes
|
||||||
|
call h5pclose_f(plist_id, hdferr)
|
||||||
|
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_pReal5: plist_id')
|
||||||
call h5dclose_f(dset_id, hdferr)
|
call h5dclose_f(dset_id, hdferr)
|
||||||
if (hdferr < 0) call IO_error(0_pInt,ext_msg='HDF5_read_pReal_shape5: h5dclose_f')
|
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_read_pReal5: h5dclose_f')
|
||||||
|
|
||||||
end subroutine HDF5_read_pReal_5
|
end subroutine HDF5_read_pReal_5
|
||||||
|
|
||||||
|
@ -618,7 +660,6 @@ subroutine HDF5_read_pInt_7(dataset,loc_id,datasetName)
|
||||||
|
|
||||||
end subroutine HDF5_read_pInt_7
|
end subroutine HDF5_read_pInt_7
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief subroutine for writing dataset of type pReal with 1 dimensions
|
!> @brief subroutine for writing dataset of type pReal with 1 dimensions
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
@ -638,16 +679,19 @@ subroutine HDF5_write_pReal1(dataset,loc_id,datasetName,parallel)
|
||||||
globalShape, & !< shape of the dataset (all processes)
|
globalShape, & !< shape of the dataset (all processes)
|
||||||
localShape, & !< shape of the dataset (this process)
|
localShape, & !< shape of the dataset (this process)
|
||||||
outputSize !< contribution of all processes
|
outputSize !< contribution of all processes
|
||||||
integer(HDF5_ERR_TYPE) :: hdferr
|
|
||||||
integer :: ierr
|
integer :: ierr
|
||||||
|
integer(HDF5_ERR_TYPE) :: hdferr
|
||||||
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
||||||
integer(HSIZE_T), dimension(1) :: myStart
|
integer(HSIZE_T), dimension(1) :: myStart
|
||||||
|
|
||||||
|
!-------------------------------------------------------------------------------------------------
|
||||||
|
! determine shape of dataset
|
||||||
|
localShape = shape(dataset)
|
||||||
|
if (any(localShape(1:size(localShape)) == 0)) return
|
||||||
|
|
||||||
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! determine shape of dataset
|
|
||||||
localShape = shape(dataset)
|
|
||||||
allocate(outputSize(worldsize), source = 0_pInt)
|
allocate(outputSize(worldsize), source = 0_pInt)
|
||||||
outputSize(worldrank+1) = localShape(1)
|
outputSize(worldrank+1) = localShape(1)
|
||||||
#ifdef PETSc
|
#ifdef PETSc
|
||||||
|
@ -693,15 +737,15 @@ subroutine HDF5_write_pReal1(dataset,loc_id,datasetName,parallel)
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!close types, dataspaces
|
!close types, dataspaces
|
||||||
call h5pclose_f(plist_id, hdferr)
|
call h5pclose_f(plist_id, hdferr)
|
||||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pReal1: plist_id')
|
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_PReal1: plist_id')
|
||||||
call h5dclose_f(dset_id, hdferr)
|
call h5dclose_f(dset_id, hdferr)
|
||||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pReal1: h5dclose_f')
|
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_PReal1: h5dclose_f')
|
||||||
call h5sclose_f(filespace_id, hdferr)
|
call h5sclose_f(filespace_id, hdferr)
|
||||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pReal1: h5sclose_f/filespace_id')
|
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_PReal1: h5sclose_f/filespace_id')
|
||||||
call h5sclose_f(memspace_id, hdferr)
|
call h5sclose_f(memspace_id, hdferr)
|
||||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pReal1: h5sclose_f/memspace_id')
|
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_PReal1: h5sclose_f/memspace_id')
|
||||||
|
|
||||||
end subroutine HDF5_write_pReal1
|
end subroutine HDF5_write_PReal1
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
@ -723,16 +767,19 @@ subroutine HDF5_write_pReal2(dataset,loc_id,datasetName,parallel)
|
||||||
globalShape, & !< shape of the dataset (all processes)
|
globalShape, & !< shape of the dataset (all processes)
|
||||||
localShape, & !< shape of the dataset (this process)
|
localShape, & !< shape of the dataset (this process)
|
||||||
outputSize !< contribution of all processes
|
outputSize !< contribution of all processes
|
||||||
integer(HDF5_ERR_TYPE) :: hdferr
|
|
||||||
integer :: ierr
|
integer :: ierr
|
||||||
|
integer(HDF5_ERR_TYPE) :: hdferr
|
||||||
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
||||||
integer(HSIZE_T), dimension(2) :: myStart
|
integer(HSIZE_T), dimension(2) :: myStart
|
||||||
|
|
||||||
|
!-------------------------------------------------------------------------------------------------
|
||||||
|
! determine shape of dataset
|
||||||
|
localShape = shape(dataset)
|
||||||
|
if (any(localShape(1:size(localShape)) == 0)) return
|
||||||
|
|
||||||
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! determine shape of dataset
|
|
||||||
localShape = shape(dataset)
|
|
||||||
allocate(outputSize(worldsize), source = 0_pInt)
|
allocate(outputSize(worldsize), source = 0_pInt)
|
||||||
outputSize(worldrank+1) = localShape(2)
|
outputSize(worldrank+1) = localShape(2)
|
||||||
#ifdef PETSc
|
#ifdef PETSc
|
||||||
|
@ -740,7 +787,7 @@ subroutine HDF5_write_pReal2(dataset,loc_id,datasetName,parallel)
|
||||||
call h5pset_dxpl_mpio_f(plist_id, H5FD_MPIO_COLLECTIVE_F, hdferr)
|
call h5pset_dxpl_mpio_f(plist_id, H5FD_MPIO_COLLECTIVE_F, hdferr)
|
||||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pReal2: h5pset_dxpl_mpio_f')
|
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pReal2: h5pset_dxpl_mpio_f')
|
||||||
call MPI_allreduce(MPI_IN_PLACE,outputSize,worldsize,MPI_LONG,MPI_SUM,PETSC_COMM_WORLD,ierr) ! get total output size over each process
|
call MPI_allreduce(MPI_IN_PLACE,outputSize,worldsize,MPI_LONG,MPI_SUM,PETSC_COMM_WORLD,ierr) ! get total output size over each process
|
||||||
if (ierr /= 0) call IO_error(894_pInt,ext_msg='HDF5_write_pReal2: MPI_allreduce')
|
if (ierr /= 0) call IO_error(894_pInt,ext_msg='HDF5_write_pInt2: MPI_allreduce')
|
||||||
endif; endif
|
endif; endif
|
||||||
#endif
|
#endif
|
||||||
myStart = int([0,sum(outputSize(1:worldrank))],HSIZE_T)
|
myStart = int([0,sum(outputSize(1:worldrank))],HSIZE_T)
|
||||||
|
@ -808,16 +855,19 @@ subroutine HDF5_write_pReal3(dataset,loc_id,datasetName,parallel)
|
||||||
globalShape, & !< shape of the dataset (all processes)
|
globalShape, & !< shape of the dataset (all processes)
|
||||||
localShape, & !< shape of the dataset (this process)
|
localShape, & !< shape of the dataset (this process)
|
||||||
outputSize !< contribution of all processes
|
outputSize !< contribution of all processes
|
||||||
integer(HDF5_ERR_TYPE) :: hdferr
|
|
||||||
integer :: ierr
|
integer :: ierr
|
||||||
|
integer(HDF5_ERR_TYPE) :: hdferr
|
||||||
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
||||||
integer(HSIZE_T), dimension(3) :: myStart
|
integer(HSIZE_T), dimension(3) :: myStart
|
||||||
|
|
||||||
|
!-------------------------------------------------------------------------------------------------
|
||||||
|
! determine shape of dataset
|
||||||
|
localShape = shape(dataset)
|
||||||
|
if (any(localShape(1:size(localShape)) == 0)) return
|
||||||
|
|
||||||
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! determine shape of dataset
|
|
||||||
localShape = shape(dataset)
|
|
||||||
allocate(outputSize(worldsize), source = 0_pInt)
|
allocate(outputSize(worldsize), source = 0_pInt)
|
||||||
outputSize(worldrank+1) = localShape(3)
|
outputSize(worldrank+1) = localShape(3)
|
||||||
#ifdef PETSc
|
#ifdef PETSc
|
||||||
|
@ -825,7 +875,7 @@ subroutine HDF5_write_pReal3(dataset,loc_id,datasetName,parallel)
|
||||||
call h5pset_dxpl_mpio_f(plist_id, H5FD_MPIO_COLLECTIVE_F, hdferr)
|
call h5pset_dxpl_mpio_f(plist_id, H5FD_MPIO_COLLECTIVE_F, hdferr)
|
||||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pReal3: h5pset_dxpl_mpio_f')
|
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pReal3: h5pset_dxpl_mpio_f')
|
||||||
call MPI_allreduce(MPI_IN_PLACE,outputSize,worldsize,MPI_LONG,MPI_SUM,PETSC_COMM_WORLD,ierr) ! get total output size over each process
|
call MPI_allreduce(MPI_IN_PLACE,outputSize,worldsize,MPI_LONG,MPI_SUM,PETSC_COMM_WORLD,ierr) ! get total output size over each process
|
||||||
if (ierr /= 0) call IO_error(894_pInt,ext_msg='HDF5_write_pReal3: MPI_allreduce')
|
if (ierr /= 0) call IO_error(894_pInt,ext_msg='HDF5_write_pInt3: MPI_allreduce')
|
||||||
endif; endif
|
endif; endif
|
||||||
#endif
|
#endif
|
||||||
myStart = int([0,0,sum(outputSize(1:worldrank))],HSIZE_T)
|
myStart = int([0,0,sum(outputSize(1:worldrank))],HSIZE_T)
|
||||||
|
@ -893,16 +943,19 @@ subroutine HDF5_write_pReal4(dataset,loc_id,datasetName,parallel)
|
||||||
globalShape, & !< shape of the dataset (all processes)
|
globalShape, & !< shape of the dataset (all processes)
|
||||||
localShape, & !< shape of the dataset (this process)
|
localShape, & !< shape of the dataset (this process)
|
||||||
outputSize !< contribution of all processes
|
outputSize !< contribution of all processes
|
||||||
integer(HDF5_ERR_TYPE) :: hdferr
|
|
||||||
integer :: ierr
|
integer :: ierr
|
||||||
|
integer(HDF5_ERR_TYPE) :: hdferr
|
||||||
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
||||||
integer(HSIZE_T), dimension(4) :: myStart
|
integer(HSIZE_T), dimension(4) :: myStart
|
||||||
|
|
||||||
|
!-------------------------------------------------------------------------------------------------
|
||||||
|
! determine shape of dataset
|
||||||
|
localShape = shape(dataset)
|
||||||
|
if (any(localShape(1:size(localShape)) == 0)) return
|
||||||
|
|
||||||
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! determine shape of dataset
|
|
||||||
localShape = shape(dataset)
|
|
||||||
allocate(outputSize(worldsize), source = 0_pInt)
|
allocate(outputSize(worldsize), source = 0_pInt)
|
||||||
outputSize(worldrank+1) = localShape(4)
|
outputSize(worldrank+1) = localShape(4)
|
||||||
#ifdef PETSc
|
#ifdef PETSc
|
||||||
|
@ -910,7 +963,7 @@ subroutine HDF5_write_pReal4(dataset,loc_id,datasetName,parallel)
|
||||||
call h5pset_dxpl_mpio_f(plist_id, H5FD_MPIO_COLLECTIVE_F, hdferr)
|
call h5pset_dxpl_mpio_f(plist_id, H5FD_MPIO_COLLECTIVE_F, hdferr)
|
||||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pReal4: h5pset_dxpl_mpio_f')
|
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pReal4: h5pset_dxpl_mpio_f')
|
||||||
call MPI_allreduce(MPI_IN_PLACE,outputSize,worldsize,MPI_LONG,MPI_SUM,PETSC_COMM_WORLD,ierr) ! get total output size over each process
|
call MPI_allreduce(MPI_IN_PLACE,outputSize,worldsize,MPI_LONG,MPI_SUM,PETSC_COMM_WORLD,ierr) ! get total output size over each process
|
||||||
if (ierr /= 0) call IO_error(894_pInt,ext_msg='HDF5_write_pReal4: MPI_allreduce')
|
if (ierr /= 0) call IO_error(894_pInt,ext_msg='HDF5_write_pInt4: MPI_allreduce')
|
||||||
endif; endif
|
endif; endif
|
||||||
#endif
|
#endif
|
||||||
myStart = int([0,0,0,sum(outputSize(1:worldrank))],HSIZE_T)
|
myStart = int([0,0,0,sum(outputSize(1:worldrank))],HSIZE_T)
|
||||||
|
@ -978,16 +1031,19 @@ subroutine HDF5_write_pReal5(dataset,loc_id,datasetName,parallel)
|
||||||
globalShape, & !< shape of the dataset (all processes)
|
globalShape, & !< shape of the dataset (all processes)
|
||||||
localShape, & !< shape of the dataset (this process)
|
localShape, & !< shape of the dataset (this process)
|
||||||
outputSize !< contribution of all processes
|
outputSize !< contribution of all processes
|
||||||
integer(HDF5_ERR_TYPE) :: hdferr
|
|
||||||
integer :: ierr
|
integer :: ierr
|
||||||
|
integer(HDF5_ERR_TYPE) :: hdferr
|
||||||
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
||||||
integer(HSIZE_T), dimension(5) :: myStart
|
integer(HSIZE_T), dimension(5) :: myStart
|
||||||
|
|
||||||
|
!-------------------------------------------------------------------------------------------------
|
||||||
|
! determine shape of dataset
|
||||||
|
localShape = shape(dataset)
|
||||||
|
if (any(localShape(1:size(localShape)) == 0)) return
|
||||||
|
|
||||||
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! determine shape of dataset
|
|
||||||
localShape = shape(dataset)
|
|
||||||
allocate(outputSize(worldsize), source = 0_pInt)
|
allocate(outputSize(worldsize), source = 0_pInt)
|
||||||
outputSize(worldrank+1) = localShape(5)
|
outputSize(worldrank+1) = localShape(5)
|
||||||
#ifdef PETSc
|
#ifdef PETSc
|
||||||
|
@ -995,7 +1051,7 @@ subroutine HDF5_write_pReal5(dataset,loc_id,datasetName,parallel)
|
||||||
call h5pset_dxpl_mpio_f(plist_id, H5FD_MPIO_COLLECTIVE_F, hdferr)
|
call h5pset_dxpl_mpio_f(plist_id, H5FD_MPIO_COLLECTIVE_F, hdferr)
|
||||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pReal5: h5pset_dxpl_mpio_f')
|
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pReal5: h5pset_dxpl_mpio_f')
|
||||||
call MPI_allreduce(MPI_IN_PLACE,outputSize,worldsize,MPI_LONG,MPI_SUM,PETSC_COMM_WORLD,ierr) ! get total output size over each process
|
call MPI_allreduce(MPI_IN_PLACE,outputSize,worldsize,MPI_LONG,MPI_SUM,PETSC_COMM_WORLD,ierr) ! get total output size over each process
|
||||||
if (ierr /= 0) call IO_error(894_pInt,ext_msg='HDF5_write_pReal5: MPI_allreduce')
|
if (ierr /= 0) call IO_error(894_pInt,ext_msg='HDF5_write_pInt5: MPI_allreduce')
|
||||||
endif; endif
|
endif; endif
|
||||||
#endif
|
#endif
|
||||||
myStart = int([0,0,0,0,sum(outputSize(1:worldrank))],HSIZE_T)
|
myStart = int([0,0,0,0,sum(outputSize(1:worldrank))],HSIZE_T)
|
||||||
|
@ -1063,16 +1119,19 @@ subroutine HDF5_write_pReal6(dataset,loc_id,datasetName,parallel)
|
||||||
globalShape, & !< shape of the dataset (all processes)
|
globalShape, & !< shape of the dataset (all processes)
|
||||||
localShape, & !< shape of the dataset (this process)
|
localShape, & !< shape of the dataset (this process)
|
||||||
outputSize !< contribution of all processes
|
outputSize !< contribution of all processes
|
||||||
integer(HDF5_ERR_TYPE) :: hdferr
|
|
||||||
integer :: ierr
|
integer :: ierr
|
||||||
|
integer(HDF5_ERR_TYPE) :: hdferr
|
||||||
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
||||||
integer(HSIZE_T), dimension(6) :: myStart
|
integer(HSIZE_T), dimension(6) :: myStart
|
||||||
|
|
||||||
|
!-------------------------------------------------------------------------------------------------
|
||||||
|
! determine shape of dataset
|
||||||
|
localShape = shape(dataset)
|
||||||
|
if (any(localShape(1:size(localShape)) == 0)) return
|
||||||
|
|
||||||
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! determine shape of dataset
|
|
||||||
localShape = shape(dataset)
|
|
||||||
allocate(outputSize(worldsize), source = 0_pInt)
|
allocate(outputSize(worldsize), source = 0_pInt)
|
||||||
outputSize(worldrank+1) = localShape(6)
|
outputSize(worldrank+1) = localShape(6)
|
||||||
#ifdef PETSc
|
#ifdef PETSc
|
||||||
|
@ -1080,7 +1139,7 @@ subroutine HDF5_write_pReal6(dataset,loc_id,datasetName,parallel)
|
||||||
call h5pset_dxpl_mpio_f(plist_id, H5FD_MPIO_COLLECTIVE_F, hdferr)
|
call h5pset_dxpl_mpio_f(plist_id, H5FD_MPIO_COLLECTIVE_F, hdferr)
|
||||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pReal6: h5pset_dxpl_mpio_f')
|
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pReal6: h5pset_dxpl_mpio_f')
|
||||||
call MPI_allreduce(MPI_IN_PLACE,outputSize,worldsize,MPI_LONG,MPI_SUM,PETSC_COMM_WORLD,ierr) ! get total output size over each process
|
call MPI_allreduce(MPI_IN_PLACE,outputSize,worldsize,MPI_LONG,MPI_SUM,PETSC_COMM_WORLD,ierr) ! get total output size over each process
|
||||||
if (ierr /= 0) call IO_error(894_pInt,ext_msg='HDF5_write_pReal6: MPI_allreduce')
|
if (ierr /= 0) call IO_error(894_pInt,ext_msg='HDF5_write_pInt6: MPI_allreduce')
|
||||||
endif; endif
|
endif; endif
|
||||||
#endif
|
#endif
|
||||||
myStart = int([0,0,0,0,0,sum(outputSize(1:worldrank))],HSIZE_T)
|
myStart = int([0,0,0,0,0,sum(outputSize(1:worldrank))],HSIZE_T)
|
||||||
|
@ -1148,16 +1207,19 @@ subroutine HDF5_write_pReal7(dataset,loc_id,datasetName,parallel)
|
||||||
globalShape, & !< shape of the dataset (all processes)
|
globalShape, & !< shape of the dataset (all processes)
|
||||||
localShape, & !< shape of the dataset (this process)
|
localShape, & !< shape of the dataset (this process)
|
||||||
outputSize !< contribution of all processes
|
outputSize !< contribution of all processes
|
||||||
integer(HDF5_ERR_TYPE) :: hdferr
|
|
||||||
integer :: ierr
|
integer :: ierr
|
||||||
|
integer(HDF5_ERR_TYPE) :: hdferr
|
||||||
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
||||||
integer(HSIZE_T), dimension(7) :: myStart
|
integer(HSIZE_T), dimension(7) :: myStart
|
||||||
|
|
||||||
|
!-------------------------------------------------------------------------------------------------
|
||||||
|
! determine shape of dataset
|
||||||
|
localShape = shape(dataset)
|
||||||
|
if (any(localShape(1:size(localShape)) == 0)) return
|
||||||
|
|
||||||
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! determine shape of dataset
|
|
||||||
localShape = shape(dataset)
|
|
||||||
allocate(outputSize(worldsize), source = 0_pInt)
|
allocate(outputSize(worldsize), source = 0_pInt)
|
||||||
outputSize(worldrank+1) = localShape(7)
|
outputSize(worldrank+1) = localShape(7)
|
||||||
#ifdef PETSc
|
#ifdef PETSc
|
||||||
|
@ -1165,7 +1227,7 @@ subroutine HDF5_write_pReal7(dataset,loc_id,datasetName,parallel)
|
||||||
call h5pset_dxpl_mpio_f(plist_id, H5FD_MPIO_COLLECTIVE_F, hdferr)
|
call h5pset_dxpl_mpio_f(plist_id, H5FD_MPIO_COLLECTIVE_F, hdferr)
|
||||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pReal7: h5pset_dxpl_mpio_f')
|
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pReal7: h5pset_dxpl_mpio_f')
|
||||||
call MPI_allreduce(MPI_IN_PLACE,outputSize,worldsize,MPI_LONG,MPI_SUM,PETSC_COMM_WORLD,ierr) ! get total output size over each process
|
call MPI_allreduce(MPI_IN_PLACE,outputSize,worldsize,MPI_LONG,MPI_SUM,PETSC_COMM_WORLD,ierr) ! get total output size over each process
|
||||||
if (ierr /= 0) call IO_error(894_pInt,ext_msg='HDF5_write_pReal7: MPI_allreduce')
|
if (ierr /= 0) call IO_error(894_pInt,ext_msg='HDF5_write_pInt7: MPI_allreduce')
|
||||||
endif; endif
|
endif; endif
|
||||||
#endif
|
#endif
|
||||||
myStart = int([0,0,0,0,0,0,sum(outputSize(1:worldrank))],HSIZE_T)
|
myStart = int([0,0,0,0,0,0,sum(outputSize(1:worldrank))],HSIZE_T)
|
||||||
|
@ -1214,8 +1276,10 @@ subroutine HDF5_write_pReal7(dataset,loc_id,datasetName,parallel)
|
||||||
end subroutine HDF5_write_pReal7
|
end subroutine HDF5_write_pReal7
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief subroutine for writing dataset of the type pInt with 1 dimensions
|
!> @brief subroutine for writing dataset of type pInt with 1 dimensions
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine HDF5_write_pInt1(dataset,loc_id,datasetName,parallel)
|
subroutine HDF5_write_pInt1(dataset,loc_id,datasetName,parallel)
|
||||||
use numerics, only: &
|
use numerics, only: &
|
||||||
|
@ -1238,12 +1302,14 @@ subroutine HDF5_write_pInt1(dataset,loc_id,datasetName,parallel)
|
||||||
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
||||||
integer(HSIZE_T), dimension(1) :: myStart
|
integer(HSIZE_T), dimension(1) :: myStart
|
||||||
|
|
||||||
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
!-------------------------------------------------------------------------------------------------
|
||||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pInt1: h5pcreate_f')
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
! determine shape of dataset
|
! determine shape of dataset
|
||||||
localShape = shape(dataset)
|
localShape = shape(dataset)
|
||||||
|
if (any(localShape(1:size(localShape)) == 0)) return
|
||||||
|
|
||||||
|
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
||||||
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
allocate(outputSize(worldsize), source = 0_pInt)
|
allocate(outputSize(worldsize), source = 0_pInt)
|
||||||
outputSize(worldrank+1) = localShape(1)
|
outputSize(worldrank+1) = localShape(1)
|
||||||
#ifdef PETSc
|
#ifdef PETSc
|
||||||
|
@ -1324,12 +1390,14 @@ subroutine HDF5_write_pInt2(dataset,loc_id,datasetName,parallel)
|
||||||
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
||||||
integer(HSIZE_T), dimension(2) :: myStart
|
integer(HSIZE_T), dimension(2) :: myStart
|
||||||
|
|
||||||
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
!-------------------------------------------------------------------------------------------------
|
||||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pInt2: h5pcreate_f')
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
! determine shape of dataset
|
! determine shape of dataset
|
||||||
localShape = shape(dataset)
|
localShape = shape(dataset)
|
||||||
|
if (any(localShape(1:size(localShape)) == 0)) return
|
||||||
|
|
||||||
|
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
||||||
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
allocate(outputSize(worldsize), source = 0_pInt)
|
allocate(outputSize(worldsize), source = 0_pInt)
|
||||||
outputSize(worldrank+1) = localShape(2)
|
outputSize(worldrank+1) = localShape(2)
|
||||||
#ifdef PETSc
|
#ifdef PETSc
|
||||||
|
@ -1410,12 +1478,14 @@ subroutine HDF5_write_pInt3(dataset,loc_id,datasetName,parallel)
|
||||||
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
||||||
integer(HSIZE_T), dimension(3) :: myStart
|
integer(HSIZE_T), dimension(3) :: myStart
|
||||||
|
|
||||||
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
!-------------------------------------------------------------------------------------------------
|
||||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pInt3: h5pcreate_f')
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
! determine shape of dataset
|
! determine shape of dataset
|
||||||
localShape = shape(dataset)
|
localShape = shape(dataset)
|
||||||
|
if (any(localShape(1:size(localShape)) == 0)) return
|
||||||
|
|
||||||
|
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
||||||
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
allocate(outputSize(worldsize), source = 0_pInt)
|
allocate(outputSize(worldsize), source = 0_pInt)
|
||||||
outputSize(worldrank+1) = localShape(3)
|
outputSize(worldrank+1) = localShape(3)
|
||||||
#ifdef PETSc
|
#ifdef PETSc
|
||||||
|
@ -1496,12 +1566,14 @@ subroutine HDF5_write_pInt4(dataset,loc_id,datasetName,parallel)
|
||||||
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
||||||
integer(HSIZE_T), dimension(4) :: myStart
|
integer(HSIZE_T), dimension(4) :: myStart
|
||||||
|
|
||||||
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
!-------------------------------------------------------------------------------------------------
|
||||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pInt4: h5pcreate_f')
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
! determine shape of dataset
|
! determine shape of dataset
|
||||||
localShape = shape(dataset)
|
localShape = shape(dataset)
|
||||||
|
if (any(localShape(1:size(localShape)) == 0)) return
|
||||||
|
|
||||||
|
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
||||||
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
allocate(outputSize(worldsize), source = 0_pInt)
|
allocate(outputSize(worldsize), source = 0_pInt)
|
||||||
outputSize(worldrank+1) = localShape(4)
|
outputSize(worldrank+1) = localShape(4)
|
||||||
#ifdef PETSc
|
#ifdef PETSc
|
||||||
|
@ -1582,12 +1654,14 @@ subroutine HDF5_write_pInt5(dataset,loc_id,datasetName,parallel)
|
||||||
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
||||||
integer(HSIZE_T), dimension(5) :: myStart
|
integer(HSIZE_T), dimension(5) :: myStart
|
||||||
|
|
||||||
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
!-------------------------------------------------------------------------------------------------
|
||||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pInt5: h5pcreate_f')
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
! determine shape of dataset
|
! determine shape of dataset
|
||||||
localShape = shape(dataset)
|
localShape = shape(dataset)
|
||||||
|
if (any(localShape(1:size(localShape)) == 0)) return
|
||||||
|
|
||||||
|
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
||||||
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
allocate(outputSize(worldsize), source = 0_pInt)
|
allocate(outputSize(worldsize), source = 0_pInt)
|
||||||
outputSize(worldrank+1) = localShape(5)
|
outputSize(worldrank+1) = localShape(5)
|
||||||
#ifdef PETSc
|
#ifdef PETSc
|
||||||
|
@ -1668,12 +1742,14 @@ subroutine HDF5_write_pInt6(dataset,loc_id,datasetName,parallel)
|
||||||
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
||||||
integer(HSIZE_T), dimension(6) :: myStart
|
integer(HSIZE_T), dimension(6) :: myStart
|
||||||
|
|
||||||
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
!-------------------------------------------------------------------------------------------------
|
||||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pInt6: h5pcreate_f')
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
! determine shape of dataset
|
! determine shape of dataset
|
||||||
localShape = shape(dataset)
|
localShape = shape(dataset)
|
||||||
|
if (any(localShape(1:size(localShape)) == 0)) return
|
||||||
|
|
||||||
|
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
||||||
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
allocate(outputSize(worldsize), source = 0_pInt)
|
allocate(outputSize(worldsize), source = 0_pInt)
|
||||||
outputSize(worldrank+1) = localShape(6)
|
outputSize(worldrank+1) = localShape(6)
|
||||||
#ifdef PETSc
|
#ifdef PETSc
|
||||||
|
@ -1754,12 +1830,14 @@ subroutine HDF5_write_pInt7(dataset,loc_id,datasetName,parallel)
|
||||||
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
||||||
integer(HSIZE_T), dimension(7) :: myStart
|
integer(HSIZE_T), dimension(7) :: myStart
|
||||||
|
|
||||||
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
!-------------------------------------------------------------------------------------------------
|
||||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='HDF5_write_pInt7: h5pcreate_f')
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
! determine shape of dataset
|
! determine shape of dataset
|
||||||
localShape = shape(dataset)
|
localShape = shape(dataset)
|
||||||
|
if (any(localShape(1:size(localShape)) == 0)) return
|
||||||
|
|
||||||
|
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
||||||
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
allocate(outputSize(worldsize), source = 0_pInt)
|
allocate(outputSize(worldsize), source = 0_pInt)
|
||||||
outputSize(worldrank+1) = localShape(7)
|
outputSize(worldrank+1) = localShape(7)
|
||||||
#ifdef PETSc
|
#ifdef PETSc
|
||||||
|
@ -1820,3 +1898,7 @@ end module HDF5_Utilities
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue