summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2014-02-28 20:43:31 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2014-02-28 20:43:31 (GMT)
commitde5fdb64772179dbf692e0309932b274ea6a9038 (patch)
tree1ebf9a4ad33918e27ba8f84e1057abe2f027621d /src
parent1521d020e11e4fbf761528569d0776a196f221f5 (diff)
downloadhdf5-de5fdb64772179dbf692e0309932b274ea6a9038.zip
hdf5-de5fdb64772179dbf692e0309932b274ea6a9038.tar.gz
hdf5-de5fdb64772179dbf692e0309932b274ea6a9038.tar.bz2
[svn-r24751] add replica property to dxpl and check for it when doing dataset reads and map gets.
Diffstat (limited to 'src')
-rw-r--r--src/H5Pdxpl.c13
-rw-r--r--src/H5VLiod.c72
-rw-r--r--src/H5VLiod.h2
-rw-r--r--src/H5VLiod_dset.c14
-rw-r--r--src/H5VLiod_map.c13
5 files changed, 113 insertions, 1 deletions
diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c
index aad2b0d..3cd9a4e 100644
--- a/src/H5Pdxpl.c
+++ b/src/H5Pdxpl.c
@@ -50,6 +50,12 @@
#ifdef H5_HAVE_EFF
+/* replica ID to use when accessing an object at IOD */
+#define H5O_ACS_REPLICA_ID_SIZE sizeof(hrpl_t)
+#define H5O_ACS_REPLICA_ID_DEF 0
+#define H5O_ACS_REPLICA_ID_ENC H5P__encode_uint64_t
+#define H5O_ACS_REPLICA_ID_DEC H5P__decode_uint64_t
+
#define H5D_XFER_INJECT_CORRUPTION_SIZE sizeof(hbool_t)
#define H5D_XFER_INJECT_CORRUPTION_DEF FALSE
#define H5D_XFER_INJECT_CORRUPTION_ENC H5P__encode_hbool_t
@@ -266,6 +272,7 @@ static const hbool_t H5D_def_inject_corruption_g = H5D_XFER_INJECT_CORRUPTION_DE
static const uint64_t H5D_def_checksum_g = H5D_XFER_CHECKSUM_DEF;
static const uint64_t *H5D_def_checksum_ptr_g = H5D_XFER_CHECKSUM_PTR_DEF;
static const uint32_t H5D_def_checksum_scope_g = H5D_XFER_CHECKSUM_SCOPE_DEF;
+static const hrpl_t H5O_replica_id_g = H5O_ACS_REPLICA_ID_DEF; /* Default replica ID */
#endif /* H5_HAVE_EFF */
/* Property value defaults */
@@ -324,6 +331,12 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass)
#ifdef H5_HAVE_EFF
+ if(H5P_register_real(pclass, H5O_ACS_REPLICA_ID_NAME, H5O_ACS_REPLICA_ID_SIZE,
+ &H5O_replica_id_g,
+ NULL, NULL, NULL, H5O_ACS_REPLICA_ID_ENC, H5O_ACS_REPLICA_ID_DEC,
+ NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
if(H5P_register_real(pclass, H5D_XFER_INJECT_CORRUPTION_NAME, H5D_XFER_INJECT_CORRUPTION_SIZE,
&H5D_def_inject_corruption_g,
NULL, NULL, NULL, H5D_XFER_INJECT_CORRUPTION_ENC, H5D_XFER_INJECT_CORRUPTION_DEC,
diff --git a/src/H5VLiod.c b/src/H5VLiod.c
index 8eea4b2..1067d1c 100644
--- a/src/H5VLiod.c
+++ b/src/H5VLiod.c
@@ -1130,6 +1130,78 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5Pset_read_replica
+ *
+ * Purpose: Set the replica ID to be used when accessing an object
+ * using this transfer plist.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Mohamad Chaarawi
+ * February, 2014
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_read_replica(hid_t dxpl_id, hrpl_t replica_id)
+{
+ H5P_genplist_t *plist = NULL; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "iRp", dxpl_id, replica_id);
+
+ if(dxpl_id == H5P_DEFAULT)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list")
+
+ /* Check arguments */
+ if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER)))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl")
+
+ /* Set the transfer mode */
+ if(H5P_set(plist, H5O_ACS_REPLICA_ID_NAME, &replica_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pset_read_replica() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_read_replica
+ *
+ * Purpose: Retrieve the replica ID from this access plist.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Mohamad Chaarawi
+ * February, 2014
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_read_replica(hid_t dxpl_id, hrpl_t *replica_id/*out*/)
+{
+ H5P_genplist_t *plist = NULL; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "ix", dxpl_id, replica_id);
+
+ if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER)))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl")
+
+ /* Get the transfer mode */
+ if(replica_id)
+ if(H5P_get(plist, H5O_ACS_REPLICA_ID_NAME, replica_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get value")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_read_replica() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Pset_dxpl_checksum
*
* Purpose: Modify the dataset transfer property list to set a
diff --git a/src/H5VLiod.h b/src/H5VLiod.h
index e2d03a7..c136168 100644
--- a/src/H5VLiod.h
+++ b/src/H5VLiod.h
@@ -57,6 +57,8 @@ H5_DLL herr_t EFF_start_server(MPI_Comm comm, MPI_Info info);
H5_DLL herr_t EFF_init(MPI_Comm comm, MPI_Info info);
H5_DLL herr_t EFF_finalize(void);
+H5_DLL herr_t H5Pset_read_replica(hid_t dxpl_id, hrpl_t replica_id);
+H5_DLL herr_t H5Pget_read_replica(hid_t dxpl_id, hrpl_t *replica_id);
H5_DLL herr_t H5Pset_evict_replica(hid_t lapl_id, hrpl_t replica_id);
H5_DLL herr_t H5Pget_evict_replica(hid_t lapl_id, hrpl_t *replica_id);
H5_DLL herr_t H5Pset_ocpl_enable_checksum(hid_t ocpl_id, hbool_t flag);
diff --git a/src/H5VLiod_dset.c b/src/H5VLiod_dset.c
index 4b37995..6b6205d 100644
--- a/src/H5VLiod_dset.c
+++ b/src/H5VLiod_dset.c
@@ -558,11 +558,23 @@ H5VL_iod_server_dset_read_cb(AXE_engine_t axe_engine,
if(!is_vl_data) {
size_t elmt_size;
+ iod_trans_id_t read_tid;
+
+ /* get replica ID from dxpl */
+ if(H5Pget_read_replica(dxpl_id, &read_tid) < 0)
+ HGOTO_ERROR2(H5E_PLIST, H5E_CANTGET, FAIL, "can't get replica ID from dxpl");
+
+ if(read_tid) {
+ fprintf(stderr, "Reading from replica tag %"PRIx64"\n", read_tid);
+ }
+ else {
+ read_tid = rtid;
+ }
/* If the data is not VL, we can read the data from the array the normal way */
elmt_size = H5Tget_size(src_id);
if(H5VL__iod_server_final_io(iod_oh.rd_oh, space_id, elmt_size, FALSE,
- buf, buf_size, (uint64_t)0, raw_cs_scope, rtid) < 0) {
+ buf, buf_size, (uint64_t)0, raw_cs_scope, read_tid) < 0) {
fprintf(stderr, "can't read from array object\n");
ret_value = FAIL;
goto done;
diff --git a/src/H5VLiod_map.c b/src/H5VLiod_map.c
index 7e3aa0b..dc23808 100644
--- a/src/H5VLiod_map.c
+++ b/src/H5VLiod_map.c
@@ -621,6 +621,19 @@ H5VL_iod_server_map_get_cb(AXE_engine_t UNUSED axe_engine,
input->dxpl_id = H5Pcopy(H5P_DATASET_XFER_DEFAULT);
dxpl_id = input->dxpl_id;
+ {
+ iod_trans_id_t read_tid;
+
+ /* get replica ID from dxpl */
+ if(H5Pget_read_replica(dxpl_id, &read_tid) < 0)
+ HGOTO_ERROR2(H5E_PLIST, H5E_CANTGET, FAIL, "can't get replica ID from dxpl");
+
+ if(read_tid) {
+ fprintf(stderr, "Reading from replica tag %"PRIx64"\n", read_tid);
+ rtid = read_tid;
+ }
+ }
+
/* get the scope for data integrity checks for raw data */
if(H5Pget_rawdata_integrity_scope(dxpl_id, &raw_cs_scope) < 0)
HGOTO_ERROR2(H5E_PLIST, H5E_CANTGET, FAIL, "can't get scope for data integrity checks");