summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2014-01-30 16:26:21 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2014-01-30 16:26:21 (GMT)
commitfe39331ca52400dd3adf6413c4083ff459365748 (patch)
tree85ac31a32a473e74ec445ad6094dfa9c91976521
parent9fd5bb42bf90df3f8fb66fd3e8bebf90edc7ebb7 (diff)
downloadhdf5-fe39331ca52400dd3adf6413c4083ff459365748.zip
hdf5-fe39331ca52400dd3adf6413c4083ff459365748.tar.gz
hdf5-fe39331ca52400dd3adf6413c4083ff459365748.tar.bz2
[svn-r24664] update checksums for datasets.
update tests.
-rw-r--r--examples/h5ff_client_dset.c92
-rw-r--r--examples/h5ff_client_map.c4
-rw-r--r--src/H5Pocpl.c2
-rw-r--r--src/H5VLiod.c2
-rw-r--r--src/H5VLiod_common.c1
-rw-r--r--src/H5VLiod_dset.c61
6 files changed, 96 insertions, 66 deletions
diff --git a/examples/h5ff_client_dset.c b/examples/h5ff_client_dset.c
index 1ece017..207ab90 100644
--- a/examples/h5ff_client_dset.c
+++ b/examples/h5ff_client_dset.c
@@ -72,7 +72,7 @@ int main(int argc, char **argv) {
H5ES_status_t status;
size_t num_events = 0;
unsigned int i = 0;
- uint64_t cs = 0,read1_cs = 0, read2_cs = 0;
+ uint64_t array_cs = 0, elmt_cs = 0, read1_cs = 0, read2_cs = 0;
uint32_t cs_scope = 0;
herr_t ret;
@@ -87,7 +87,7 @@ int main(int argc, char **argv) {
MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
MPI_Comm_size(MPI_COMM_WORLD, &my_size);
- fprintf(stderr, "APP processes = %d, my rank is %d\n", my_size, my_rank);
+ printf("APP processes = %d, my rank is %d\n", my_size, my_rank);
/* Choose the IOD VOL plugin to use with this file. */
fapl_id = H5Pcreate (H5P_FILE_ACCESS);
@@ -248,39 +248,42 @@ int main(int argc, char **argv) {
/* Attach a checksum to the dxpl which is verified all the way
down at the server */
dxpl_id = H5Pcreate (H5P_DATASET_XFER);
- cs = checksum_crc64(wdata1, sizeof(int32_t) * nelem);
- H5Pset_dxpl_checksum(dxpl_id, cs);
-
- /* tell HDF5 to disable all data integrity checks for this write */
- cs_scope = 0;
- ret = H5Pset_rawdata_integrity_scope(dxpl_id, cs_scope);
- assert(ret == 0);
-
+ array_cs = checksum_crc64(wdata1, sizeof(int32_t) * nelem);
+ H5Pset_dxpl_checksum(dxpl_id, array_cs);
+ printf("Checksum computed for raw data: %016lX\n", array_cs);
ret = H5Dwrite_ff(did1, dtid, H5S_ALL, H5S_ALL, dxpl_id, wdata1, tid1, e_stack);
assert(ret == 0);
/* Raw data write on D2. same as previous, but here we indicate
through the property list that we want to inject a
corruption. */
- //cs = checksum_crc64(wdata2, sizeof(int32_t) * nelem);
- //H5Pset_dxpl_checksum(dxpl_id, cs);
+ //array_cs = checksum_crc64(wdata2, sizeof(int32_t) * nelem);
+ //H5Pset_dxpl_checksum(dxpl_id, array_cs);
//H5Pset_dxpl_inject_corruption(dxpl_id, 1);
/* tell HDF5 to disable data integrity checks stored at IOD for this write;
The transfer checksum will still capture the corruption. */
- cs_scope |= H5_CHECKSUM_TRANSFER;
- ret = H5Pset_rawdata_integrity_scope(dxpl_id, cs_scope);
- assert(ret == 0);
+ //cs_scope |= H5_CHECKSUM_TRANSFER;
+ //ret = H5Pset_rawdata_integrity_scope(dxpl_id, cs_scope);
+ //assert(ret == 0);
element = 450;
+ elmt_cs = checksum_crc64(&element, sizeof(int32_t));
+ H5Pset_dxpl_checksum(dxpl_id, elmt_cs);
+
ret = H5Dwrite_ff(did2, dtid, scalar, scalar, dxpl_id, &element, tid1, e_stack);
assert(ret == 0);
+ /* tell HDF5 to disable all data integrity checks for this write */
+ cs_scope = 0;
+ ret = H5Pset_rawdata_integrity_scope(dxpl_id, cs_scope);
+ assert(ret == 0);
+
/* Raw data write on D3. Same as previous; however we specify that
the data in the buffer is in BE byte order. Type conversion will
happen at the server when we detect that the dataset type is of
LE order and the datatype here is in BE order. */
- ret = H5Dwrite_ff(did3, H5T_STD_I16BE, sid, sid, H5P_DEFAULT, wdata3, tid1, e_stack);
+ ret = H5Dwrite_ff(did3, H5T_STD_I16BE, sid, sid, dxpl_id, wdata3, tid1, e_stack);
assert(ret == 0);
H5Pclose(dxpl_id);
@@ -373,14 +376,19 @@ int main(int argc, char **argv) {
ret = H5Dread_ff(did1, dtid, H5S_ALL, H5S_ALL, dxpl_id, rdata2, rid2, e_stack);
assert(ret == 0);
- H5Pclose(dxpl_id);
+
+ /* tell HDF5 to disable all data integrity checks for this write */
+ cs_scope = 0;
+ ret = H5Pset_rawdata_integrity_scope(dxpl_id, cs_scope);
+ assert(ret == 0);
/* Raw data read on D3. This is asynchronous. Note that the type
is different than the dataset type. */
- ret = H5Dread_ff(did3, H5T_STD_I16BE, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata3,
- rid2, e_stack);
+ ret = H5Dread_ff(did3, H5T_STD_I16BE, H5S_ALL, H5S_ALL, dxpl_id, rdata3, rid2, e_stack);
assert(ret == 0);
+ H5Pclose(dxpl_id);
+
/* Raw data read on D1. This is asynchronous. The read is done into a
noncontiguous memory dataspace selection */
{
@@ -411,10 +419,10 @@ int main(int argc, char **argv) {
printf("ESWait H5Dread Completion status = %d\n", status);
assert (status);
- fprintf(stderr, "Printing all Dataset values. We should have a 0 after each element: ");
+ printf("Printing all Dataset values. We should have a 0 after each element: ");
for(i=0;i<120;++i)
- fprintf(stderr, "%d ", buf[i]);
- fprintf(stderr, "\n");
+ printf("%d ", buf[i]);
+ printf("\n");
free(buf);
}
@@ -427,7 +435,7 @@ int main(int argc, char **argv) {
printf("ESWait H5Dread Completion status = %d\n", status);
assert (status);
- fprintf(stderr, "Rank %d read value %d\n", my_rank, element);
+ printf("Rank %d read value %d\n", my_rank, element);
assert(element == 450);
#if 0
@@ -529,10 +537,10 @@ int main(int argc, char **argv) {
rid4, H5_EVENT_STACK_NULL);
assert(ret == 0);
- fprintf(stderr, "Printing all Extended Dataset values: ");
+ printf("Printing all Extended Dataset values: ");
for(i=0 ; i<nelem+10 ; ++i)
- fprintf(stderr, "%d ", ex_rdata[i]);
- fprintf(stderr, "\n");
+ printf("%d ", ex_rdata[i]);
+ printf("\n");
H5Sclose(esid);
}
@@ -591,29 +599,27 @@ int main(int argc, char **argv) {
H5ESclear(e_stack);
- fprintf(stderr, "Read Data1: ");
+ printf("Read Data1: ");
for(i=0;i<nelem;++i)
- fprintf(stderr, "%d ",rdata1[i]);
- fprintf(stderr, "\n");
- fprintf(stderr,
- "Checksum Receieved = %llu Checksum Computed = %llu (Should be Equal)\n",
- read1_cs, cs);
+ printf("%d ",rdata1[i]);
+ printf("\n");
+ printf("Checksum Receieved = %016lX Checksum Computed = %016lX (Should be Equal)\n",
+ read1_cs, array_cs);
- fprintf(stderr, "Read Data2 (corrupted): ");
+ printf("Read Data2 (corrupted): ");
for(i=0;i<nelem;++i)
- fprintf(stderr, "%d ",rdata2[i]);
- fprintf(stderr, "\n");
- fprintf(stderr,
- "Checksum Receieved = %llu Checksum Computed = %llu (Should NOT be Equal)\n",
- read2_cs, cs);
+ printf("%d ",rdata2[i]);
+ printf("\n");
+ printf("Checksum Receieved = %016lX Checksum Computed = %016lX (Should NOT be Equal)\n",
+ read2_cs, array_cs);
- assert(read1_cs == cs);
- assert(read2_cs != cs);
+ assert(read1_cs == array_cs);
+ assert(read2_cs != array_cs);
- fprintf(stderr, "Read Data3 (32 LE converted to 16 bit BE order): ");
+ printf("Read Data3 (32 LE converted to 16 bit BE order): ");
for(i=0;i<nelem;++i)
- fprintf(stderr, "%d ",rdata3[i]);
- fprintf(stderr, "\n");
+ printf("%d ",rdata3[i]);
+ printf("\n");
ret = H5ESclose(e_stack);
assert(ret == 0);
diff --git a/examples/h5ff_client_map.c b/examples/h5ff_client_map.c
index 9eb8c7a..8574d42 100644
--- a/examples/h5ff_client_map.c
+++ b/examples/h5ff_client_map.c
@@ -321,11 +321,13 @@ int main(int argc, char **argv) {
trspl_id = H5Pcreate (H5P_TR_START);
ret = H5Pset_trspl_num_peers(trspl_id, my_size);
assert(0 == ret);
- ret = H5TRstart(tid2, trspl_id, e_stack);
+ ret = H5TRstart(tid2, trspl_id, H5_EVENT_STACK_NULL);
assert(0 == ret);
ret = H5Pclose(trspl_id);
assert(0 == ret);
+ MPI_Barrier(MPI_COMM_WORLD);
+
if((my_size > 1 && 1 == my_rank) ||
(my_size == 1 && 0 == my_rank)) {
hid_t temp_id;
diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c
index cb68496..c5a6238 100644
--- a/src/H5Pocpl.c
+++ b/src/H5Pocpl.c
@@ -52,7 +52,7 @@
#ifdef H5_HAVE_EFF
/* hint for IOD to enable checksums on an object */
#define H5O_CRT_ENABLE_CHECKSUM_SIZE sizeof(hbool_t)
-#define H5O_CRT_ENABLE_CHECKSUM_DEF FALSE
+#define H5O_CRT_ENABLE_CHECKSUM_DEF TRUE
#define H5O_CRT_ENABLE_CHECKSUM_ENC H5P__encode_hbool_t
#define H5O_CRT_ENABLE_CHECKSUM_DEC H5P__decode_hbool_t
#endif
diff --git a/src/H5VLiod.c b/src/H5VLiod.c
index f39f987..593d5ab 100644
--- a/src/H5VLiod.c
+++ b/src/H5VLiod.c
@@ -3410,7 +3410,7 @@ H5VL_iod_dataset_write(void *_dset, hid_t mem_type_id, hid_t mem_space_id,
if((raw_cs_scope & H5_CHECKSUM_MEMORY) && user_cs &&
user_cs != internal_cs) {
- fprintf(stderr, "Errrr.. In memory Data corruption. expecting %"PRIu64", got %"PRIu64"\n",
+ fprintf(stderr, "Errrr.. In memory Data corruption. expecting %016lX, got %016lX\n",
user_cs, internal_cs);
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "Checksum verification failed");
}
diff --git a/src/H5VLiod_common.c b/src/H5VLiod_common.c
index c22be61..bbec47d 100644
--- a/src/H5VLiod_common.c
+++ b/src/H5VLiod_common.c
@@ -928,7 +928,6 @@ H5VL_iod_free_list_free(void **free_list, size_t free_list_len)
} /* end H5VL_iod_free_list_free() */
#ifdef H5_HAVE_EFF
-
uint64_t
H5_checksum_crc64(const void *buf, size_t buf_size)
{
diff --git a/src/H5VLiod_dset.c b/src/H5VLiod_dset.c
index 1e617f3..4503732 100644
--- a/src/H5VLiod_dset.c
+++ b/src/H5VLiod_dset.c
@@ -128,17 +128,19 @@ H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine,
iod_trans_id_t rtid = input->rcxt_num;
uint32_t cs_scope = input->cs_scope;
hid_t space_id = input->space_id;
+ hid_t dcpl_id;
iod_handles_t dset_oh, cur_oh;
iod_handle_t mdkv_oh;
iod_obj_id_t cur_id;
const char *name = input->name; /* name of dset including path to create */
char *last_comp; /* the name of the dataset obtained from the last component in the path */
- hid_t dcpl_id;
iod_array_struct_t array; /* IOD array struct describing the dataset's dimensions */
scratch_pad sp;
iod_ret_t ret = 0;
int step = 0;
+ hbool_t enable_checksum = FALSE;
H5T_class_t dt_class;
+ iod_hint_list_t *obj_create_hint = NULL;
iod_size_t array_dims[H5S_MAX_RANK], current_dims[H5S_MAX_RANK];
herr_t ret_value = SUCCEED;
@@ -148,6 +150,14 @@ H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine,
fprintf(stderr, "Start dataset create %s at %"PRIu64"\n", name, loc_handle.wr_oh);
#endif
+ if(H5P_DEFAULT == input->dcpl_id)
+ input->dcpl_id = H5Pcopy(H5P_DATASET_CREATE_DEFAULT);
+ dcpl_id = input->dcpl_id;
+
+ /* get the scope for data integrity checks for raw data */
+ if(H5Pget_ocpl_enable_checksum(dcpl_id, &enable_checksum) < 0)
+ HGOTO_ERROR2(H5E_PLIST, H5E_CANTGET, FAIL, "can't get scope for data integrity checks");
+
/* the traversal will retrieve the location where the dataset needs
to be created. The traversal will fail if an intermediate group
does not exist. */
@@ -157,9 +167,20 @@ H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine,
#if H5VL_IOD_DEBUG
fprintf(stderr, "Creating Dataset ID %"PRIx64" ",dset_id);
- fprintf(stderr, "at (OH %"PRIu64" ID %"PRIx64")\n", cur_oh.wr_oh, cur_id);
+ fprintf(stderr, "at (OH %"PRIu64" ID %"PRIx64") ", cur_oh.wr_oh, cur_id);
+ if(enable_checksum)
+ fprintf(stderr, "with Data integrity ENABLED\n");
+ else
+ fprintf(stderr, "with Data integrity DISABLED\n");
#endif
+ if(enable_checksum) {
+ obj_create_hint = (iod_hint_list_t *)malloc(sizeof(iod_hint_list_t) + sizeof(iod_hint_t));
+ obj_create_hint->num_hint = 1;
+ obj_create_hint->hint[0].key = "iod_obj_enable_checksum";
+ obj_create_hint->hint[0].value = "iod_obj_enable_checksum";
+ }
+
dt_class = H5Tget_class(input->type_id);
/* Set the IOD array creation parameters */
if(dt_class == H5T_VLEN ||
@@ -201,7 +222,7 @@ H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine,
#endif
/* create the dataset */
- ret = iod_obj_create(coh, wtid, NULL, IOD_OBJ_ARRAY, NULL,
+ ret = iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_ARRAY, NULL,
&array, &dset_id, NULL);
if(ret != 0) {
fprintf(stderr, "ret: %d error: %s\n", ret, strerror(-ret));
@@ -318,16 +339,18 @@ done:
if(ret_value < 0) {
fprintf(stderr, "failed to create Dataset\n");
+ if(obj_create_hint) {
+ free(obj_create_hint);
+ obj_create_hint = NULL;
+ }
+
if(step == 2) {
- if(iod_obj_close(mdkv_oh, NULL, NULL) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
+ iod_obj_close(mdkv_oh, NULL, NULL);
step --;
}
if(step == 1) {
- if(iod_obj_close(dset_oh.rd_oh, NULL, NULL) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
- if(iod_obj_close(dset_oh.wr_oh, NULL, NULL) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
+ iod_obj_close(dset_oh.rd_oh, NULL, NULL);
+ iod_obj_close(dset_oh.wr_oh, NULL, NULL);
}
output.iod_oh.rd_oh.cookie = IOD_OH_UNDEFINED;
@@ -606,7 +629,7 @@ done:
HDONE_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't send result of write to client");
#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with dset read, checksum %"PRIu64", sending response to client\n", cs);
+ fprintf(stderr, "Done with dset read, checksum %016lX, sending response to client\n", cs);
#endif
input = (dset_io_in_t *)H5MM_xfree(input);
@@ -646,7 +669,6 @@ H5VL_iod_server_dset_get_vl_size_cb(AXE_engine_t UNUSED axe_engine,
void *_op_data)
{
op_data_t *op_data = (op_data_t *)_op_data;
- //dset_get_vl_size_in_t *input = (dset_get_vl_size_in_t *)op_data->input;
dset_io_in_t *input = (dset_io_in_t *)op_data->input;
dset_read_out_t output;
iod_handle_t coh = input->coh; /* container handle */
@@ -1255,7 +1277,7 @@ done:
herr_t
H5VL__iod_server_final_io(iod_handle_t iod_oh, hid_t space_id, size_t elmt_size,
hbool_t write_op, void *buf,
- size_t UNUSED buf_size, iod_checksum_t UNUSED cs,
+ size_t UNUSED buf_size, iod_checksum_t cs,
uint32_t cs_scope, iod_trans_id_t tid)
{
int ndims, i; /* dataset's rank/number of dimensions */
@@ -1360,16 +1382,16 @@ H5VL__iod_server_final_io(iod_handle_t iod_oh, hid_t space_id, size_t elmt_size,
}
if(write_op) {
- /* Write list IO */
- ret = iod_array_write(iod_oh, tid, NULL, mem_desc, file_desc, NULL, NULL);
+ /* write to array */
+ ret = iod_array_write(iod_oh, tid, NULL, mem_desc, file_desc, cs_list, NULL);
if(ret != 0) {
fprintf(stderr, "ret: %d error: %s\n", ret, strerror(-ret));
HGOTO_ERROR2(H5E_SYM, H5E_READERROR, FAIL, "can't write to array object");
}
}
else {
- /* Read list IO */
- ret = iod_array_read(iod_oh, tid, NULL, mem_desc, file_desc, NULL, NULL);
+ /* Read from array */
+ ret = iod_array_read(iod_oh, tid, NULL, mem_desc, file_desc, cs_list, NULL);
if(ret != 0) {
fprintf(stderr, "ret: %d error: %s\n", ret, strerror(-ret));
HGOTO_ERROR2(H5E_SYM, H5E_READERROR, FAIL, "can't read from array object");
@@ -1392,14 +1414,15 @@ H5VL__iod_server_final_io(iod_handle_t iod_oh, hid_t space_id, size_t elmt_size,
num_bytes = num_elems * elmt_size;
checksum = H5_checksum_crc64(buf_ptr, (size_t)num_bytes);
-
- /* MSC - No CS from IOD yet
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "IOD checksum = %016lX Checksum Computed = %016lX\n",
+ cs_list[n], checksum);
+#endif
if(checksum != cs_list[n]) {
fprintf(stderr, "Data Corruption detected when reading\n");
ret_value = FAIL;
goto done;
}
- */
buf_ptr += num_bytes;
}
}