summaryrefslogtreecommitdiffstats
path: root/src/H5FDmpio.c
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2012-03-21 21:00:48 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2012-03-21 21:00:48 (GMT)
commitdd1b2c3208ecb4969ad854a65e2261bced518698 (patch)
treefcbf369b09c49439974678efbe12e2bf290ce8cb /src/H5FDmpio.c
parentd476ce138bbb78d3f7bf22a21172724f6519a1cf (diff)
downloadhdf5-dd1b2c3208ecb4969ad854a65e2261bced518698.zip
hdf5-dd1b2c3208ecb4969ad854a65e2261bced518698.tar.gz
hdf5-dd1b2c3208ecb4969ad854a65e2261bced518698.tar.bz2
[svn-r22115] Add 2 new API routines to set/unset file atomicity for files opened with the MPI-IO VFD
Add test cases for these two routines Jira issue HDFFV-7961
Diffstat (limited to 'src/H5FDmpio.c')
-rw-r--r--src/H5FDmpio.c94
1 files changed, 94 insertions, 0 deletions
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index d780ceb..6dbe831 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -876,6 +876,100 @@ fprintf(stderr, "leaving H5FD_mpio_fapl_free\n");
/*-------------------------------------------------------------------------
+ * Function: H5FD_set_mpio_atomicity
+ *
+ * Purpose: Sets the atomicity mode
+ *
+ * Return: Success: Non-negative
+ *
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * Feb 14, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5FD_set_mpio_atomicity(H5FD_t *_file, hbool_t flag)
+{
+ H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
+ int mpi_code; /* MPI return code */
+ int temp_flag;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#ifdef H5FDmpio_DEBUG
+ if (H5FD_mpio_Debug[(int)'t'])
+ fprintf(stdout, "Entering H5FD_set_mpio_atomicity\n");
+#endif
+
+ if (FALSE == flag)
+ temp_flag = 0;
+ else
+ temp_flag = 1;
+
+ /* set atomicity value */
+ if (MPI_SUCCESS != (mpi_code=MPI_File_set_atomicity(file->f, temp_flag)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_File_set_atomicity", mpi_code)
+
+done:
+#ifdef H5FDmpio_DEBUG
+ if (H5FD_mpio_Debug[(int)'t'])
+ fprintf(stdout, "Leaving H5FD_set_mpio_atomicity\n");
+#endif
+ FUNC_LEAVE_NOAPI(ret_value)
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD_get_mpio_atomicity
+ *
+ * Purpose: Returns the atomicity mode
+ *
+ * Return: Success: Non-negative
+ *
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * Feb 14, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5FD_get_mpio_atomicity(H5FD_t *_file, hbool_t *flag)
+{
+ H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
+ int mpi_code; /* MPI return code */
+ int temp_flag;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#ifdef H5FDmpio_DEBUG
+ if (H5FD_mpio_Debug[(int)'t'])
+ fprintf(stdout, "Entering H5FD_get_mpio_atomicity\n");
+#endif
+
+ /* get atomicity value */
+ if (MPI_SUCCESS != (mpi_code=MPI_File_get_atomicity(file->f, &temp_flag)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_File_get_atomicity", mpi_code)
+
+ if (0 != temp_flag)
+ *flag = TRUE;
+ else
+ *flag = FALSE;
+
+done:
+#ifdef H5FDmpio_DEBUG
+ if (H5FD_mpio_Debug[(int)'t'])
+ fprintf(stdout, "Leaving H5FD_get_mpio_atomicity\n");
+#endif
+ FUNC_LEAVE_NOAPI(ret_value)
+}
+
+
+/*-------------------------------------------------------------------------
* Function: H5FD_mpio_open
*
* Purpose: Opens a file with name NAME. The FLAGS are a bit field with