initialize all variables
This commit is contained in:
parent
09859f1b12
commit
c4eef520fc
|
@ -1291,10 +1291,10 @@ subroutine HDF5_write_pReal7(loc_id,dataset,datasetName,parallel)
|
||||||
|
|
||||||
if (present(parallel)) then
|
if (present(parallel)) then
|
||||||
call initialize_write(dset_id, filespace_id, memspace_id, plist_id, &
|
call initialize_write(dset_id, filespace_id, memspace_id, plist_id, &
|
||||||
myStart, globalShape, loc_id,localShape,datasetName,H5T_NATIVE_INTEGER,parallel)
|
myStart, globalShape, loc_id,localShape,datasetName,H5T_NATIVE_DOUBLE,parallel)
|
||||||
else
|
else
|
||||||
call initialize_write(dset_id, filespace_id, memspace_id, plist_id, &
|
call initialize_write(dset_id, filespace_id, memspace_id, plist_id, &
|
||||||
myStart, globalShape, loc_id,localShape,datasetName,H5T_NATIVE_INTEGER,.false.)
|
myStart, globalShape, loc_id,localShape,datasetName,H5T_NATIVE_DOUBLE,.false.)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call h5dwrite_f(dset_id, H5T_NATIVE_DOUBLE,dataset,int(globalShape,HSIZE_T), hdferr,&
|
call h5dwrite_f(dset_id, H5T_NATIVE_DOUBLE,dataset,int(globalShape,HSIZE_T), hdferr,&
|
||||||
|
@ -1600,22 +1600,23 @@ subroutine initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_
|
||||||
implicit none
|
implicit none
|
||||||
integer(HID_T), intent(in) :: loc_id !< file or group handle
|
integer(HID_T), intent(in) :: loc_id !< file or group handle
|
||||||
character(len=*), intent(in) :: datasetName !< name of the dataset in the file
|
character(len=*), intent(in) :: datasetName !< name of the dataset in the file
|
||||||
logical, intent(in), optional :: parallel
|
logical, intent(in) :: parallel
|
||||||
|
|
||||||
integer(pInt), dimension(worldsize) :: &
|
|
||||||
readSize !< contribution of all processes
|
|
||||||
integer :: ierr
|
|
||||||
integer(HDF5_ERR_TYPE) :: hdferr
|
|
||||||
integer(HID_T), intent(out) :: dset_id, filespace_id, memspace_id, plist_id, aplist_id
|
|
||||||
integer(HSIZE_T), intent(in), dimension(:) :: &
|
integer(HSIZE_T), intent(in), dimension(:) :: &
|
||||||
localShape
|
localShape
|
||||||
integer(HSIZE_T), intent(out), dimension(size(localShape,1)):: &
|
integer(HSIZE_T), intent(out), dimension(size(localShape,1)):: &
|
||||||
myStart, &
|
myStart, &
|
||||||
globalShape !< shape of the dataset (all processes)
|
globalShape !< shape of the dataset (all processes)
|
||||||
|
integer(HID_T), intent(out) :: dset_id, filespace_id, memspace_id, plist_id, aplist_id
|
||||||
|
|
||||||
|
integer(pInt), dimension(worldsize) :: &
|
||||||
|
readSize !< contribution of all processes
|
||||||
|
integer :: ierr
|
||||||
|
integer(HDF5_ERR_TYPE) :: hdferr
|
||||||
|
|
||||||
!-------------------------------------------------------------------------------------------------
|
!-------------------------------------------------------------------------------------------------
|
||||||
! creating a property list for transfer properties (is collective for MPI)
|
! creating a property list for transfer properties (is collective for MPI)
|
||||||
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
call h5pcreate_f(H5P_DATASET_XFER_F, plist_id, hdferr)
|
||||||
|
if (hdferr < 0) call IO_error(1_pInt,ext_msg='initialize_read: h5pcreate_f')
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
readSize = 0_pInt
|
readSize = 0_pInt
|
||||||
|
@ -1665,8 +1666,8 @@ end subroutine initialize_read
|
||||||
subroutine finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
|
subroutine finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
integer(HDF5_ERR_TYPE) :: hdferr
|
|
||||||
integer(HID_T), intent(in) :: dset_id, filespace_id, memspace_id, plist_id, aplist_id
|
integer(HID_T), intent(in) :: dset_id, filespace_id, memspace_id, plist_id, aplist_id
|
||||||
|
integer(HDF5_ERR_TYPE) :: hdferr
|
||||||
|
|
||||||
call h5pclose_f(plist_id, hdferr)
|
call h5pclose_f(plist_id, hdferr)
|
||||||
if (hdferr < 0) call IO_error(1_pInt,ext_msg='finalize_read: plist_id')
|
if (hdferr < 0) call IO_error(1_pInt,ext_msg='finalize_read: plist_id')
|
||||||
|
@ -1693,42 +1694,41 @@ subroutine initialize_write(dset_id, filespace_id, memspace_id, plist_id, &
|
||||||
implicit none
|
implicit none
|
||||||
integer(HID_T), intent(in) :: loc_id !< file or group handle
|
integer(HID_T), intent(in) :: loc_id !< file or group handle
|
||||||
character(len=*), intent(in) :: datasetName !< name of the dataset in the file
|
character(len=*), intent(in) :: datasetName !< name of the dataset in the file
|
||||||
logical, intent(in), optional :: parallel
|
logical, intent(in) :: parallel
|
||||||
|
integer(HID_T), intent(in) :: datatype
|
||||||
|
|
||||||
integer(HSIZE_T), intent(in), dimension(:) :: &
|
integer(HSIZE_T), intent(in), dimension(:) :: &
|
||||||
localShape
|
localShape
|
||||||
integer(HSIZE_T), intent(out), dimension(size(localShape,1)):: &
|
integer(HSIZE_T), intent(out), dimension(size(localShape,1)):: &
|
||||||
myStart, &
|
myStart, &
|
||||||
globalShape !< shape of the dataset (all processes)
|
globalShape !< shape of the dataset (all processes)
|
||||||
|
integer(HID_T), intent(out) :: dset_id, filespace_id, memspace_id, plist_id
|
||||||
|
|
||||||
integer(pInt), dimension(worldsize) :: &
|
integer(pInt), dimension(worldsize) :: &
|
||||||
outputSize !< contribution of all processes
|
writeSize !< contribution of all processes
|
||||||
integer(HID_T), intent(in) :: datatype
|
|
||||||
integer :: ierr
|
integer :: ierr
|
||||||
integer(HDF5_ERR_TYPE) :: hdferr
|
integer(HDF5_ERR_TYPE) :: hdferr
|
||||||
integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
|
|
||||||
|
|
||||||
|
|
||||||
!-------------------------------------------------------------------------------------------------
|
!-------------------------------------------------------------------------------------------------
|
||||||
! 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)
|
||||||
|
if (hdferr < 0) call IO_error(1_pInt,ext_msg='initialize_write: h5pcreate_f')
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
outputSize(worldrank+1) = int(localShape(ubound(localShape,1)),pInt)
|
writeSize = 0_pInt
|
||||||
|
writeSize(worldrank+1) = int(localShape(ubound(localShape,1)),pInt)
|
||||||
|
|
||||||
#ifdef PETSc
|
#ifdef PETSc
|
||||||
if (parallel) then
|
if (parallel) then
|
||||||
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='initialize_write: h5pset_dxpl_mpio_f')
|
if (hdferr < 0) call IO_error(1_pInt,ext_msg='initialize_write: h5pset_dxpl_mpio_f')
|
||||||
call MPI_allreduce(MPI_IN_PLACE,outputSize,worldsize,MPI_INT,MPI_SUM,PETSC_COMM_WORLD,ierr) ! get total output size over each process
|
call MPI_allreduce(MPI_IN_PLACE,writeSize,worldsize,MPI_INT,MPI_SUM,PETSC_COMM_WORLD,ierr) ! get total output size over each process
|
||||||
if (ierr /= 0) call IO_error(894_pInt,ext_msg='initialize_write: MPI_allreduce')
|
if (ierr /= 0) call IO_error(894_pInt,ext_msg='initialize_write: MPI_allreduce')
|
||||||
endif
|
endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
myStart = int(0,HSIZE_T)
|
myStart = int(0,HSIZE_T)
|
||||||
myStart(ubound(myStart)) = int(sum(outputSize(1:worldrank)),HSIZE_T)
|
myStart(ubound(myStart)) = int(sum(writeSize(1:worldrank)),HSIZE_T)
|
||||||
globalShape = [localShape(1:ubound(localShape,1)-1),int(sum(outputSize),HSIZE_T)]
|
globalShape = [localShape(1:ubound(localShape,1)-1),int(sum(writeSize),HSIZE_T)]
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! create dataspace in memory (local shape) and in file (global shape)
|
! create dataspace in memory (local shape) and in file (global shape)
|
||||||
|
|
Loading…
Reference in New Issue