diff options
-rw-r--r-- | src/H5Clog_json.c | 2 | ||||
-rw-r--r-- | src/H5Clog_trace.c | 2 | ||||
-rw-r--r-- | src/H5Cmpio.c | 111 | ||||
-rw-r--r-- | src/H5FDmpi.c | 37 | ||||
-rw-r--r-- | src/H5FDmpio.c | 430 | ||||
-rw-r--r-- | src/H5FDprivate.h | 28 | ||||
-rw-r--r-- | src/H5Fmpi.c | 62 | ||||
-rw-r--r-- | src/H5Fprivate.h | 2 | ||||
-rw-r--r-- | src/H5Pfapl.c | 273 | ||||
-rw-r--r-- | src/H5mpi.c | 30 | ||||
-rw-r--r-- | src/H5public.h | 1 |
11 files changed, 413 insertions, 565 deletions
diff --git a/src/H5Clog_json.c b/src/H5Clog_json.c index 6d048f1..731d741 100644 --- a/src/H5Clog_json.c +++ b/src/H5Clog_json.c @@ -173,7 +173,7 @@ H5C__json_write_log_message(H5C_log_json_udata_t *json_udata) /* Write the log message and flush */ n_chars = HDstrlen(json_udata->message); - if ((int)n_chars != HDfprintf(json_udata->outfile, json_udata->message)) + if ((int)n_chars != HDfprintf(json_udata->outfile, "%s", json_udata->message)) HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "error writing log message") HDmemset((void *)(json_udata->message), 0, (size_t)(n_chars * sizeof(char))); diff --git a/src/H5Clog_trace.c b/src/H5Clog_trace.c index 8c79d7b..c30f79e 100644 --- a/src/H5Clog_trace.c +++ b/src/H5Clog_trace.c @@ -168,7 +168,7 @@ H5C__trace_write_log_message(H5C_log_trace_udata_t *trace_udata) /* Write the log message and flush */ n_chars = HDstrlen(trace_udata->message); - if ((int)n_chars != HDfprintf(trace_udata->outfile, trace_udata->message)) + if ((int)n_chars != HDfprintf(trace_udata->outfile, "%s", trace_udata->message)) HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "error writing log message") HDmemset((void *)(trace_udata->message), 0, (size_t)(n_chars * sizeof(char))); diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c index d26c508..12dde12 100644 --- a/src/H5Cmpio.c +++ b/src/H5Cmpio.c @@ -105,9 +105,9 @@ static herr_t H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring, unsigned * * We construct the table as follows. Let: * - * n = num_candidates / mpi_size; + * n = num_candidates / mpi_size; * - * m = num_candidates % mpi_size; + * m = num_candidates % mpi_size; * * Now allocate an array of integers of length mpi_size + 1, * and call this array candidate_assignment_table. @@ -127,10 +127,10 @@ static herr_t H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring, unsigned * Once the table is constructed, we determine the first and * last entry this process is to flush as follows: * - * first_entry_to_flush = candidate_assignment_table[mpi_rank] + * first_entry_to_flush = candidate_assignment_table[mpi_rank] * * last_entry_to_flush = - * candidate_assignment_table[mpi_rank + 1] - 1; + * candidate_assignment_table[mpi_rank + 1] - 1; * * With these values determined, we simply scan through the * candidate list, marking all entries in the range @@ -737,7 +737,7 @@ H5C_mark_entries_as_clean(H5F_t *f, unsigned ce_array_len, haddr_t *ce_array_ptr * of the pre_serialize / serialize routines, this may * cease to be the case -- requiring a review of this * point. - * JRM -- 4/7/15 + * JRM -- 4/7/15 */ entries_cleared = 0; entries_examined = 0; @@ -885,15 +885,16 @@ H5C__collective_write(H5F_t *f) { H5AC_t * cache_ptr; H5FD_mpio_xfer_t orig_xfer_mode = H5FD_MPIO_COLLECTIVE; + void * base_buf; int count; int * length_array = NULL; MPI_Aint * buf_array = NULL; MPI_Aint * offset_array = NULL; - MPI_Datatype btype; - hbool_t btype_created = FALSE; - MPI_Datatype ftype; - hbool_t ftype_created = FALSE; + MPI_Datatype btype = MPI_BYTE; + MPI_Datatype ftype = MPI_BYTE; int mpi_code; + char unused = 0; /* Unused, except for non-NULL pointer value */ + size_t buf_count; herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC @@ -908,20 +909,17 @@ H5C__collective_write(H5F_t *f) if (H5CX_get_io_xfer_mode(&orig_xfer_mode) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode") + /* Set transfer mode */ + if (H5CX_set_io_xfer_mode(H5FD_MPIO_COLLECTIVE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set MPI-I/O transfer mode") + /* Get number of entries in collective write list */ count = (int)H5SL_count(cache_ptr->coll_write_list); - if (count > 0) { - H5FD_mpio_xfer_t xfer_mode = H5FD_MPIO_COLLECTIVE; H5SL_node_t * node; H5C_cache_entry_t *entry_ptr; - void * base_buf; int i; - /* Set new transfer mode */ - if (H5CX_set_io_xfer_mode(xfer_mode) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set MPI-I/O transfer mode") - /* Allocate arrays */ if (NULL == (length_array = (int *)H5MM_malloc((size_t)count * sizeof(int)))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, @@ -948,7 +946,6 @@ H5C__collective_write(H5F_t *f) node = H5SL_next(node); i = 1; while (node) { - if (NULL == (entry_ptr = (H5C_cache_entry_t *)H5SL_item(node))) HGOTO_ERROR(H5E_CACHE, H5E_NOTFOUND, FAIL, "can't retrieve skip list item") @@ -966,9 +963,6 @@ H5C__collective_write(H5F_t *f) if (MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed(count, length_array, buf_array, MPI_BYTE, &btype))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code) - - btype_created = TRUE; - if (MPI_SUCCESS != (mpi_code = MPI_Type_commit(&btype))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) @@ -976,74 +970,27 @@ H5C__collective_write(H5F_t *f) if (MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed(count, length_array, offset_array, MPI_BYTE, &ftype))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code) - - ftype_created = TRUE; - if (MPI_SUCCESS != (mpi_code = MPI_Type_commit(&ftype))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) - /* Pass buf type, file type to the file driver */ - if (H5CX_set_mpi_coll_datatypes(btype, ftype) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set MPI-I/O properties") - - /* Write data */ - /* - * At present the page buffer is disabled in the parallel case, and - * thus VFD SWMR can't be used either. Thus, for now, there is - * no point in setting the page buffer hints. - * - * More to the point, since we are actually writing a derived type - * containing multiple metadata cache entries, we couldn't set it - * to a meaningful value. - * - * When we enable the page buffer in parallel, we will have to - * revisit this. - * JRM -- 3/30/20 - */ - if (H5F_block_write(f, H5FD_MEM_DEFAULT, (haddr_t)0, (size_t)1, base_buf) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to write entries collectively") - + /* MPI count to write */ + buf_count = 1; } /* end if */ else { - MPI_Status mpi_stat; - MPI_File * mpi_fh_p; - MPI_File mpi_fh; - MPI_Info * info_p; - MPI_Info info; - - /* This should be rewritten to call H5F_block_write, with the correct - * buffer and file datatypes (null ones). -QAK, 2018/02/21 - */ - if (H5F_get_mpi_handle(f, (MPI_File **)&mpi_fh_p) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't get mpi file handle") + /* Set non-NULL pointer for I/O operation */ + base_buf = &unused; - mpi_fh = *(MPI_File *)mpi_fh_p; - - if (H5F_get_mpi_info(f, &info_p) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get mpi file info") - - info = *info_p; - - /* just to match up with the 1st MPI_File_set_view from - * H5FD_mpio_write() - */ - if (MPI_SUCCESS != - (mpi_code = MPI_File_set_view(mpi_fh, (MPI_Offset)0, MPI_BYTE, MPI_BYTE, "native", info))) - HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) + /* MPI count to write */ + buf_count = 0; + } /* end else */ - /* just to match up with MPI_File_write_at_all from H5FD_mpio_write() */ - HDmemset(&mpi_stat, 0, sizeof(MPI_Status)); - if (MPI_SUCCESS != - (mpi_code = MPI_File_write_at_all(mpi_fh, (MPI_Offset)0, NULL, 0, MPI_BYTE, &mpi_stat))) - HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at_all failed", mpi_code) + /* Pass buf type, file type to the file driver */ + if (H5CX_set_mpi_coll_datatypes(btype, ftype) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set MPI-I/O properties") - /* just to match up with the 2nd MPI_File_set_view (reset) in - * H5FD_mpio_write() - */ - if (MPI_SUCCESS != - (mpi_code = MPI_File_set_view(mpi_fh, (MPI_Offset)0, MPI_BYTE, MPI_BYTE, "native", info))) - HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) - } /* end else */ + /* Write data */ + if (H5F_block_write(f, H5FD_MEM_DEFAULT, (haddr_t)0, buf_count, base_buf) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_WRITEERROR, FAIL, "unable to write entries collectively") done: /* Free arrays */ @@ -1052,9 +999,9 @@ done: offset_array = (MPI_Aint *)H5MM_xfree(offset_array); /* Free MPI Types */ - if (btype_created && MPI_SUCCESS != (mpi_code = MPI_Type_free(&btype))) + if (MPI_BYTE != btype && MPI_SUCCESS != (mpi_code = MPI_Type_free(&btype))) HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) - if (ftype_created && MPI_SUCCESS != (mpi_code = MPI_Type_free(&ftype))) + if (MPI_BYTE != ftype && MPI_SUCCESS != (mpi_code = MPI_Type_free(&ftype))) HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) /* Reset transfer mode in API context, if changed */ diff --git a/src/H5FDmpi.c b/src/H5FDmpi.c index 32c899d..048b8f3 100644 --- a/src/H5FDmpi.c +++ b/src/H5FDmpi.c @@ -136,43 +136,6 @@ done: } /* end H5FD_mpi_get_comm() */ /*------------------------------------------------------------------------- - * Function: H5FD_get_mpi_info - * - * Purpose: Retrieves the file's mpi info - * - * Return: Success: SUCCEED - * - * Failure: FAIL - * - * Programmer: John Mainzer - * 4/4/17 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -herr_t -H5FD_get_mpi_info(H5FD_t *file, void **mpi_info) -{ - const H5FD_class_mpi_t *cls; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - - HDassert(file); - cls = (const H5FD_class_mpi_t *)(file->cls); - HDassert(cls); - HDassert(cls->get_mpi_info); /* All MPI drivers must implement this */ - - /* Dispatch to driver */ - if ((ret_value = (cls->get_mpi_info)(file, mpi_info)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get_mpi_info request failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_get_mpi_info() */ - -/*------------------------------------------------------------------------- * Function: H5FD_mpi_MPIOff_to_haddr * * Purpose: Convert an MPI_Offset value to haddr_t. diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index b8bfae8..9dbd443 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -42,7 +42,7 @@ static hid_t H5FD_MPIO_g = 0; /* Whether to allow collective I/O operations */ -/* (Value can be set from environment variable also) */ +/* (Can be changed by setting "HDF5_MPI_OPT_TYPES" environment variable to '0' or '1') */ hbool_t H5FD_mpi_opt_types_g = TRUE; /* @@ -89,7 +89,6 @@ static herr_t H5FD__mpio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closin static int H5FD__mpio_mpi_rank(const H5FD_t *_file); static int H5FD__mpio_mpi_size(const H5FD_t *_file); static MPI_Comm H5FD__mpio_communicator(const H5FD_t *_file); -static herr_t H5FD__mpio_get_info(H5FD_t *_file, void **mpi_info); /* The MPIO file driver information */ static const H5FD_class_mpi_t H5FD_mpio_g = { @@ -131,28 +130,30 @@ static const H5FD_class_mpi_t H5FD_mpio_g = { }, /* End of superclass information */ H5FD__mpio_mpi_rank, /*get_rank */ H5FD__mpio_mpi_size, /*get_size */ - H5FD__mpio_communicator, /*get_comm */ - H5FD__mpio_get_info /*get_info */ + H5FD__mpio_communicator /*get_comm */ }; #ifdef H5FDmpio_DEBUG -/* Flags to control debug actions in H5Fmpio. - * Meant to be indexed by characters. - * - * 'c' show result of MPI_Get_count after read - * 'r' show read offset and size - * 't' trace function entry and exit - * 'w' show write offset and size +/* Flags to control debug actions in the MPI-IO VFD. + * (Meant to be indexed by characters) + * + * These flags can be set with either (or both) the environment variable + * "H5FD_mpio_Debug" set to a string containing one or more characters + * (flags) or by setting them as a string value for the + * "H5F_mpio_debug_key" MPI Info key. + * + * Supported characters in 'H5FD_mpio_Debug' string: + * 't' trace function entry and exit + * 'r' show read offset and size + * 'w' show write offset and size + * '0'-'9' only show output from a single MPI rank (ranks 0-9 supported) */ -static int H5FD_mpio_Debug[256] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +static int H5FD_mpio_debug_flags_s[256]; +static int H5FD_mpio_debug_rank_s = -1; + +/* Indicate if this rank should output tracing info */ +#define H5FD_MPIO_TRACE_THIS_RANK(file) \ + (H5FD_mpio_debug_rank_s < 0 || H5FD_mpio_debug_rank_s == (file)->mpi_rank) #endif /*-------------------------------------------------------------------------- @@ -184,6 +185,41 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5FD__init_package() */ +#ifdef H5FDmpio_DEBUG + +/*--------------------------------------------------------------------------- + * Function: H5FD__mpio_parse_debug_str + * + * Purpose: Parse a string for debugging flags + * + * Returns: N/A + * + * Programmer: Quincey Koziol + * Wednesday, Aug 12, 2020 + * + *--------------------------------------------------------------------------- + */ +static void +H5FD__mpio_parse_debug_str(const char *s) +{ + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(s); + + /* Set debug mask */ + while (*s) { + if ((int)(*s) >= (int)'0' && (int)(*s) <= (int)'9') + H5FD_mpio_debug_rank_s = ((int)*s) - (int)'0'; + else + H5FD_mpio_debug_flags_s[(int)*s]++; + s++; + } /* end while */ + + FUNC_LEAVE_NOAPI_VOID +} /* end H5FD__mpio_parse_debug_str() */ +#endif /* H5FDmpio_DEBUG */ + /*------------------------------------------------------------------------- * Function: H5FD_mpio_init * @@ -201,11 +237,8 @@ done: hid_t H5FD_mpio_init(void) { -#ifdef H5FDmpio_DEBUG static int H5FD_mpio_Debug_inited = 0; -#endif /* H5FDmpio_DEBUG */ - const char *s; /* String for environment variables */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI(H5I_INVALID_HID) @@ -213,28 +246,27 @@ H5FD_mpio_init(void) if (H5I_VFL != H5I_get_type(H5FD_MPIO_g)) H5FD_MPIO_g = H5FD_register((const H5FD_class_t *)&H5FD_mpio_g, sizeof(H5FD_class_mpi_t), FALSE); - /* Allow MPI buf-and-file-type optimizations? */ - s = HDgetenv("HDF5_MPI_OPT_TYPES"); - if (s && HDisdigit(*s)) { - long env_val = HDstrtol(s, NULL, 0); - H5FD_mpi_opt_types_g = (0 == env_val) ? FALSE : TRUE; - } + if (!H5FD_mpio_Debug_inited) { + const char *s; /* String for environment variables */ + + /* Allow MPI buf-and-file-type optimizations? */ + s = HDgetenv("HDF5_MPI_OPT_TYPES"); + if (s && HDisdigit(*s)) + H5FD_mpi_opt_types_g = (0 == HDstrtol(s, NULL, 0)) ? FALSE : TRUE; #ifdef H5FDmpio_DEBUG - if (!H5FD_mpio_Debug_inited) { + /* Clear the flag buffer */ + HDmemset(H5FD_mpio_debug_flags_s, 0, sizeof(H5FD_mpio_debug_flags_s)); + /* Retrieve MPI-IO debugging environment variable */ s = HDgetenv("H5FD_mpio_Debug"); - if (s) { - /* Set debug mask */ - while (*s) { - H5FD_mpio_Debug[(int)*s]++; - s++; - } /* end while */ - } /* end if */ - H5FD_mpio_Debug_inited++; - } /* end if */ + if (s) + H5FD__mpio_parse_debug_str(s); #endif /* H5FDmpio_DEBUG */ + H5FD_mpio_Debug_inited++; + } /* end if */ + /* Set return value */ ret_value = H5FD_MPIO_g; @@ -658,30 +690,27 @@ 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; +#ifdef H5FDmpio_DEBUG + hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file)); +#endif + int mpi_code; /* MPI return code */ + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Entering\n", FUNC); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank); #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))) + if (MPI_SUCCESS != (mpi_code = MPI_File_set_atomicity(file->f, (int)(flag != FALSE)))) HMPI_GOTO_ERROR(FAIL, "MPI_File_set_atomicity", mpi_code) done: #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Leaving\n", FUNC); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, file->mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -703,15 +732,18 @@ 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; +#ifdef H5FDmpio_DEBUG + hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file)); +#endif + int mpi_code; /* MPI return code */ + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Entering\n", FUNC); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank); #endif /* Get atomicity value */ @@ -725,8 +757,8 @@ H5FD_get_mpio_atomicity(H5FD_t *_file, hbool_t *flag) done: #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Leaving\n", FUNC); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, file->mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -753,26 +785,23 @@ done: static H5FD_t * H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR_UNUSED maxaddr) { - H5FD_mpio_t * file = NULL; - MPI_File fh; - hbool_t file_opened = FALSE; /* Flag to indicate that the file was successfully opened */ - int mpi_amode; - int mpi_rank; /* MPI rank of this process */ - int mpi_size; /* Total number of MPI processes */ - int mpi_code; /* MPI return code */ - MPI_Offset size; - H5P_genplist_t *plist; /* Property list pointer */ - MPI_Comm comm = MPI_COMM_NULL; - MPI_Info info = MPI_INFO_NULL; - H5FD_t * ret_value = NULL; /* Return value */ - - FUNC_ENTER_STATIC - + H5FD_mpio_t * file = NULL; /* VFD File struct for new file */ + H5P_genplist_t *plist; /* Property list pointer */ + MPI_Comm comm = MPI_COMM_NULL; /* MPI Communicator, from plist */ + MPI_Info info = MPI_INFO_NULL; /* MPI Info, from plist */ + MPI_File fh; /* MPI file handle */ + hbool_t file_opened = FALSE; /* Flag to indicate that the file was successfully opened */ + int mpi_amode; /* MPI file access flags */ + int mpi_rank = INT_MAX; /* MPI rank of this process */ + int mpi_size; /* Total number of MPI processes */ + MPI_Offset file_size; /* File size (of existing files) */ #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Entering - name = \"%s\", flags = 0x%x, fapl_id = %d, maxaddr = %lu\n", FUNC, - name, flags, (int)fapl_id, (unsigned long)maxaddr); + hbool_t H5FD_mpio_debug_t_flag = FALSE; #endif + int mpi_code; /* MPI return code */ + H5FD_t *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC /* Get a pointer to the fapl */ if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) @@ -784,6 +813,20 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR if (H5P_get(plist, H5F_ACS_MPI_PARAMS_INFO_NAME, &info) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get MPI info object") + /* Get the MPI rank of this process and the total number of processes */ + if (MPI_SUCCESS != (mpi_code = MPI_Comm_rank(comm, &mpi_rank))) + HMPI_GOTO_ERROR(NULL, "MPI_Comm_rank failed", mpi_code) + if (MPI_SUCCESS != (mpi_code = MPI_Comm_size(comm, &mpi_size))) + HMPI_GOTO_ERROR(NULL, "MPI_Comm_size failed", mpi_code) + +#ifdef H5FDmpio_DEBUG + H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && + (H5FD_mpio_debug_rank_s < 0 || H5FD_mpio_debug_rank_s == mpi_rank)); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Entering - name = \"%s\", flags = 0x%x, fapl_id = %d, maxaddr = %lu\n", + FUNC, mpi_rank, name, flags, (int)fapl_id, (unsigned long)maxaddr); +#endif + /* Convert HDF5 flags to MPI-IO flags */ /* Some combinations are illegal; let MPI-IO figure it out */ mpi_amode = (flags & H5F_ACC_RDWR) ? MPI_MODE_RDWR : MPI_MODE_RDONLY; @@ -799,26 +842,15 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR int flag; MPI_Info_get(info, H5F_MPIO_DEBUG_KEY, sizeof(debug_str) - 1, debug_str, &flag); - if (flag) { - int i; - - HDfprintf(stdout, "H5FD_mpio debug flags = '%s'\n", debug_str); - for (i = 0; debug_str[i] /*end of string*/ && i < 128 /*just in case*/; ++i) - H5FD_mpio_Debug[(int)debug_str[i]] = 1; - } /* end if */ - } /* end if */ + if (flag) + H5FD__mpio_parse_debug_str(debug_str); + } /* end if */ #endif if (MPI_SUCCESS != (mpi_code = MPI_File_open(comm, name, mpi_amode, info, &fh))) HMPI_GOTO_ERROR(NULL, "MPI_File_open failed", mpi_code) file_opened = TRUE; - /* Get the MPI rank of this process and the total number of processes */ - if (MPI_SUCCESS != (mpi_code = MPI_Comm_rank(comm, &mpi_rank))) - HMPI_GOTO_ERROR(NULL, "MPI_Comm_rank failed", mpi_code) - if (MPI_SUCCESS != (mpi_code = MPI_Comm_size(comm, &mpi_size))) - HMPI_GOTO_ERROR(NULL, "MPI_Comm_size failed", mpi_code) - /* Build the return value and initialize it */ if (NULL == (file = (H5FD_mpio_t *)H5MM_calloc(sizeof(H5FD_mpio_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") @@ -829,17 +861,17 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR file->mpi_size = mpi_size; /* Only processor p0 will get the filesize and broadcast it. */ - if (mpi_rank == 0) { - if (MPI_SUCCESS != (mpi_code = MPI_File_get_size(fh, &size))) + if (mpi_rank == 0) + if (MPI_SUCCESS != (mpi_code = MPI_File_get_size(fh, &file_size))) HMPI_GOTO_ERROR(NULL, "MPI_File_get_size failed", mpi_code) - } /* end if */ /* Broadcast file size */ - if (MPI_SUCCESS != (mpi_code = MPI_Bcast(&size, (int)sizeof(MPI_Offset), MPI_BYTE, 0, comm))) + if (MPI_SUCCESS != (mpi_code = MPI_Bcast(&file_size, (int)sizeof(MPI_Offset), MPI_BYTE, 0, comm))) HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) /* Determine if the file should be truncated */ - if (size && (flags & H5F_ACC_TRUNC)) { + if (file_size && (flags & H5F_ACC_TRUNC)) { + /* Truncate the file */ if (MPI_SUCCESS != (mpi_code = MPI_File_set_size(fh, (MPI_Offset)0))) HMPI_GOTO_ERROR(NULL, "MPI_File_set_size failed", mpi_code) @@ -848,11 +880,11 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR HMPI_GOTO_ERROR(NULL, "MPI_Barrier failed", mpi_code) /* File is zero size now */ - size = 0; + file_size = 0; } /* end if */ /* Set the size of the file (from library's perspective) */ - file->eof = H5FD_mpi_MPIOff_to_haddr(size); + file->eof = H5FD_mpi_MPIOff_to_haddr(file_size); file->local_eof = file->eof; /* Set return value */ @@ -871,8 +903,8 @@ done: } /* end if */ #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Leaving\n", FUNC); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -894,14 +926,18 @@ static herr_t H5FD__mpio_close(H5FD_t *_file) { H5FD_mpio_t *file = (H5FD_mpio_t *)_file; - int mpi_code; /* MPI return code */ - herr_t ret_value = SUCCEED; /* Return value */ +#ifdef H5FDmpio_DEBUG + hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file)); + int mpi_rank = file->mpi_rank; +#endif + int mpi_code; /* MPI return code */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Entering\n", FUNC); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank); #endif /* Sanity checks */ @@ -909,7 +945,7 @@ H5FD__mpio_close(H5FD_t *_file) HDassert(H5FD_MPIO == file->pub.driver_id); /* MPI_File_close sets argument to MPI_FILE_NULL */ - if (MPI_SUCCESS != (mpi_code = MPI_File_close(&(file->f) /*in,out*/))) + if (MPI_SUCCESS != (mpi_code = MPI_File_close(&(file->f)))) HMPI_GOTO_ERROR(FAIL, "MPI_File_close failed", mpi_code) /* Clean up other stuff */ @@ -919,8 +955,8 @@ H5FD__mpio_close(H5FD_t *_file) done: #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Leaving\n", FUNC); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -952,7 +988,7 @@ H5FD__mpio_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /* out *flags |= H5FD_FEAT_HAS_MPI; /* This driver uses MPI */ *flags |= H5FD_FEAT_ALLOCATE_EARLY; /* Allocate space early instead of late */ *flags |= H5FD_FEAT_DEFAULT_VFD_COMPATIBLE; /* VFD creates a file which can be opened with the default - VFD */ + VFD */ } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) @@ -1114,7 +1150,6 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU H5FD_mpio_t *file = (H5FD_mpio_t *)_file; MPI_Offset mpi_off; MPI_Status mpi_stat; /* Status from I/O operation */ - int mpi_code; /* mpi return code */ MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */ int size_i; /* Integer copy of 'size' to read */ #if MPI_VERSION >= 3 @@ -1130,13 +1165,18 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU #endif hbool_t use_view_this_time = FALSE; hbool_t rank0_bcast = FALSE; /* If read-with-rank0-and-bcast flag was used */ - herr_t ret_value = SUCCEED; +#ifdef H5FDmpio_DEBUG + hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file)); + hbool_t H5FD_mpio_debug_r_flag = (H5FD_mpio_debug_flags_s[(int)'r'] && H5FD_MPIO_TRACE_THIS_RANK(file)); +#endif + int mpi_code; /* MPI return code */ + herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Entering\n", FUNC); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank); #endif /* Sanity checks */ @@ -1155,8 +1195,9 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from size to size_i") #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'r']) - HDfprintf(stdout, "%s: mpi_off = %ld size_i = %d\n", FUNC, (long)mpi_off, size_i); + if (H5FD_mpio_debug_r_flag) + HDfprintf(stderr, "%s: (%d) mpi_off = %ld size_i = %d\n", FUNC, file->mpi_rank, (long)mpi_off, + size_i); #endif /* Only look for MPI views for raw data transfers */ @@ -1202,8 +1243,8 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU H5FD_mpio_collective_opt_t coll_opt_mode; #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'r']) - HDfprintf(stdout, "%s: using MPIO collective mode\n", FUNC); + if (H5FD_mpio_debug_r_flag) + HDfprintf(stderr, "%s: (%d) using MPIO collective mode\n", FUNC, file->mpi_rank); #endif /* Get the collective_opt property to check whether the application wants to do IO individually. */ if (H5CX_get_mpio_coll_opt(&coll_opt_mode) < 0) @@ -1211,14 +1252,14 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU if (coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) { #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'r']) - HDfprintf(stdout, "%s: doing MPI collective IO\n", FUNC); + if (H5FD_mpio_debug_r_flag) + HDfprintf(stderr, "%s: (%d) doing MPI collective IO\n", FUNC, file->mpi_rank); #endif /* Check whether we should read from rank 0 and broadcast to other ranks */ if (H5CX_get_mpio_rank0_bcast()) { #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'r']) - HDfprintf(stdout, "%s: doing read-rank0-and-MPI_Bcast\n", FUNC); + if (H5FD_mpio_debug_r_flag) + HDfprintf(stderr, "%s: (%d) doing read-rank0-and-MPI_Bcast\n", FUNC, file->mpi_rank); #endif /* Indicate path we've taken */ rank0_bcast = TRUE; @@ -1231,16 +1272,19 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU if (MPI_SUCCESS != (mpi_code = MPI_Bcast(buf, size_i, buf_type, 0, file->comm))) HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_code) } /* end if */ - else if (MPI_SUCCESS != - (mpi_code = MPI_File_read_at_all(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) + else + /* Perform collective read operation */ + if (MPI_SUCCESS != + (mpi_code = MPI_File_read_at_all(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at_all failed", mpi_code) } /* end if */ else { #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'r']) - HDfprintf(stdout, "%s: doing MPI independent IO\n", FUNC); + if (H5FD_mpio_debug_r_flag) + HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", FUNC, file->mpi_rank); #endif + /* Perform independent read operation */ if (MPI_SUCCESS != (mpi_code = MPI_File_read_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code) @@ -1253,8 +1297,16 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU H5FD_mpi_native_g, file->info))) HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) } /* end if */ - else if (MPI_SUCCESS != (mpi_code = MPI_File_read_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) - HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code) + else { +#ifdef H5FDmpio_DEBUG + if (H5FD_mpio_debug_r_flag) + HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", FUNC, file->mpi_rank); +#endif + + /* Perform independent read operation */ + if (MPI_SUCCESS != (mpi_code = MPI_File_read_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) + HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code) + } /* end else */ /* Only retrieve bytes read if this rank _actually_ participated in I/O */ if (!rank0_bcast || (rank0_bcast && file->mpi_rank == 0)) { @@ -1274,7 +1326,11 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU * of the data. (QAK - 2019/1/2) */ if (rank0_bcast) - if (MPI_SUCCESS != MPI_Bcast(&bytes_read, 1, MPI_LONG_LONG, 0, file->comm)) +#if MPI_VERSION >= 3 + if (MPI_SUCCESS != MPI_Bcast(&bytes_read, 1, MPI_COUNT, 0, file->comm)) +#else + if (MPI_SUCCESS != MPI_Bcast(&bytes_read, 1, MPI_INT, 0, file->comm)) +#endif HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", 0) /* Get the type's size */ @@ -1300,8 +1356,8 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU done: #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Leaving\n", FUNC); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, file->mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -1336,7 +1392,6 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h MPI_Offset mpi_off; MPI_Status mpi_stat; /* Status from I/O operation */ MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */ - int mpi_code; /* MPI return code */ #if MPI_VERSION >= 3 MPI_Count bytes_written; MPI_Count type_size; /* MPI datatype used for I/O's size */ @@ -1350,13 +1405,18 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h hbool_t use_view_this_time = FALSE; hbool_t derived_type = FALSE; H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode */ - herr_t ret_value = SUCCEED; +#ifdef H5FDmpio_DEBUG + hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file)); + hbool_t H5FD_mpio_debug_w_flag = (H5FD_mpio_debug_flags_s[(int)'w'] && H5FD_MPIO_TRACE_THIS_RANK(file)); +#endif + int mpi_code; /* MPI return code */ + herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Entering\n", FUNC); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank); #endif /* Sanity checks */ @@ -1376,8 +1436,9 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h size_i = (int)size; #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'w']) - HDfprintf(stdout, "%s: mpi_off = %ld size_i = %d\n", FUNC, (long)mpi_off, size_i); + if (H5FD_mpio_debug_w_flag) + HDfprintf(stderr, "%s: (%d) mpi_off = %ld size_i = %d\n", FUNC, file->mpi_rank, (long)mpi_off, + size_i); #endif /* Get the transfer mode from the API context */ @@ -1432,8 +1493,8 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h H5FD_mpio_collective_opt_t coll_opt_mode; #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'w']) - HDfprintf(stdout, "%s: using MPIO collective mode\n", FUNC); + if (H5FD_mpio_debug_w_flag) + HDfprintf(stderr, "%s: (%d) using MPIO collective mode\n", FUNC, file->mpi_rank); #endif /* Get the collective_opt property to check whether the application wants to do IO individually. */ @@ -1442,8 +1503,8 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h if (coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) { #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'w']) - HDfprintf(stdout, "%s: doing MPI collective IO\n", FUNC); + if (H5FD_mpio_debug_w_flag) + HDfprintf(stderr, "%s: (%d) doing MPI collective IO\n", FUNC, file->mpi_rank); #endif /* Perform collective write operation */ if (MPI_SUCCESS != @@ -1454,9 +1515,10 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h if (type != H5FD_MEM_DRAW) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "Metadata Coll opt property should be collective at this point") + #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'w']) - HDfprintf(stdout, "%s: doing MPI independent IO\n", FUNC); + if (H5FD_mpio_debug_w_flag) + HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", FUNC, file->mpi_rank); #endif /* Perform independent write operation */ if (MPI_SUCCESS != @@ -1469,11 +1531,18 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h H5FD_mpi_native_g, file->info))) HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) } /* end if */ - else if (MPI_SUCCESS != - (mpi_code = MPI_File_write_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) - HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code) + else { +#ifdef H5FDmpio_DEBUG + if (H5FD_mpio_debug_w_flag) + HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", FUNC, file->mpi_rank); +#endif - /* How many bytes were actually written? */ + /* Perform independent write operation */ + if (MPI_SUCCESS != (mpi_code = MPI_File_write_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) + HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code) + } /* end else */ + + /* How many bytes were actually written? */ #if MPI_VERSION >= 3 if (MPI_SUCCESS != (mpi_code = MPI_Get_elements_x(&mpi_stat, buf_type, &bytes_written))) #else @@ -1512,8 +1581,8 @@ done: MPI_Type_free(&buf_type); #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Leaving, proc %d: ret_value = %d\n", FUNC, file->mpi_rank, ret_value); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Leaving: ret_value = %d\n", FUNC, file->mpi_rank, ret_value); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -1535,14 +1604,17 @@ static herr_t H5FD__mpio_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) { H5FD_mpio_t *file = (H5FD_mpio_t *)_file; - int mpi_code; /* mpi return code */ - herr_t ret_value = SUCCEED; +#ifdef H5FDmpio_DEBUG + hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file)); +#endif + int mpi_code; /* mpi return code */ + herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Entering\n", FUNC); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank); #endif /* Sanity checks */ @@ -1556,8 +1628,8 @@ H5FD__mpio_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) done: #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Leaving\n", FUNC); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, file->mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -1570,13 +1642,14 @@ done: * * This is a little sticky in the mpio case, as it is not * easy for us to track the current EOF by extracting it from - * write calls. + * write calls, since other ranks could have written to the + * file beyond the local EOF. * - * Instead, we first check to see if the eoa has changed since + * Instead, we first check to see if the EOA has changed since * the last call to this function. If it has, we call * MPI_File_get_size() to determine the current EOF, and * only call MPI_File_set_size() if this value disagrees - * with the current eoa. + * with the current EOA. * * Return: SUCCEED/FAIL * @@ -1588,14 +1661,17 @@ done: static herr_t H5FD__mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UNUSED closing) { - H5FD_mpio_t *file = (H5FD_mpio_t *)_file; - herr_t ret_value = SUCCEED; + H5FD_mpio_t *file = (H5FD_mpio_t *)_file; +#ifdef H5FDmpio_DEBUG + hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file)); +#endif + herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Entering\n", FUNC); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank); #endif /* Sanity checks */ @@ -1663,8 +1739,8 @@ H5FD__mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR done: #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Leaving\n", FUNC); + if (H5FD_mpio_debug_t_flag) + HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, file->mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -1750,34 +1826,4 @@ H5FD__mpio_communicator(const H5FD_t *_file) FUNC_LEAVE_NOAPI(file->comm) } /* end H5FD__mpio_communicator() */ - -/*------------------------------------------------------------------------- - * Function: H5FD__mpio_get_info - * - * Purpose: Returns the file info of MPIO file driver. - * - * Returns: Non-negative if succeed or negative if fails. - * - * Programmer: John Mainzer - * April 4, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5FD__mpio_get_info(H5FD_t *_file, void **mpi_info) -{ - H5FD_mpio_t *file = (H5FD_mpio_t *)_file; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_STATIC - - if (!mpi_info) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mpi info not valid") - - *mpi_info = &(file->info); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD__mpio_get_info() */ - #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index 1e405d2..adf900a 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -22,13 +22,13 @@ #include "H5FDpublic.h" /* Private headers needed by this file */ -#include "H5Pprivate.h" /* Property lists */ +#include "H5Pprivate.h" /* Property lists */ /* * The MPI drivers are needed because there are * places where we check for things that aren't handled by these drivers. */ -#include "H5FDmpi.h" /* MPI-based file drivers */ +#include "H5FDmpi.h" /* MPI-based file drivers */ /**************************/ /* Library Private Macros */ @@ -260,11 +260,10 @@ vfd_swmr_pageno_to_mdf_idx_entry(H5FD_vfd_swmr_idx_entry_t *idx, uint32_t nentri /* Sub-class the H5FD_class_t to add more specific functions for MPI-based VFDs */ typedef struct H5FD_class_mpi_t { - H5FD_class_t super; /* Superclass information & methods */ - int (*get_rank)(const H5FD_t *file); /* Get the MPI rank of a process */ - int (*get_size)(const H5FD_t *file); /* Get the MPI size of a communicator */ - MPI_Comm (*get_comm)(const H5FD_t *file); /* Get the communicator for a file */ - herr_t (*get_mpi_info)(H5FD_t *file, void **mpi_info); /* get MPI_Info for a file */ + H5FD_class_t super; /* Superclass information & methods */ + int (*get_rank)(const H5FD_t *file); /* Get the MPI rank of a process */ + int (*get_size)(const H5FD_t *file); /* Get the MPI size of a communicator */ + MPI_Comm (*get_comm)(const H5FD_t *file); /* Get the communicator for a file */ } H5FD_class_mpi_t; #endif @@ -289,10 +288,16 @@ typedef struct { /* Define default file image info */ #define H5FD_DEFAULT_FILE_IMAGE_INFO \ { \ - /* file image buffer */ NULL, /* buffer size */ 0, \ - { /* Callbacks */ \ - /* image_malloc */ NULL, /* image_memcpy */ NULL, /* image_realloc */ NULL, \ - /* image_free */ NULL, /* udata_copy */ NULL, /* udata_free */ NULL, /* udata */ NULL, \ + NULL, /* file image buffer */ \ + 0, /* buffer size */ \ + { /* Callbacks */ \ + NULL, /* image_malloc */ \ + NULL, /* image_memcpy */ \ + NULL, /* image_realloc */ \ + NULL, /* image_free */ \ + NULL, /* udata_copy */ \ + NULL, /* udata_free */ \ + NULL, /* udata */ \ } \ } @@ -377,7 +382,6 @@ H5_DLL herr_t H5FD_get_mpio_atomicity(H5FD_t *file, hbool_t *flag); H5_DLL int H5FD_mpi_get_rank(const H5FD_t *file); H5_DLL int H5FD_mpi_get_size(const H5FD_t *file); H5_DLL MPI_Comm H5FD_mpi_get_comm(const H5FD_t *_file); -H5_DLL herr_t H5FD_get_mpi_info(H5FD_t *file, void **file_info); #endif /* H5_HAVE_PARALLEL */ #endif /* H5FDprivate_H */ diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index 652c9cc..4b5283e 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -15,7 +15,7 @@ * * Created: H5Fmpi.c * Jan 10 2008 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: MPI-related routines. * @@ -68,35 +68,6 @@ /*******************/ #ifdef H5_HAVE_PARALLEL - -/*------------------------------------------------------------------------- - * Function: H5F_get_mpi_handle - * - * Purpose: Retrieves MPI File handle. - * - * Return: Success: The size (positive) - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5F_get_mpi_handle(const H5F_t *f, MPI_File **f_handle) -{ - herr_t ret_value = SUCCEED; - hid_t fapl_id = H5I_INVALID_HID; - - FUNC_ENTER_NOAPI(FAIL) - - HDassert(f && f->shared); - - /* Dispatch to driver */ - if ((ret_value = H5FD_get_vfd_handle(f->shared->lf, fapl_id, (void **)f_handle)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get mpi file handle") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_get_mpi_handle() */ - /*------------------------------------------------------------------------- * Function: H5F_mpi_get_rank * @@ -336,13 +307,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag) +H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag /*out*/) { H5VL_object_t *vol_obj = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL); - H5TRACE2("e", "i*b", file_id, flag); + H5TRACE2("e", "ix", file_id, flag); /* Get the file object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) @@ -420,31 +391,4 @@ H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm) done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_mpi_retrieve_comm */ - -/*------------------------------------------------------------------------- - * Function: H5F_get_mpi_info - * - * Purpose: Retrieves MPI File info. - * - * Return: Success: The size (positive) - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5F_get_mpi_info(const H5F_t *f, MPI_Info **f_info) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - HDassert(f && f->shared); - - /* Dispatch to driver */ - if ((ret_value = H5FD_get_mpi_info(f->shared->lf, (void **)f_info)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get mpi file info") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_get_mpi_info() */ #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index d661829..0c4c51d 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -978,13 +978,11 @@ H5_DLL herr_t H5F_eoa_dirty(H5F_t *f); /* Parallel I/O (i.e. MPI) related routines */ #ifdef H5_HAVE_PARALLEL -H5_DLL herr_t H5F_get_mpi_handle(const H5F_t *f, MPI_File **f_handle); H5_DLL int H5F_mpi_get_rank(const H5F_t *f); H5_DLL MPI_Comm H5F_mpi_get_comm(const H5F_t *f); H5_DLL int H5F_shared_mpi_get_size(const H5F_shared_t *f_sh); H5_DLL int H5F_mpi_get_size(const H5F_t *f); H5_DLL herr_t H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm); -H5_DLL herr_t H5F_get_mpi_info(const H5F_t *f, MPI_Info **f_info); H5_DLL herr_t H5F_get_mpi_atomicity(H5F_t *file, hbool_t *flag); H5_DLL herr_t H5F_set_mpi_atomicity(H5F_t *file, hbool_t flag); #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index e2db3e4..b521232 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -209,12 +209,12 @@ /* Definition for 'mdc log location' flag */ #define H5F_ACS_MDC_LOG_LOCATION_SIZE sizeof(char *) #define H5F_ACS_MDC_LOG_LOCATION_DEF NULL /* default is no log location */ -#define H5F_ACS_MDC_LOG_LOCATION_ENC H5P_facc_mdc_log_location_enc -#define H5F_ACS_MDC_LOG_LOCATION_DEC H5P_facc_mdc_log_location_dec -#define H5F_ACS_MDC_LOG_LOCATION_DEL H5P_facc_mdc_log_location_del -#define H5F_ACS_MDC_LOG_LOCATION_COPY H5P_facc_mdc_log_location_copy -#define H5F_ACS_MDC_LOG_LOCATION_CMP H5P_facc_mdc_log_location_cmp -#define H5F_ACS_MDC_LOG_LOCATION_CLOSE H5P_facc_mdc_log_location_close +#define H5F_ACS_MDC_LOG_LOCATION_ENC H5P__facc_mdc_log_location_enc +#define H5F_ACS_MDC_LOG_LOCATION_DEC H5P__facc_mdc_log_location_dec +#define H5F_ACS_MDC_LOG_LOCATION_DEL H5P__facc_mdc_log_location_del +#define H5F_ACS_MDC_LOG_LOCATION_COPY H5P__facc_mdc_log_location_copy +#define H5F_ACS_MDC_LOG_LOCATION_CMP H5P__facc_mdc_log_location_cmp +#define H5F_ACS_MDC_LOG_LOCATION_CLOSE H5P__facc_mdc_log_location_close /* Definition for 'start metadata cache logging on access' flag */ #define H5F_ACS_START_MDC_LOG_ON_ACCESS_SIZE sizeof(hbool_t) #define H5F_ACS_START_MDC_LOG_ON_ACCESS_DEF FALSE @@ -366,12 +366,12 @@ static herr_t H5P__facc_vfd_swmr_config_enc(const void *value, void **_pp, size_ static herr_t H5P__facc_vfd_swmr_config_dec(const void **_pp, void *value); /* Metadata cache log location property callbacks */ -static herr_t H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size); -static herr_t H5P_facc_mdc_log_location_dec(const void **_pp, void *value); -static herr_t H5P_facc_mdc_log_location_del(hid_t prop_id, const char *name, size_t size, void *value); -static herr_t H5P_facc_mdc_log_location_copy(const char *name, size_t size, void *value); -static int H5P_facc_mdc_log_location_cmp(const void *value1, const void *value2, size_t size); -static herr_t H5P_facc_mdc_log_location_close(const char *name, size_t size, void *value); +static herr_t H5P__facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__facc_mdc_log_location_dec(const void **_pp, void *value); +static herr_t H5P__facc_mdc_log_location_del(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__facc_mdc_log_location_copy(const char *name, size_t size, void *value); +static int H5P__facc_mdc_log_location_cmp(const void *value1, const void *value2, size_t size); +static herr_t H5P__facc_mdc_log_location_close(const char *name, size_t size, void *value); /* Metadata cache image property callbacks */ static int H5P__facc_cache_image_config_cmp(const void *_config1, const void *_config2, @@ -1573,13 +1573,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_family_offset(hid_t fapl_id, hsize_t *offset) +H5Pget_family_offset(hid_t fapl_id, hsize_t *offset /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*h", fapl_id, offset); + H5TRACE2("e", "ix", fapl_id, offset); /* Get the plist structure */ if (H5P_DEFAULT == fapl_id) @@ -1651,13 +1651,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_multi_type(hid_t fapl_id, H5FD_mem_t *type) +H5Pget_multi_type(hid_t fapl_id, H5FD_mem_t *type /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*Mt", fapl_id, type); + H5TRACE2("e", "ix", fapl_id, type); /* Get the plist structure */ if (H5P_DEFAULT == fapl_id) @@ -1745,13 +1745,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_cache(hid_t plist_id, int *mdc_nelmts, size_t *rdcc_nslots, size_t *rdcc_nbytes, double *rdcc_w0) +H5Pget_cache(hid_t plist_id, int *mdc_nelmts, size_t *rdcc_nslots /*out*/, size_t *rdcc_nbytes /*out*/, + double *rdcc_w0 /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE5("e", "i*Is*z*z*d", plist_id, mdc_nelmts, rdcc_nslots, rdcc_nbytes, rdcc_w0); + H5TRACE5("e", "i*Isxxx", plist_id, mdc_nelmts, rdcc_nslots, rdcc_nbytes, rdcc_w0); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) @@ -1838,23 +1839,22 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr) +H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*CC", plist_id, config_ptr); + H5TRACE2("e", "ix", plist_id, config); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - /* validate the config_ptr */ - if (config_ptr == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL config_ptr on entry.") - - if (config_ptr->version != H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION) + /* validate the config ptr */ + if (config == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL config ptr on entry.") + if (config->version != H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown image config version.") /* If we ever support multiple versions of H5AC_cache_config_t, we @@ -1863,7 +1863,7 @@ H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr) */ /* Get the current initial metadata cache resize configuration */ - if (H5P_get(plist, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, config_ptr) < 0) + if (H5P_get(plist, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, config) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get metadata cache initial image config") done: @@ -1919,7 +1919,7 @@ done: * Purpose: Retrieve the metadata cache initial resize configuration * from the target FAPL. * - * Observe that the function will fail if config_ptr is + * Observe that the function will fail if config is * NULL, or if config_ptr->version specifies an unknown * version of H5AC_cache_config_t. * @@ -1931,23 +1931,22 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr) +H5Pget_mdc_config(hid_t plist_id, H5AC_cache_config_t *config /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*Cc", plist_id, config_ptr); + H5TRACE2("e", "ix", plist_id, config); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - /* validate the config_ptr */ - if (config_ptr == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL config_ptr on entry.") - - if (config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION) + /* validate the config ptr */ + if (config == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL config ptr on entry.") + if (config->version != H5AC__CURR_CACHE_CONFIG_VERSION) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown config version.") /* If we ever support multiple versions of H5AC_cache_config_t, we @@ -1956,7 +1955,7 @@ H5Pget_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr) */ /* Get the current initial metadata cache resize configuration */ - if (H5P_get(plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, config_ptr) < 0) + if (H5P_get(plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, config) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get metadata cache initial resize config") done: @@ -1985,13 +1984,6 @@ done: * Programmer: Quincey Koziol * June, 1999 * - * Modifications: - * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. - * *------------------------------------------------------------------------- */ herr_t @@ -2026,13 +2018,6 @@ done: * Programmer: Quincey Koziol * June, 1999 * - * Modifications: - * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. - * *------------------------------------------------------------------------- */ herr_t @@ -2067,8 +2052,6 @@ done: * Programmer: Raymond Lu * November, 2001 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -2102,18 +2085,16 @@ done: * Programmer: Raymond Lu * November, 2001 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t -H5Pget_fclose_degree(hid_t plist_id, H5F_close_degree_t *degree) +H5Pget_fclose_degree(hid_t plist_id, H5F_close_degree_t *degree /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*Fd", plist_id, degree); + H5TRACE2("e", "ix", plist_id, degree); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) @@ -2146,13 +2127,6 @@ done: * Programmer: Quincey Koziol * Friday, August 25, 2000 * - * Modifications: - * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. - * *------------------------------------------------------------------------- */ herr_t @@ -2187,13 +2161,6 @@ done: * Programmer: Quincey Koziol * Friday, August 29, 2000 * - * Modifications: - * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. - * *------------------------------------------------------------------------- */ herr_t @@ -2239,13 +2206,6 @@ done: * Programmer: Quincey Koziol * Thursday, September 21, 2000 * - * Modifications: - * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. - * *------------------------------------------------------------------------- */ herr_t @@ -2280,13 +2240,6 @@ done: * Programmer: Quincey Koziol * Thursday, September 21, 2000 * - * Modifications: - * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. - * *------------------------------------------------------------------------- */ herr_t @@ -2331,8 +2284,6 @@ done: * Programmer: Quincey Koziol * Wednesday, June 5, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -2367,8 +2318,6 @@ done: * Programmer: Quincey Koziol * Wednesday, June 5, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -2510,7 +2459,6 @@ H5Pset_libver_bounds(hid_t plist_id, H5F_libver_t low, H5F_libver_t high) /* Check args */ if (low < 0 || low > H5F_LIBVER_LATEST) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "low bound is not valid") - if (high < 0 || high > H5F_LIBVER_LATEST) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "high bound is not valid") @@ -2562,15 +2510,13 @@ H5Pget_libver_bounds(hid_t plist_id, H5F_libver_t *low /*out*/, H5F_libver_t *hi HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get values */ - if (low) { + if (low) if (H5P_get(plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, low) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get low bound for library format versions") - } - if (high) { + if (high) if (H5P_get(plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, high) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get high bound for library format versions") - } done: FUNC_LEAVE_API(ret_value) @@ -2630,13 +2576,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_elink_file_cache_size(hid_t plist_id, unsigned *efc_size) +H5Pget_elink_file_cache_size(hid_t plist_id, unsigned *efc_size /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*Iu", plist_id, efc_size); + H5TRACE2("e", "ix", plist_id, efc_size); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) @@ -2735,22 +2681,22 @@ done: /*------------------------------------------------------------------------- * Function: H5Pget_file_image * - * Purpose: If the file image exists and buf_ptr_ptr is not NULL, + * Purpose: If the file image exists and buf is not NULL, * allocate a buffer of the correct size, copy the image into * the new buffer, and return the buffer to the caller in - * *buf_ptr_ptr. Do this using the file image callbacks + * *buf. Do this using the file image callbacks * if defined. * * NB: It is the responsibility of the caller to free the - * buffer whose address is returned in *buf_ptr_ptr. Do + * buffer whose address is returned in *buf. Do * this using free if the file image callbacks are not * defined, or with whatever method is appropriate if * the callbacks are defined. * - * If buf_ptr_ptr is not NULL, and no image exists, set - * *buf_ptr_ptr to NULL. + * If buf is not NULL, and no image exists, set + * *buf to NULL. * - * If buf_len_ptr is not NULL, set *buf_len_ptr equal + * If buf_len is not NULL, set *buf_len equal * to the length of the file image if it exists, and * to 0 if it does not. * @@ -2762,14 +2708,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr) +H5Pget_file_image(hid_t fapl_id, void **buf /*out*/, size_t *buf_len /*out*/) { H5P_genplist_t * fapl; /* Property list pointer */ H5FD_file_image_info_t image_info; /* File image info */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "i**x*z", fapl_id, buf_ptr_ptr, buf_len_ptr); + H5TRACE3("e", "ixx", fapl_id, buf, buf_len); /* Get the plist structure */ if (NULL == (fapl = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) @@ -2784,11 +2730,11 @@ H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr) ((image_info.buffer == NULL) && (image_info.size == 0))); /* Set output size */ - if (buf_len_ptr != NULL) - *buf_len_ptr = image_info.size; + if (buf_len != NULL) + *buf_len = image_info.size; /* Duplicate the image if desired, using callbacks if available */ - if (buf_ptr_ptr != NULL) { + if (buf != NULL) { void *copy_ptr = NULL; /* Copy of memory image */ if (image_info.buffer != NULL) { @@ -2813,7 +2759,7 @@ H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr) H5MM_memcpy(copy_ptr, image_info.buffer, image_info.size); } /* end if */ - *buf_ptr_ptr = copy_ptr; + *buf = copy_ptr; } /* end if */ done: @@ -2898,7 +2844,7 @@ done: } /* end H5Pset_file_image_callbacks() */ /*------------------------------------------------------------------------- - * Function: H5Pget_file_image_callbacks + * Function: H5Pget_file_image_callbacks * * Purpose: Sets the callbacks for file images. Some file drivers allow * the use of user-defined callbacks for allocating, freeing and @@ -2913,14 +2859,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks_ptr) +H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks /*out*/) { H5P_genplist_t * fapl; /* Property list pointer */ H5FD_file_image_info_t info; /* File image info */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*DI", fapl_id, callbacks_ptr); + H5TRACE2("e", "ix", fapl_id, callbacks); /* Get the plist structure */ if (NULL == (fapl = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) @@ -2933,17 +2879,17 @@ H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback /* verify file image field consistency */ HDassert(((info.buffer != NULL) && (info.size > 0)) || ((info.buffer == NULL) && (info.size == 0))); - /* verify that callbacks_ptr is not NULL */ - if (NULL == callbacks_ptr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL callbacks_ptr") + /* verify that callbacks is not NULL */ + if (NULL == callbacks) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL callbacks ptr") /* Transfer values to parameters */ - *callbacks_ptr = info.callbacks; + *callbacks = info.callbacks; /* Copy udata if it exists */ if (info.callbacks.udata != NULL) { HDassert(info.callbacks.udata_copy); - if ((callbacks_ptr->udata = info.callbacks.udata_copy(info.callbacks.udata)) == 0) + if ((callbacks->udata = info.callbacks.udata_copy(info.callbacks.udata)) == 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't copy udata") } /* end if */ @@ -4358,14 +4304,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_object_flush_cb(hid_t plist_id, H5F_flush_cb_t *func, void **udata) +H5Pget_object_flush_cb(hid_t plist_id, H5F_flush_cb_t *func /*out*/, void **udata /*out*/) { H5P_genplist_t * plist; /* Property list pointer */ H5F_object_flush_t flush_info; herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "i*FF**x", plist_id, func, udata); + H5TRACE3("e", "ixx", plist_id, func, udata); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) @@ -4445,15 +4391,15 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_mdc_log_options(hid_t plist_id, hbool_t *is_enabled, char *location, size_t *location_size, - hbool_t *start_on_access) +H5Pget_mdc_log_options(hid_t plist_id, hbool_t *is_enabled /*out*/, char *location /*out*/, + size_t *location_size /*out*/, hbool_t *start_on_access /*out*/) { - H5P_genplist_t *plist; /* Property list pointer */ - char * location_ptr; /* Pointer to location string */ - herr_t ret_value = SUCCEED; /* Return value */ + H5P_genplist_t *plist; /* Property list pointer */ + char * location_ptr = NULL; /* Pointer to location string */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE5("e", "i*b*s*z*b", plist_id, is_enabled, location, location_size, start_on_access); + H5TRACE5("e", "ixxxx", plist_id, is_enabled, location, location_size, start_on_access); /* Get the property list structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) @@ -4482,14 +4428,14 @@ H5Pget_mdc_log_options(hid_t plist_id, hbool_t *is_enabled, char *location, size *location_size = HDstrlen(location_ptr) + 1; else *location_size = 0; - } + } /* end if */ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_mdc_log_options() */ /*------------------------------------------------------------------------- - * Function: H5P_facc_mdc_log_location_enc + * Function: H5P__facc_mdc_log_location_enc * * Purpose: Callback routine which is called whenever the metadata * cache log location property in the file access property @@ -4501,7 +4447,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size) +H5P__facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size) { const char *log_location = *(const char *const *)value; uint8_t ** pp = (uint8_t **)_pp; @@ -4509,7 +4455,7 @@ H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size) uint64_t enc_value; unsigned enc_size; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); @@ -4538,10 +4484,10 @@ H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size) *size += len; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P_facc_mdc_log_location_enc() */ +} /* end H5P__facc_mdc_log_location_enc() */ /*------------------------------------------------------------------------- - * Function: H5P_facc_mdc_log_location_dec + * Function: H5P__facc_mdc_log_location_dec * * Purpose: Callback routine which is called whenever the metadata * cache log location property in the file access property @@ -4553,7 +4499,7 @@ H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size) *------------------------------------------------------------------------- */ static herr_t -H5P_facc_mdc_log_location_dec(const void **_pp, void *_value) +H5P__facc_mdc_log_location_dec(const void **_pp, void *_value) { char ** log_location = (char **)_value; const uint8_t **pp = (const uint8_t **)_pp; @@ -4562,7 +4508,7 @@ H5P_facc_mdc_log_location_dec(const void **_pp, void *_value) unsigned enc_size; /* Size of encoded property */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(pp); HDassert(*pp); @@ -4591,10 +4537,10 @@ H5P_facc_mdc_log_location_dec(const void **_pp, void *_value) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_facc_mdc_log_location_dec() */ +} /* end H5P__facc_mdc_log_location_dec() */ /*------------------------------------------------------------------------- - * Function: H5P_facc_mdc_log_location_del + * Function: H5P__facc_mdc_log_location_del * * Purpose: Frees memory used to store the metadata cache log location. * @@ -4603,20 +4549,20 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P_facc_mdc_log_location_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, - size_t H5_ATTR_UNUSED size, void *value) +H5P__facc_mdc_log_location_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(value); H5MM_xfree(*(void **)value); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P_facc_mdc_log_location_del() */ +} /* end H5P__facc_mdc_log_location_del() */ /*------------------------------------------------------------------------- - * Function: H5P_facc_mdc_log_location_copy + * Function: H5P__facc_mdc_log_location_copy * * Purpose: Creates a copy of the metadata cache log location string. * @@ -4625,19 +4571,19 @@ H5P_facc_mdc_log_location_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_U *------------------------------------------------------------------------- */ static herr_t -H5P_facc_mdc_log_location_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +H5P__facc_mdc_log_location_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(value); *(char **)value = H5MM_xstrdup(*(const char **)value); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P_facc_mdc_log_location_copy() */ +} /* end H5P__facc_mdc_log_location_copy() */ /*------------------------------------------------------------------------- - * Function: H5P_facc_mdc_log_location_cmp + * Function: H5P__facc_mdc_log_location_cmp * * Purpose: Callback routine which is called whenever the metadata * cache log location property in the file creation property @@ -4647,14 +4593,14 @@ H5P_facc_mdc_log_location_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_U * *------------------------------------------------------------------------- */ -static int -H5P_facc_mdc_log_location_cmp(const void *value1, const void *value2, size_t H5_ATTR_UNUSED size) +static H5_ATTR_PURE int +H5P__facc_mdc_log_location_cmp(const void *value1, const void *value2, size_t H5_ATTR_UNUSED size) { const char *pref1 = *(const char *const *)value1; const char *pref2 = *(const char *const *)value2; int ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR if (NULL == pref1 && NULL != pref2) HGOTO_DONE(1); @@ -4665,10 +4611,10 @@ H5P_facc_mdc_log_location_cmp(const void *value1, const void *value2, size_t H5_ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_facc_mdc_log_location_cmp() */ +} /* end H5P__facc_mdc_log_location_cmp() */ /*------------------------------------------------------------------------- - * Function: H5P_facc_mdc_log_location_close + * Function: H5P__facc_mdc_log_location_close * * Purpose: Frees memory used to store the metadata cache log location * string @@ -4678,16 +4624,16 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P_facc_mdc_log_location_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +H5P__facc_mdc_log_location_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(value); H5MM_xfree(*(void **)value); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P_facc_mdc_log_location_close() */ +} /* end H5P__facc_mdc_log_location_close() */ /*------------------------------------------------------------------------- * Function: H5Pset_evict_on_close @@ -4756,13 +4702,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_evict_on_close(hid_t fapl_id, hbool_t *evict_on_close) +H5Pget_evict_on_close(hid_t fapl_id, hbool_t *evict_on_close /*out*/) { H5P_genplist_t *plist; /* property list pointer */ herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*b", fapl_id, evict_on_close); + H5TRACE2("e", "ix", 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)) @@ -5017,12 +4963,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective) +H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective /*out*/) { herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*b", plist_id, is_collective); + H5TRACE2("e", "ix", plist_id, is_collective); /* Compare the property list's class against the other class */ /* (Dataset, group, attribute, and named datype access property lists @@ -5106,13 +5052,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_mpi_params(hid_t plist_id, MPI_Comm *comm, MPI_Info *info) +H5Pget_mpi_params(hid_t plist_id, MPI_Comm *comm /*out*/, MPI_Info *info /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "i*Mc*Mi", plist_id, comm, info); + H5TRACE3("e", "ixx", plist_id, comm, info); /* Make sure that the property list is a fapl */ if (TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS)) @@ -5556,13 +5502,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_coll_metadata_write(hid_t plist_id, hbool_t *is_collective) +H5Pget_coll_metadata_write(hid_t plist_id, hbool_t *is_collective /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*b", plist_id, is_collective); + H5TRACE2("e", "ix", plist_id, is_collective); /* Compare the property list's class against the other class */ if (TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS)) @@ -5643,13 +5589,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_page_buffer_size(hid_t plist_id, size_t *buf_size, unsigned *min_meta_perc, unsigned *min_raw_perc) +H5Pget_page_buffer_size(hid_t plist_id, size_t *buf_size /*out*/, unsigned *min_meta_perc /*out*/, + unsigned *min_raw_perc /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "i*z*Iu*Iu", plist_id, buf_size, min_meta_perc, min_raw_perc); + H5TRACE4("e", "ixxx", plist_id, buf_size, min_meta_perc, min_raw_perc); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) @@ -5861,13 +5808,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_vol_id(hid_t plist_id, hid_t *vol_id) +H5Pget_vol_id(hid_t plist_id, hid_t *vol_id /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*i", plist_id, vol_id); + H5TRACE2("e", "ix", plist_id, vol_id); /* Get property list for ID */ if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) @@ -5943,13 +5890,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_vol_info(hid_t plist_id, void **vol_info) +H5Pget_vol_info(hid_t plist_id, void **vol_info /*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i**x", plist_id, vol_info); + H5TRACE2("e", "ix", plist_id, vol_info); /* Get property list for ID */ if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) diff --git a/src/H5mpi.c b/src/H5mpi.c index a83fdac..9749721 100644 --- a/src/H5mpi.c +++ b/src/H5mpi.c @@ -25,7 +25,7 @@ /****************/ /* Local Macros */ /****************/ -#define TWO_GIG_LIMIT (1 << 31) +#define TWO_GIG_LIMIT INT32_MAX #ifndef H5_MAX_MPI_COUNT #define H5_MAX_MPI_COUNT (1 << 30) #endif @@ -33,7 +33,7 @@ /*******************/ /* Local Variables */ /*******************/ -static hsize_t bigio_count = H5_MAX_MPI_COUNT; +static hsize_t bigio_count_g = H5_MAX_MPI_COUNT; /*------------------------------------------------------------------------- * Function: H5_mpi_set_bigio_count @@ -42,7 +42,7 @@ static hsize_t bigio_count = H5_MAX_MPI_COUNT; * when we utilize derived datatypes. This is of * particular interest for allowing nightly testing * - * Return: The current/previous value of bigio_count. + * Return: The current/previous value of bigio_count_g. * * Programmer: Richard Warren, March 10, 2017 * @@ -51,10 +51,10 @@ static hsize_t bigio_count = H5_MAX_MPI_COUNT; hsize_t H5_mpi_set_bigio_count(hsize_t new_count) { - hsize_t orig_count = bigio_count; + hsize_t orig_count = bigio_count_g; if ((new_count > 0) && (new_count < (hsize_t)TWO_GIG_LIMIT)) { - bigio_count = new_count; + bigio_count_g = new_count; } return orig_count; } /* end H5_mpi_set_bigio_count() */ @@ -63,9 +63,9 @@ H5_mpi_set_bigio_count(hsize_t new_count) * Function: H5_mpi_get_bigio_count * * Purpose: Allow other HDF5 library functions to access - * the current value for bigio_count. + * the current value for bigio_count_g. * - * Return: The current/previous value of bigio_count. + * Return: The current/previous value of bigio_count_g. * * Programmer: Richard Warren, October 7, 2019 * @@ -74,7 +74,7 @@ H5_mpi_set_bigio_count(hsize_t new_count) hsize_t H5_mpi_get_bigio_count(void) { - return bigio_count; + return bigio_count_g; } /*------------------------------------------------------------------------- @@ -210,7 +210,7 @@ H5_mpi_comm_free(MPI_Comm *comm) HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "comm pointer cannot be NULL") /* Free the communicator */ - if (MPI_COMM_NULL != *comm) + if (MPI_COMM_WORLD != *comm && MPI_COMM_NULL != *comm) MPI_Comm_free(comm); *comm = MPI_COMM_NULL; @@ -471,8 +471,8 @@ H5_mpio_create_large_type(hsize_t num_elements, MPI_Aint stride_bytes, MPI_Datat FUNC_ENTER_NOAPI(FAIL) /* Calculate how many Big MPI datatypes are needed to represent the buffer */ - num_big_types = (int)(num_elements / bigio_count); - leftover = (hsize_t)num_elements - (hsize_t)num_big_types * bigio_count; + num_big_types = (int)(num_elements / bigio_count_g); + leftover = (hsize_t)num_elements - (hsize_t)num_big_types * bigio_count_g; H5_CHECKED_ASSIGN(remaining_bytes, int, leftover, hsize_t); /* Create a contiguous datatype of size equal to the largest @@ -481,11 +481,11 @@ H5_mpio_create_large_type(hsize_t num_elements, MPI_Aint stride_bytes, MPI_Datat * use type_hvector to create the type with the displacement provided */ if (0 == stride_bytes) { - if (MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)bigio_count, old_type, &inner_type))) + if (MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)bigio_count_g, old_type, &inner_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code) } /* end if */ else if (MPI_SUCCESS != - (mpi_code = MPI_Type_create_hvector((int)bigio_count, 1, stride_bytes, old_type, &inner_type))) + (mpi_code = MPI_Type_create_hvector((int)bigio_count_g, 1, stride_bytes, old_type, &inner_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code) /* Create a contiguous datatype of the buffer (minus the remaining < 2GB part) @@ -510,7 +510,7 @@ H5_mpio_create_large_type(hsize_t num_elements, MPI_Aint stride_bytes, MPI_Datat HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code) } /* end if */ else if (MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector( - (int)(num_elements - (hsize_t)num_big_types * bigio_count), 1, + (int)(num_elements - (hsize_t)num_big_types * bigio_count_g), 1, stride_bytes, old_type, &leftover_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code) @@ -529,7 +529,7 @@ H5_mpio_create_large_type(hsize_t num_elements, MPI_Aint stride_bytes, MPI_Datat block_len[0] = 1; block_len[1] = 1; disp[0] = 0; - disp[1] = (old_extent + stride_bytes) * num_big_types * (MPI_Aint)bigio_count; + disp[1] = (old_extent + stride_bytes) * num_big_types * (MPI_Aint)bigio_count_g; if (MPI_SUCCESS != (mpi_code = MPI_Type_create_struct(2, block_len, disp, type, new_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code) diff --git a/src/H5public.h b/src/H5public.h index 2fb4407..8aadddc 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -372,7 +372,6 @@ htri_to_string(htri_t v) * \internal (Hoisted here, since it's used by both the * H5Lpublic.h and H5Opublic.h headers) */ /* Type for object tokens */ -/* (Hoisted here, since it's used by both the H5Lpublic.h and H5Opublic.h headers) */ typedef struct H5O_token_t { uint8_t __data[H5O_MAX_TOKEN_SIZE]; } H5O_token_t; |