summaryrefslogtreecommitdiffstats
path: root/src/H5Fmpi.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Fmpi.c')
-rw-r--r--src/H5Fmpi.c82
1 files changed, 82 insertions, 0 deletions
diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c
index 4fd04f6..0f612be 100644
--- a/src/H5Fmpi.c
+++ b/src/H5Fmpi.c
@@ -38,6 +38,8 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
#include "H5FDmpi.h" /* MPI-based file drivers */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5Iprivate.h" /* IDs */
/****************/
@@ -177,5 +179,85 @@ H5F_mpi_get_size(const H5F_t *f)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_mpi_get_size() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Fset_mpi_atomicity
+ *
+ * Purpose: Sets the atomicity mode
+ *
+ * Return: Success: Non-negative
+ *
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * Feb 14, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag)
+{
+ H5F_t *file;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "iMi", file_id, flag);
+
+ /* Check args */
+ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
+
+ /* Check VFD */
+ if(!IS_H5FD_MPIO(file))
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect VFL driver, must use MPI-I/O driver")
+
+ /* set atomicity value */
+ if (H5FD_set_mpio_atomicity (file->shared->lf, flag) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set atomicity flag")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Fget_mpi_atomicity
+ *
+ * Purpose: Returns the atomicity mode
+ *
+ * Return: Success: Non-negative
+ *
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * Feb 14, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag)
+{
+ H5F_t *file;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "iMi", file_id, flag);
+
+ /* Check args */
+ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
+
+ /* Check VFD */
+ if(!IS_H5FD_MPIO(file))
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect VFL driver, must use MPI-I/O driver")
+
+ /* get atomicity value */
+ if (H5FD_get_mpio_atomicity (file->shared->lf, flag) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get atomicity flag")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+}
#endif /* H5_HAVE_PARALLEL */