summaryrefslogtreecommitdiffstats
path: root/src/H5Z.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Z.c')
-rw-r--r--src/H5Z.c160
1 files changed, 72 insertions, 88 deletions
diff --git a/src/H5Z.c b/src/H5Z.c
index ea92a01..763eac2 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -56,9 +56,6 @@ typedef enum {
H5Z_PRELUDE_SET_LOCAL /* Call "set local" callback */
} H5Z_prelude_type_t;
-/* Package initialization variable */
-hbool_t H5_PKG_INIT_VAR = FALSE;
-
/* Local variables */
static size_t H5Z_table_alloc_g = 0;
static size_t H5Z_table_used_g = 0;
@@ -74,19 +71,23 @@ static int H5Z__check_unregister_group_cb(void *obj_ptr, hid_t obj_id, void *key
static int H5Z__flush_file_cb(void *obj_ptr, hid_t obj_id, void *key);
/*-------------------------------------------------------------------------
- * Function: H5Z__init_package
+ * Function: H5Z_init
*
- * Purpose: Initializes the data filter layer.
+ * Purpose: Initialize the interface from some other layer.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Success: non-negative
+ * Failure: negative
*-------------------------------------------------------------------------
*/
herr_t
-H5Z__init_package(void)
+H5Z_init(void)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_NOAPI(FAIL)
+
+ if (H5_TERM_GLOBAL)
+ HGOTO_DONE(SUCCEED)
/* Internal filters */
if (H5Z_register(H5Z_SHUFFLE) < 0)
@@ -111,7 +112,7 @@ H5Z__init_package(void)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5Z__init_package() */
+}
/*-------------------------------------------------------------------------
* Function: H5Z_term_package
@@ -128,76 +129,70 @@ H5Z_term_package(void)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- if (H5_PKG_INIT_VAR) {
#ifdef H5Z_DEBUG
- char comment[16], bandwidth[32];
- int dir, nprint = 0;
- size_t i;
-
- if (H5DEBUG(Z)) {
- for (i = 0; i < H5Z_table_used_g; i++) {
- for (dir = 0; dir < 2; dir++) {
- struct {
- char *user;
- char *system;
- char *elapsed;
- } timestrs = {H5_timer_get_time_string(H5Z_stat_table_g[i].stats[dir].times.user),
- H5_timer_get_time_string(H5Z_stat_table_g[i].stats[dir].times.system),
- H5_timer_get_time_string(H5Z_stat_table_g[i].stats[dir].times.elapsed)};
- if (0 == H5Z_stat_table_g[i].stats[dir].total)
- goto next;
-
- if (0 == nprint++) {
- /* Print column headers */
- HDfprintf(H5DEBUG(Z), "H5Z: filter statistics "
- "accumulated over life of library:\n");
- HDfprintf(H5DEBUG(Z), " %-16s %10s %10s %8s %8s %8s %10s\n", "Filter", "Total",
- "Errors", "User", "System", "Elapsed", "Bandwidth");
- HDfprintf(H5DEBUG(Z), " %-16s %10s %10s %8s %8s %8s %10s\n", "------", "-----",
- "------", "----", "------", "-------", "---------");
- } /* end if */
+ char comment[16], bandwidth[32];
+ int dir, nprint = 0;
+ size_t i;
- /* Truncate the comment to fit in the field */
- HDstrncpy(comment, H5Z_table_g[i].name, sizeof comment);
- comment[sizeof(comment) - 1] = '\0';
-
- /*
- * Format bandwidth to have four significant digits and
- * units of `B/s', `kB/s', `MB/s', `GB/s', or `TB/s' or
- * the word `Inf' if the elapsed time is zero.
- */
- H5_bandwidth(bandwidth, (double)(H5Z_stat_table_g[i].stats[dir].total),
- H5Z_stat_table_g[i].stats[dir].times.elapsed);
-
- /* Print the statistics */
- HDfprintf(H5DEBUG(Z), " %s%-15s %10" PRIdHSIZE " %10" PRIdHSIZE " %8s %8s %8s %10s\n",
- (dir ? "<" : ">"), comment, H5Z_stat_table_g[i].stats[dir].total,
- H5Z_stat_table_g[i].stats[dir].errors, timestrs.user, timestrs.system,
- timestrs.elapsed, bandwidth);
+ if (H5DEBUG(Z)) {
+ for (i = 0; i < H5Z_table_used_g; i++) {
+ for (dir = 0; dir < 2; dir++) {
+ struct {
+ char *user;
+ char *system;
+ char *elapsed;
+ } timestrs = {H5_timer_get_time_string(H5Z_stat_table_g[i].stats[dir].times.user),
+ H5_timer_get_time_string(H5Z_stat_table_g[i].stats[dir].times.system),
+ H5_timer_get_time_string(H5Z_stat_table_g[i].stats[dir].times.elapsed)};
+ if (0 == H5Z_stat_table_g[i].stats[dir].total)
+ goto next;
+
+ if (0 == nprint++) {
+ /* Print column headers */
+ HDfprintf(H5DEBUG(Z), "H5Z: filter statistics "
+ "accumulated over life of library:\n");
+ HDfprintf(H5DEBUG(Z), " %-16s %10s %10s %8s %8s %8s %10s\n", "Filter", "Total",
+ "Errors", "User", "System", "Elapsed", "Bandwidth");
+ HDfprintf(H5DEBUG(Z), " %-16s %10s %10s %8s %8s %8s %10s\n", "------", "-----",
+ "------", "----", "------", "-------", "---------");
+ } /* end if */
+
+ /* Truncate the comment to fit in the field */
+ HDstrncpy(comment, H5Z_table_g[i].name, sizeof comment);
+ comment[sizeof(comment) - 1] = '\0';
+
+ /*
+ * Format bandwidth to have four significant digits and
+ * units of `B/s', `kB/s', `MB/s', `GB/s', or `TB/s' or
+ * the word `Inf' if the elapsed time is zero.
+ */
+ H5_bandwidth(bandwidth, (double)(H5Z_stat_table_g[i].stats[dir].total),
+ H5Z_stat_table_g[i].stats[dir].times.elapsed);
+
+ /* Print the statistics */
+ HDfprintf(H5DEBUG(Z), " %s%-15s %10" PRIdHSIZE " %10" PRIdHSIZE " %8s %8s %8s %10s\n",
+ (dir ? "<" : ">"), comment, H5Z_stat_table_g[i].stats[dir].total,
+ H5Z_stat_table_g[i].stats[dir].errors, timestrs.user, timestrs.system,
+ timestrs.elapsed, bandwidth);
next:
- HDfree(timestrs.user);
- HDfree(timestrs.system);
- HDfree(timestrs.elapsed);
- } /* end for */
- } /* end for */
- } /* end if */
-#endif /* H5Z_DEBUG */
-
- /* Free the table of filters */
- if (H5Z_table_g) {
- H5Z_table_g = (H5Z_class2_t *)H5MM_xfree(H5Z_table_g);
+ HDfree(timestrs.user);
+ HDfree(timestrs.system);
+ HDfree(timestrs.elapsed);
+ } /* end for */
+ } /* end for */
+ } /* end if */
+#endif /* H5Z_DEBUG */
+
+ /* Free the table of filters */
+ if (H5Z_table_g) {
+ H5Z_table_g = (H5Z_class2_t *)H5MM_xfree(H5Z_table_g);
#ifdef H5Z_DEBUG
- H5Z_stat_table_g = (H5Z_stats_t *)H5MM_xfree(H5Z_stat_table_g);
+ H5Z_stat_table_g = (H5Z_stats_t *)H5MM_xfree(H5Z_stat_table_g);
#endif /* H5Z_DEBUG */
- H5Z_table_used_g = H5Z_table_alloc_g = 0;
+ H5Z_table_used_g = H5Z_table_alloc_g = 0;
- n++;
- } /* end if */
-
- /* Mark interface as closed */
- if (0 == n)
- H5_PKG_INIT_VAR = FALSE;
+ n++;
} /* end if */
FUNC_LEAVE_NOAPI(n)
@@ -599,14 +594,9 @@ H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void H5_ATTR_PARA
/* Do a global flush if the file is opened for write */
if (H5F_ACC_RDWR & H5F_INTENT(f)) {
-/* When parallel HDF5 is defined, check for collective metadata reads on this
- * file and set the flag for metadata I/O in the API context. -QAK, 2018/02/14
- */
#ifdef H5_HAVE_PARALLEL
/* Check if MPIO driver is used */
if (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
- H5P_coll_md_read_flag_t coll_md_read; /* Do all metadata reads collectively */
-
/* Sanity check for collectively calling H5Zunregister, if requested */
/* (Sanity check assumes that a barrier on one file's comm
* is sufficient (i.e. that there aren't different comms for
@@ -626,13 +616,8 @@ H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void H5_ATTR_PARA
/* Set the "sanity checked" flag */
object->sanity_checked = TRUE;
} /* end if */
-
- /* Check whether to use the collective metadata read DXPL */
- coll_md_read = H5F_COLL_MD_READ(f);
- if (H5P_USER_TRUE == coll_md_read)
- H5CX_set_coll_metadata_read(TRUE);
- } /* end if */
-#endif /* H5_HAVE_PARALLEL */
+ } /* end if */
+#endif /* H5_HAVE_PARALLEL */
/* Call the flush routine for mounted file hierarchies */
if (H5F_flush_mounts((H5F_t *)obj_ptr) < 0)
@@ -1506,7 +1491,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Z_filter_in_pline
*
- * Purpose: Check wheter a filter is in the filter pipeline using the
+ * Purpose: Check whether a filter is in the filter pipeline using the
* filter ID. This function is very similar to H5Z_filter_info
*
* Return: TRUE - found filter
@@ -1520,7 +1505,7 @@ H5Z_filter_in_pline(const H5O_pline_t *pline, H5Z_filter_t filter)
size_t idx; /* Index of filter in pipeline */
htri_t ret_value = TRUE; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI_NOERR
HDassert(pline);
HDassert(filter >= 0 && filter <= H5Z_FILTER_MAX);
@@ -1534,7 +1519,6 @@ H5Z_filter_in_pline(const H5O_pline_t *pline, H5Z_filter_t filter)
if (idx >= pline->nused)
ret_value = FALSE;
-done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z_filter_in_pline() */
@@ -1554,7 +1538,7 @@ H5Z_all_filters_avail(const H5O_pline_t *pline)
size_t i, j; /* Local index variable */
htri_t ret_value = TRUE; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI_NOERR
/* Check args */
HDassert(pline);