summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2017-04-19 22:28:21 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2017-04-20 20:58:34 (GMT)
commit2b936c79e24e292470f135ac50161349077e8f93 (patch)
tree124859369bbbaf6d40061be8e75c4b678fe4b548
parent7037520281fa5cde30a2377f94f7772e96f4f0f6 (diff)
downloadhdf5-2b936c79e24e292470f135ac50161349077e8f93.zip
hdf5-2b936c79e24e292470f135ac50161349077e8f93.tar.gz
hdf5-2b936c79e24e292470f135ac50161349077e8f93.tar.bz2
Added code to disable the evict-on-close feature in
the parallel library.
-rw-r--r--src/H5Pfapl.c21
-rw-r--r--test/cache_image.c8
-rw-r--r--test/evict_on_close.c100
3 files changed, 127 insertions, 2 deletions
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index 0dab539..9e275b8 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -4379,7 +4379,19 @@ H5P_facc_mdc_log_location_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_
*-------------------------------------------------------------------------
*/
herr_t
-H5Pset_evict_on_close(hid_t fapl_id, hbool_t evict_on_close)
+H5Pset_evict_on_close(
+#if defined(H5_HAVE_PARALLEL) && !defined(H5_DEBUG_BUILD)
+ hid_t H5_ATTR_UNUSED fapl_id,
+#else
+ hid_t fapl_id,
+#endif /* H5_HAVE_PARALLEL and !H5_DEBUG_BUILD */
+
+#ifdef H5_HAVE_PARALLEL
+ hbool_t H5_ATTR_UNUSED evict_on_close
+#else
+ hbool_t evict_on_close
+#endif /* H5_HAVE_PARALLEL */
+)
{
H5P_genplist_t *plist; /* property list pointer */
herr_t ret_value = SUCCEED; /* return value */
@@ -4387,6 +4399,7 @@ H5Pset_evict_on_close(hid_t fapl_id, hbool_t evict_on_close)
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ib", fapl_id, evict_on_close);
+
/* Compare the property list's class against the other class */
if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS))
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not a file access plist")
@@ -4395,9 +4408,13 @@ H5Pset_evict_on_close(hid_t fapl_id, hbool_t evict_on_close)
if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
- /* Set values */
+#ifndef H5_HAVE_PARALLEL
+ /* Set value */
if(H5P_set(plist, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, &evict_on_close) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set evict on close property")
+#else
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "evict on close is currently not supported in parallel HDF5")
+#endif /* H5_HAVE_PARALLEL */
done:
FUNC_LEAVE_API(ret_value)
diff --git a/test/cache_image.c b/test/cache_image.c
index c3adf5c..c8f1e82 100644
--- a/test/cache_image.c
+++ b/test/cache_image.c
@@ -60,7 +60,10 @@ static unsigned cache_image_api_error_check_3(void);
static unsigned cache_image_api_error_check_4(void);
static unsigned get_free_sections_test(void);
+
+#ifndef H5_HAVE_PARALLEL
static unsigned evict_on_close_test(void);
+#endif /* H5_HAVE_PARALLEL */
/****************************************************************************/
@@ -7709,6 +7712,7 @@ get_free_sections_test(void)
*
*-------------------------------------------------------------------------
*/
+#ifndef H5_HAVE_PARALLEL
static unsigned
evict_on_close_test(void)
{
@@ -8013,6 +8017,7 @@ evict_on_close_test(void)
return !pass;
} /* evict_on_close_test() */
+#endif /* H5_HAVE_PARALLEL */
/*-------------------------------------------------------------------------
@@ -8064,7 +8069,10 @@ main(void)
nerrs += cache_image_api_error_check_4();
nerrs += get_free_sections_test();
+
+#ifndef H5_HAVE_PARALLEL
nerrs += evict_on_close_test();
+#endif /* H5_HAVE_PARALLEL */
return(nerrs > 0);
diff --git a/test/evict_on_close.c b/test/evict_on_close.c
index b4ef246..91784da 100644
--- a/test/evict_on_close.c
+++ b/test/evict_on_close.c
@@ -37,6 +37,12 @@
#include "H5Gpkg.h"
#include "H5Ipkg.h"
+/* Evict on close is not supported under parallel at this time.
+ * In the meantime, we just run a simple check that EoC can't be
+ * enabled in parallel HDF5.
+ */
+#ifndef H5_HAVE_PARALLEL
+
/* Uncomment to manually inspect cache states */
/* (Requires debug build of the library) */
/* #define EOC_MANUAL_INSPECTION */
@@ -800,6 +806,7 @@ error:
} /* check_dset_scheme() */
+
/*-------------------------------------------------------------------------
* Function: check_evict_on_close_api()
@@ -990,3 +997,96 @@ error:
} /* end main() */
+#else
+
+
+/*-------------------------------------------------------------------------
+ * Function: check_evict_on_close_parallel_fail()
+ *
+ * Purpose: Verify that the H5Pset_evict_on_close() call fails in
+ * parallel HDF5.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Spring 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+check_evict_on_close_parallel_fail(void)
+{
+ hid_t fapl_id = -1;
+ hbool_t evict_on_close;
+ herr_t status;
+
+ TESTING("evict on close fails in parallel");
+
+ /* Create a fapl */
+ if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
+
+ /* Set the evict on close property (should fail)*/
+ evict_on_close = TRUE;
+ H5E_BEGIN_TRY {
+ status = H5Pset_evict_on_close(fapl_id, evict_on_close);
+ } H5E_END_TRY;
+ if(status >= 0)
+ FAIL_PUTS_ERROR("H5Pset_evict_on_close() did not fail in parallel HDF5.");
+
+ /* close fapl */
+ if(H5Pclose(fapl_id) < 0)
+ TEST_ERROR;
+
+ PASSED();
+ return SUCCEED;
+
+error:
+ H5_FAILED();
+ return FAIL;
+
+} /* check_evict_on_close_parallel_fail() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: main (parallel version)
+ *
+ * Return: EXIT_FAILURE/EXIT_SUCCESS
+ *
+ * Programmer: Dana Robinson
+ * Spring 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main(void)
+{
+ unsigned nerrors = 0; /* number of test errors */
+
+ HDprintf("Testing evict-on-close cache behavior\n");
+
+ /* Initialize */
+ h5_reset();
+
+ /* Test that EoC fails in parallel HDF5 */
+ nerrors += check_evict_on_close_parallel_fail() < 0 ? 1 : 0;
+
+ if(nerrors)
+ goto error;
+
+ HDprintf("All evict-on-close tests passed.\n");
+ HDprintf("Note that EoC is not supported under parallel so most tests are skipped.\n");
+
+ return EXIT_SUCCESS;
+
+error:
+
+ HDprintf("***** %u evict-on-close test%s FAILED! *****\n",
+ nerrors, nerrors > 1 ? "S" : "");
+
+ return EXIT_FAILURE;
+
+} /* main() - parallel */
+
+#endif /* H5_HAVE_PARALLEL */
+