IO: Compress only variable datasets in HDF5 regular snapshots.
Do not compress HDF5 restart snapshots at all. Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit is contained in:
parent
a364281184
commit
80b9c6d6a2
@ -3757,13 +3757,13 @@ module io
|
||||
allocate(array(nmodes,NDIMS), stat=status)
|
||||
if (status == 0) then
|
||||
array = real(fcoefs)
|
||||
call store_dataset_h5(grp_id, 'fcoefs_real', H5T_NATIVE_DOUBLE, &
|
||||
dims, array, status)
|
||||
call store_dataset_h5(grp_id, 'fcoefs_real', H5T_NATIVE_DOUBLE, &
|
||||
dims, array, .false., status)
|
||||
if (status < 0) &
|
||||
call print_message(loc, "Could not store real(fcoefs)!")
|
||||
array = aimag(fcoefs)
|
||||
call store_dataset_h5(grp_id, 'fcoefs_imag', H5T_NATIVE_DOUBLE, &
|
||||
dims, array, status)
|
||||
call store_dataset_h5(grp_id, 'fcoefs_imag', H5T_NATIVE_DOUBLE, &
|
||||
dims, array, .false., status)
|
||||
if (status < 0) &
|
||||
call print_message(loc, "Could not store imag(fcoefs)!")
|
||||
deallocate(array, stat=status)
|
||||
@ -3791,7 +3791,7 @@ module io
|
||||
if (status == 0) then
|
||||
call get_seeds(seeds)
|
||||
call store_dataset_h5(grp_id, 'seeds', H5T_STD_I64LE, &
|
||||
dims, seeds, status)
|
||||
dims, seeds, .false., status)
|
||||
if (status < 0) &
|
||||
call print_message(loc, "Could not store seeds!")
|
||||
deallocate(seeds, stat=status)
|
||||
@ -4168,30 +4168,30 @@ module io
|
||||
|
||||
l = rank(fields)
|
||||
dims(1:l) = shape(fields)
|
||||
call store_dataset_h5(grp_id, 'fields', &
|
||||
H5T_NATIVE_INTEGER, dims(1:l), fields, status)
|
||||
call store_dataset_h5(grp_id, 'fields', H5T_NATIVE_INTEGER, &
|
||||
dims(1:l), fields, .false., status)
|
||||
l = rank(children)
|
||||
dims(1:l) = shape(children)
|
||||
call store_dataset_h5(grp_id, 'children', &
|
||||
H5T_NATIVE_INTEGER, dims(1:l), children, status)
|
||||
call store_dataset_h5(grp_id, 'children', H5T_NATIVE_INTEGER, &
|
||||
dims(1:l), children, .false., status)
|
||||
#if NDIMS == 3
|
||||
l = rank(faces)
|
||||
dims(1:l) = shape(faces)
|
||||
call store_dataset_h5(grp_id, 'faces', &
|
||||
H5T_NATIVE_INTEGER, dims(1:l), faces, status)
|
||||
call store_dataset_h5(grp_id, 'faces', H5T_NATIVE_INTEGER, &
|
||||
dims(1:l), faces, .false., status)
|
||||
#endif /* NDIMS == 3 */
|
||||
l = rank(edges)
|
||||
dims(1:l) = shape(edges)
|
||||
call store_dataset_h5(grp_id, 'edges', &
|
||||
H5T_NATIVE_INTEGER, dims(1:l), edges, status)
|
||||
call store_dataset_h5(grp_id, 'edges', H5T_NATIVE_INTEGER, &
|
||||
dims(1:l), edges, .false., status)
|
||||
l = rank(corners)
|
||||
dims(1:l) = shape(corners)
|
||||
call store_dataset_h5(grp_id, 'corners', &
|
||||
H5T_NATIVE_INTEGER, dims(1:l), corners, status)
|
||||
call store_dataset_h5(grp_id, 'corners', H5T_NATIVE_INTEGER, &
|
||||
dims(1:l), corners, .false., status)
|
||||
l = rank(bounds)
|
||||
dims(1:l) = shape(bounds)
|
||||
call store_dataset_h5(grp_id, 'bounds', &
|
||||
H5T_NATIVE_DOUBLE, dims(1:l), bounds, status)
|
||||
call store_dataset_h5(grp_id, 'bounds', H5T_NATIVE_DOUBLE, &
|
||||
dims(1:l), bounds, .false., status)
|
||||
|
||||
#if NDIMS == 3
|
||||
deallocate(fields, children, bounds, faces, &
|
||||
@ -4441,13 +4441,13 @@ module io
|
||||
cdims = shape(pdata%uu)
|
||||
|
||||
call store_dataset_h5(blk_id, 'primitive_variables', &
|
||||
H5T_NATIVE_DOUBLE, pdims, pdata%q, status)
|
||||
H5T_NATIVE_DOUBLE, pdims, pdata%q, .false., status)
|
||||
if (status /= 0) &
|
||||
call print_message(loc, &
|
||||
"Could not store the primitive variables in " // &
|
||||
trim(blk_name) // "!")
|
||||
call store_dataset_h5(blk_id, 'conservative_variables', &
|
||||
H5T_NATIVE_DOUBLE, cdims, pdata%uu, status)
|
||||
H5T_NATIVE_DOUBLE, cdims, pdata%uu, .false., status)
|
||||
if (status /= 0) &
|
||||
call print_message(loc, &
|
||||
"Could not store the conservative variables in " // &
|
||||
@ -4533,10 +4533,13 @@ module io
|
||||
end if
|
||||
|
||||
am(1) = toplev
|
||||
call store_dataset_h5(grp_id, 'dx', H5T_NATIVE_DOUBLE, am, adx, status)
|
||||
call store_dataset_h5(grp_id, 'dy', H5T_NATIVE_DOUBLE, am, ady, status)
|
||||
call store_dataset_h5(grp_id, 'dx', H5T_NATIVE_DOUBLE, &
|
||||
am, adx, .false., status)
|
||||
call store_dataset_h5(grp_id, 'dy', H5T_NATIVE_DOUBLE, &
|
||||
am, ady, .false., status)
|
||||
#if NDIMS == 3
|
||||
call store_dataset_h5(grp_id, 'dz', H5T_NATIVE_DOUBLE, am, adz, status)
|
||||
call store_dataset_h5(grp_id, 'dz', H5T_NATIVE_DOUBLE, &
|
||||
am, adz, .false., status)
|
||||
#endif /* NDIMS == 3 */
|
||||
|
||||
if (get_dblocks() > 0) then
|
||||
@ -4575,14 +4578,14 @@ module io
|
||||
pdata => pdata%next
|
||||
end do
|
||||
|
||||
call store_dataset_h5(grp_id, 'ids', &
|
||||
H5T_NATIVE_INTEGER, im, ids, status)
|
||||
call store_dataset_h5(grp_id, 'levels', &
|
||||
H5T_NATIVE_INTEGER, im, levels, status)
|
||||
call store_dataset_h5(grp_id, 'coords', &
|
||||
H5T_NATIVE_INTEGER, cm, coords, status)
|
||||
call store_dataset_h5(grp_id, 'bounds', &
|
||||
H5T_NATIVE_DOUBLE, bm, bounds, status)
|
||||
call store_dataset_h5(grp_id, 'ids', H5T_NATIVE_INTEGER, &
|
||||
im, ids, .false., status)
|
||||
call store_dataset_h5(grp_id, 'levels', H5T_NATIVE_INTEGER, &
|
||||
im, levels, .false., status)
|
||||
call store_dataset_h5(grp_id, 'coords', H5T_NATIVE_INTEGER, &
|
||||
cm, coords, .false., status)
|
||||
call store_dataset_h5(grp_id, 'bounds', H5T_NATIVE_DOUBLE, &
|
||||
bm, bounds, .false., status)
|
||||
|
||||
deallocate(ids, levels, coords, bounds, stat=status)
|
||||
if (status > 0) &
|
||||
@ -4669,7 +4672,7 @@ module io
|
||||
end do
|
||||
|
||||
call store_dataset_h5(grp_id, trim(pvars(p)), &
|
||||
H5T_NATIVE_DOUBLE, dims, array, status)
|
||||
H5T_NATIVE_DOUBLE, dims, array, .true., status)
|
||||
end do
|
||||
|
||||
deallocate(array, stat=status)
|
||||
@ -5238,16 +5241,18 @@ module io
|
||||
!
|
||||
! Arguments:
|
||||
!
|
||||
! loc_id - the location in which the dataset is stored;
|
||||
! name - the dataset name;
|
||||
! type_id - the dataset type;
|
||||
! dims - the dataset dimensions;
|
||||
! buffer - the dataset buffer to store;
|
||||
! status - the subroutine call status;
|
||||
! loc_id - the location in which the dataset is stored;
|
||||
! name - the dataset name;
|
||||
! type_id - the dataset type;
|
||||
! dims - the dataset dimensions;
|
||||
! buffer - the dataset buffer to store;
|
||||
! compress - the logical flag inficating is dataset should be compressed;
|
||||
! status - the subroutine call status;
|
||||
!
|
||||
!===============================================================================
|
||||
!
|
||||
subroutine store_dataset_h5(loc_id, name, type_id, dims, buffer, status)
|
||||
subroutine store_dataset_h5(loc_id, name, type_id, dims, &
|
||||
buffer, compress, status)
|
||||
|
||||
use helpers , only : print_message
|
||||
use iso_c_binding, only : c_loc
|
||||
@ -5258,16 +5263,22 @@ module io
|
||||
character(len=*) , intent(in) :: name
|
||||
integer(hsize_t), dimension(:), intent(in) :: dims
|
||||
type(*), target, dimension(..), intent(in) :: buffer
|
||||
logical , intent(in) :: compress
|
||||
integer , intent(out) :: status
|
||||
|
||||
integer :: rank
|
||||
integer(hid_t) :: space_id, dset_id
|
||||
|
||||
integer(hsize_t), dimension(size(dims)) :: cdims
|
||||
|
||||
character(len=*), parameter :: loc = 'IO::store_dataset_h5()'
|
||||
|
||||
!-------------------------------------------------------------------------------
|
||||
!
|
||||
rank = size(dims)
|
||||
cdims = dims
|
||||
rank = size(dims)
|
||||
|
||||
if (compress) cdims(1) = 1
|
||||
|
||||
call h5screate_simple_f(rank, dims, space_id, status)
|
||||
if (status /= 0) then
|
||||
@ -5275,14 +5286,18 @@ module io
|
||||
"Could not create the dataspace for dataset '" // trim(name) // "'!")
|
||||
return
|
||||
end if
|
||||
call h5pset_chunk_f(prp_id, rank, dims, status)
|
||||
call h5pset_chunk_f(prp_id, rank, cdims, status)
|
||||
if (status /= 0) then
|
||||
call print_message(loc, &
|
||||
"Could not set the chunk size for dataset '" // trim(name) // "'!")
|
||||
go to 1000
|
||||
end if
|
||||
|
||||
call h5dcreate_f(loc_id, name, type_id, space_id, dset_id, status, prp_id)
|
||||
if (compress) then
|
||||
call h5dcreate_f(loc_id, name, type_id, space_id, dset_id, status, prp_id)
|
||||
else
|
||||
call h5dcreate_f(loc_id, name, type_id, space_id, dset_id, status)
|
||||
end if
|
||||
if (status /= 0) then
|
||||
call print_message(loc, &
|
||||
"Could not create dataset '" // trim(name) // "'!")
|
||||
|
Loading…
x
Reference in New Issue
Block a user