aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland Haas <rhaas@tapir.caltech.edu>2013-08-11 20:15:28 -0700
committerRoland Haas <rhaas@tapir.caltech.edu>2013-08-12 07:58:21 -0700
commitfdadb2cfc19a42ada49fc91c12e56646848ca8b9 (patch)
tree1137248507685ec6417d92618b6ebea7c5015ddb
parentdff327351eb8642931e7d7b328224e29a9133eca (diff)
CarpetIOHDF5: use simple_extents rather than storage size on disk
storage size is literally the amount of space used on disk, so if eg compression is used, this is much smaller than the amount of space required to hold the data in memory. Also change type of data read in to what the memory dataspace is not what the dataspace on disk is. This way HDF5 actually converts from the on-disk representation to the in-memory one.
-rw-r--r--Carpet/CarpetIOHDF5/src/Input.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/Carpet/CarpetIOHDF5/src/Input.cc b/Carpet/CarpetIOHDF5/src/Input.cc
index 21a855a01..a2e64245d 100644
--- a/Carpet/CarpetIOHDF5/src/Input.cc
+++ b/Carpet/CarpetIOHDF5/src/Input.cc
@@ -993,16 +993,19 @@ static list<fileset_t>::iterator OpenFileSet (const cGH* const cctkGH,
HDF5_ERROR (datatype = H5Dget_type(dataset));
HDF5_ERROR (old_data = H5Tequal(datatype, H5T_NATIVE_CHAR));
if (old_data) {
+ hid_t dataspace;
+ HDF5_ERROR (dataspace = H5Dget_space(dataset));
/* old data that stored this as an array of chars */
CCTK_WARN (CCTK_WARN_ALERT, "Old-style checkpoint data found.");
- HDF5_ERROR (len = H5Dget_storage_size(dataset) + 1);
+ HDF5_ERROR (len = H5Sget_simple_extent_npoints(dataspace) + 1);
+ HDF5_ERROR (H5Sclose(dataspace));
} else {
HDF5_ERROR (len = H5Tget_size(datatype));
}
vector<char> parameter_buf(len);
char* parameters = &parameter_buf[0];
- HDF5_ERROR (H5Dread (dataset, datatype, H5S_ALL, H5S_ALL,
+ HDF5_ERROR (H5Dread (dataset, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL,
H5P_DEFAULT, parameters));
HDF5_ERROR (H5Dclose (dataset));
HDF5_ERROR (H5Tclose (datatype));
@@ -1096,16 +1099,19 @@ static void ReadMetadata (fileset_t& fileset, hid_t file)
HDF5_ERROR (datatype = H5Dget_type(dataset));
HDF5_ERROR (old_data = H5Tequal(datatype, H5T_NATIVE_CHAR));
if (old_data) {
+ hid_t dataspace;
+ HDF5_ERROR (dataspace = H5Dget_space(dataset));
/* old data that stored this as an array of chars */
CCTK_WARN (CCTK_WARN_ALERT, "Old-style checkpoint data found.");
- HDF5_ERROR (len = H5Dget_storage_size(dataset) + 1);
+ HDF5_ERROR (len = H5Sget_simple_extent_npoints(dataspace) + 1);
+ HDF5_ERROR (H5Sclose(dataspace));
} else {
HDF5_ERROR (len = H5Tget_size(datatype));
}
vector<char> gs_str_buf(len);
char* gs_str = &gs_str_buf[0];
- HDF5_ERROR (H5Dread (dataset, datatype, H5S_ALL, H5S_ALL,
+ HDF5_ERROR (H5Dread (dataset, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL,
H5P_DEFAULT, gs_str));
HDF5_ERROR (H5Dclose (dataset));
HDF5_ERROR (H5Tclose (datatype));