summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-06-10 19:05:06 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-06-10 19:05:06 (GMT)
commit204b89902904a59f4e14e788bcca065e2c358f0b (patch)
tree7d44f63b311a95ba467ddb94f1a2f996b35a56a5
parent6ea525228102ecc40e9c5a0fa16c9427366d8b75 (diff)
downloadhdf5-204b89902904a59f4e14e788bcca065e2c358f0b.zip
hdf5-204b89902904a59f4e14e788bcca065e2c358f0b.tar.gz
hdf5-204b89902904a59f4e14e788bcca065e2c358f0b.tar.bz2
[svn-r7019] Purpose:
Compatibility fix Description: The H5P[set|get]_fapl_mpiposix calls changed between v1.4.x and v1.5.x. Solution: Wrap them in the v1.4 backward compatibility #ifdefs and update tests, etc. Platforms tested: FreeBSD 4.8 (sleipnir) w/paralle & v1.4 compatibility h5committest pointless
-rw-r--r--perform/pio_engine.c4
-rw-r--r--src/H5FDmpiposix.c119
-rw-r--r--src/H5FDmpiposix.h5
-rw-r--r--testpar/t_ph5basic.c18
-rw-r--r--testpar/testphdf5.c4
5 files changed, 150 insertions, 0 deletions
diff --git a/perform/pio_engine.c b/perform/pio_engine.c
index b78dfd7..88a90e5 100644
--- a/perform/pio_engine.c
+++ b/perform/pio_engine.c
@@ -1524,7 +1524,11 @@ do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags)
/* Use the appropriate VFL driver */
if(param->h5_use_mpi_posix) {
/* Set the file driver to the MPI-posix driver */
+#ifdef H5_WANT_H5_V1_4_COMPAT
+ hrc = H5Pset_fapl_mpiposix(acc_tpl, pio_comm_g);
+#else /* H5_WANT_H5_V1_4_COMPAT */
hrc = H5Pset_fapl_mpiposix(acc_tpl, pio_comm_g, use_gpfs);
+#endif /* H5_WANT_H5_V1_4_COMPAT */
if (hrc < 0) {
fprintf(stderr, "HDF5 Property List Set failed\n");
GOTOERROR(FAIL);
diff --git a/src/H5FDmpiposix.c b/src/H5FDmpiposix.c
index eda1657..65f4ec1 100644
--- a/src/H5FDmpiposix.c
+++ b/src/H5FDmpiposix.c
@@ -274,6 +274,124 @@ done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5FD_mpiposix_init() */
+#ifdef H5_WANT_H5_V1_4_COMPAT
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_fapl_mpiposix
+ *
+ * Purpose: Store the user supplied MPI communicator COMM in
+ * the file access property list FAPL_ID which can then be used
+ * to create and/or open the file. This function is available
+ * only in the parallel HDF5 library and is not collective.
+ *
+ * comm is the MPI communicator to be used for file open as
+ * defined in MPI_FILE_OPEN of MPI-2. This function makes a
+ * duplicate of comm. Any modification to comm after this function
+ * call returns has no effect on the access property list.
+ *
+ * If fapl_id has previously set comm value, it will be replaced
+ * and the old communicator is freed.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, July 11, 2002
+ *
+ * Modifications:
+ * Albert Cheng, 2003-04-24
+ * Modified the description of the function that it now stores
+ * a duplicate of the communicator. Free the old duplicate if
+ * previously set. (Work is actually done by H5P_set_driver.)
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_fapl_mpiposix(hid_t fapl_id, MPI_Comm comm)
+{
+ H5FD_mpiposix_fapl_t fa;
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value;
+
+ FUNC_ENTER_API(H5Pset_fapl_mpiposix, FAIL);
+ H5TRACE2("e","iMc",fapl_id,comm);
+
+ /* Check arguments */
+ if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list");
+ if (MPI_COMM_NULL == comm)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a valid communicator");
+
+ /* Initialize driver specific properties */
+ fa.comm = comm;
+ fa.use_gpfs = FALSE;
+
+ /* duplication is done during driver setting. */
+ ret_value= H5P_set_driver(plist, H5FD_MPIPOSIX, &fa);
+
+done:
+ FUNC_LEAVE_API(ret_value);
+} /* end H5Pset_fapl_mpiposix() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_fapl_mpiposix
+ *
+ * Purpose: If the file access property list is set to the H5FD_MPIPOSIX
+ * driver then this function returns a duplicate of the MPI
+ * communicator through the comm pointer. It is the responsibility
+ * of the application to free the returned communicator.
+ *
+ * Return: Success: Non-negative with the communicator and
+ * information returned through the COMM
+ * argument if non-null. Since it is a duplicate
+ * of the stored object, future modifications to
+ * the access property list do not affect it and
+ * it is the responsibility of the application to
+ * free it.
+ *
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, July 11, 2002
+ *
+ * Modifications:
+ * Albert Cheng, 2003-04-24
+ * Return duplicate of the stored communicator.
+ *
+ * Bill Wendling, 2003-05-01
+ * Return the USE_GPFS flag.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_fapl_mpiposix(hid_t fapl_id, MPI_Comm *comm/*out*/)
+{
+ H5FD_mpiposix_fapl_t *fa;
+ H5P_genplist_t *plist; /* Property list pointer */
+ int mpi_code; /* mpi return code */
+ herr_t ret_value=SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Pget_fapl_mpiposix, FAIL);
+ H5TRACE2("e","ix",fapl_id,comm);
+
+ if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list");
+ if (H5FD_MPIPOSIX!=H5P_get_driver(plist))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver");
+ if (NULL==(fa=H5P_get_driver_info(plist)))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info");
+
+ /* Get MPI Communicator */
+ if (comm){
+ if (MPI_SUCCESS != (mpi_code=MPI_Comm_dup(fa->comm, comm)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code);
+ }
+
+done:
+ FUNC_LEAVE_API(ret_value);
+} /* end H5Pget_fapl_mpiposix() */
+#else /* H5_WANT_H5_V1_4_COMPAT */
/*-------------------------------------------------------------------------
* Function: H5Pset_fapl_mpiposix
@@ -397,6 +515,7 @@ H5Pget_fapl_mpiposix(hid_t fapl_id, MPI_Comm *comm/*out*/, hbool_t *use_gpfs/*ou
done:
FUNC_LEAVE_API(ret_value);
} /* end H5Pget_fapl_mpiposix() */
+#endif /* H5_WANT_H5_V1_4_COMPAT */
/*-------------------------------------------------------------------------
diff --git a/src/H5FDmpiposix.h b/src/H5FDmpiposix.h
index cae9370..b4614c7 100644
--- a/src/H5FDmpiposix.h
+++ b/src/H5FDmpiposix.h
@@ -44,8 +44,13 @@ extern "C" {
#endif
H5_DLL hid_t H5FD_mpiposix_init(void);
+#ifdef H5_WANT_H5_V1_4_COMPAT
+H5_DLL herr_t H5Pset_fapl_mpiposix(hid_t fapl_id, MPI_Comm comm);
+H5_DLL herr_t H5Pget_fapl_mpiposix(hid_t fapl_id, MPI_Comm *comm/*out*/);
+#else /* H5_WANT_H5_V1_4_COMPAT */
H5_DLL herr_t H5Pset_fapl_mpiposix(hid_t fapl_id, MPI_Comm comm, hbool_t use_gpfs);
H5_DLL herr_t H5Pget_fapl_mpiposix(hid_t fapl_id, MPI_Comm *comm/*out*/, hbool_t *use_gpfs/*out*/);
+#endif /* H5_WANT_H5_V1_4_COMPAT */
H5_DLL MPI_Comm H5FD_mpiposix_communicator(H5FD_t *_file);
H5_DLL herr_t H5FD_mpiposix_closing(H5FD_t *file);
H5_DLL int H5FD_mpiposix_mpi_rank(H5FD_t *_file);
diff --git a/testpar/t_ph5basic.c b/testpar/t_ph5basic.c
index eb0048b..92c4e61 100644
--- a/testpar/t_ph5basic.c
+++ b/testpar/t_ph5basic.c
@@ -219,7 +219,9 @@ test_fapl_mpiposix_dup(void)
int mpi_size_tmp, mpi_rank_tmp;
int mrc; /* MPI return value */
hid_t acc_pl; /* File access properties */
+#ifndef H5_WANT_H5_V1_4_COMPAT
hbool_t use_gpfs = FALSE;
+#endif /* H5_WANT_H5_V1_4_COMPAT */
herr_t ret; /* hdf5 return value */
if (verbose)
@@ -244,7 +246,11 @@ test_fapl_mpiposix_dup(void)
acc_pl = H5Pcreate (H5P_FILE_ACCESS);
VRFY((acc_pl >= 0), "H5P_FILE_ACCESS");
+#ifdef H5_WANT_H5_V1_4_COMPAT
+ ret = H5Pset_fapl_mpiposix(acc_pl, comm);
+#else /* H5_WANT_H5_V1_4_COMPAT */
ret = H5Pset_fapl_mpiposix(acc_pl, comm, use_gpfs);
+#endif /* H5_WANT_H5_V1_4_COMPAT */
VRFY((ret >= 0), "");
/* Case 1:
@@ -255,7 +261,11 @@ test_fapl_mpiposix_dup(void)
mrc = MPI_Comm_free(&comm);
VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free");
+#ifdef H5_WANT_H5_V1_4_COMPAT
+ ret = H5Pget_fapl_mpiposix(acc_pl, &comm_tmp);
+#else /* H5_WANT_H5_V1_4_COMPAT */
ret = H5Pget_fapl_mpiposix(acc_pl, &comm_tmp, &use_gpfs);
+#endif /* H5_WANT_H5_V1_4_COMPAT */
VRFY((ret >= 0), "H5Pget_fapl_mpiposix");
MPI_Comm_size(comm_tmp,&mpi_size_tmp);
MPI_Comm_rank(comm_tmp,&mpi_rank_tmp);
@@ -275,12 +285,20 @@ test_fapl_mpiposix_dup(void)
VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free");
/* check NULL argument options. */
+#ifdef H5_WANT_H5_V1_4_COMPAT
+ ret = H5Pget_fapl_mpiposix(acc_pl, NULL);
+#else /* H5_WANT_H5_V1_4_COMPAT */
ret = H5Pget_fapl_mpiposix(acc_pl, NULL, NULL);
+#endif /* H5_WANT_H5_V1_4_COMPAT */
VRFY((ret >= 0), "H5Pget_fapl_mpiposix neither");
/* now get it again and check validity too. */
/* Don't free the returned object which is used in the next case. */
+#ifdef H5_WANT_H5_V1_4_COMPAT
+ ret = H5Pget_fapl_mpiposix(acc_pl, &comm_tmp);
+#else /* H5_WANT_H5_V1_4_COMPAT */
ret = H5Pget_fapl_mpiposix(acc_pl, &comm_tmp, &use_gpfs);
+#endif /* H5_WANT_H5_V1_4_COMPAT */
VRFY((ret >= 0), "H5Pget_fapl_mpiposix");
MPI_Comm_size(comm_tmp,&mpi_size_tmp);
MPI_Comm_rank(comm_tmp,&mpi_rank_tmp);
diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c
index 6a4a0b2..7ab3984 100644
--- a/testpar/testphdf5.c
+++ b/testpar/testphdf5.c
@@ -317,7 +317,11 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type,
if (l_facc_type == FACC_MPIPOSIX) {
/* set Parallel access with communicator */
+#ifdef H5_WANT_H5_V1_4_COMPAT
+ ret = H5Pset_fapl_mpiposix(ret_pl, comm);
+#else /* H5_WANT_H5_V1_4_COMPAT */
ret = H5Pset_fapl_mpiposix(ret_pl, comm, use_gpfs);
+#endif /* H5_WANT_H5_V1_4_COMPAT */
VRFY((ret >= 0), "H5Pset_fapl_mpiposix succeeded");
return(ret_pl);
}