mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-13 16:47:58 +08:00
Add H5_CHECK_MPI_VERSION macro to check for at least MPI version of (version, subversion) (#1556)
* Fix MPI version check for MPI_Aint_diff usage * Add H5_CHECK_MPI_VERSION macro Adds new H5_CHECK_MPI_VERSION macro to check for MPI library version/subversion pair of at least the specified pair
This commit is contained in:
parent
82bf2e97f7
commit
ab48ed6df0
@ -5403,7 +5403,7 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_fill_info_t *chunk_
|
||||
if (MPI_SUCCESS != (mpi_code = MPI_Get_address(partial_chunk_fill_buf, &partial_fill_buf_addr)))
|
||||
HMPI_GOTO_ERROR(FAIL, "MPI_Get_address failed", mpi_code)
|
||||
|
||||
#if MPI_VERSION >= 3 && MPI_SUBVERSION >= 1
|
||||
#if H5_CHECK_MPI_VERSION(3, 1)
|
||||
partial_fill_buf_disp = MPI_Aint_diff(partial_fill_buf_addr, fill_buf_addr);
|
||||
#else
|
||||
partial_fill_buf_disp = partial_fill_buf_addr - fill_buf_addr;
|
||||
|
@ -3801,7 +3801,7 @@ H5D__mpio_share_chunk_modification_data(H5D_filtered_collective_io_info_t *chunk
|
||||
H5D_filtered_collective_io_info_t **chunk_hash_table,
|
||||
unsigned char ***chunk_msg_bufs, int *chunk_msg_bufs_len)
|
||||
{
|
||||
#if MPI_VERSION >= 3
|
||||
#if H5_CHECK_MPI_VERSION(3, 0)
|
||||
H5D_filtered_collective_io_info_t *chunk_table = NULL;
|
||||
H5S_sel_iter_t * mem_iter = NULL;
|
||||
unsigned char ** msg_send_bufs = NULL;
|
||||
@ -4023,7 +4023,7 @@ H5D__mpio_share_chunk_modification_data(H5D_filtered_collective_io_info_t *chunk
|
||||
* post a non-blocking receive to receive it
|
||||
*/
|
||||
if (msg_flag) {
|
||||
#if MPI_VERSION >= 3
|
||||
#if H5_CHECK_MPI_VERSION(3, 0)
|
||||
MPI_Count msg_size = 0;
|
||||
|
||||
if (MPI_SUCCESS != (mpi_code = MPI_Get_elements_x(&status, MPI_BYTE, &msg_size)))
|
||||
@ -5768,7 +5768,7 @@ H5D__mpio_collective_filtered_io_type(H5D_filtered_collective_io_info_t *chunk_l
|
||||
* offset and base chunk data buffer.
|
||||
*/
|
||||
if (op_type == H5D_IO_OP_WRITE) {
|
||||
#if MPI_VERSION >= 3
|
||||
#if H5_CHECK_MPI_VERSION(3, 0)
|
||||
if (MPI_SUCCESS != (mpi_code = MPI_Get_address(chunk_list[0].buf, &base_buf)))
|
||||
HMPI_GOTO_ERROR(FAIL, "MPI_Get_address failed", mpi_code)
|
||||
#else
|
||||
@ -5793,7 +5793,7 @@ H5D__mpio_collective_filtered_io_type(H5D_filtered_collective_io_info_t *chunk_l
|
||||
* data buffer if we haven't already
|
||||
*/
|
||||
if (!H5F_addr_defined(base_offset)) {
|
||||
#if MPI_VERSION >= 3
|
||||
#if H5_CHECK_MPI_VERSION(3, 0)
|
||||
if (MPI_SUCCESS != (mpi_code = MPI_Get_address(chunk_list[i].buf, &base_buf)))
|
||||
HMPI_GOTO_ERROR(FAIL, "MPI_Get_address failed", mpi_code)
|
||||
#else
|
||||
@ -5830,7 +5830,7 @@ H5D__mpio_collective_filtered_io_type(H5D_filtered_collective_io_info_t *chunk_l
|
||||
* Set the displacement of the chunk entry's chunk data buffer,
|
||||
* relative to the first entry's data buffer
|
||||
*/
|
||||
#if MPI_VERSION >= 3 && MPI_SUBVERSION >= 1
|
||||
#if H5_CHECK_MPI_VERSION(3, 1)
|
||||
if (MPI_SUCCESS != (mpi_code = MPI_Get_address(chunk_list[i].buf, &chunk_buf)))
|
||||
HMPI_GOTO_ERROR(FAIL, "MPI_Get_address failed", mpi_code)
|
||||
|
||||
|
@ -1211,7 +1211,7 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
|
||||
MPI_Status mpi_stat; /* Status from I/O operation */
|
||||
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
|
||||
#if H5_CHECK_MPI_VERSION(3, 0)
|
||||
MPI_Count bytes_read = 0; /* Number of bytes read in */
|
||||
MPI_Count type_size; /* MPI datatype used for I/O's size */
|
||||
MPI_Count io_size; /* Actual number of bytes requested */
|
||||
@ -1382,7 +1382,7 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
|
||||
/* Only retrieve bytes read if this rank _actually_ participated in I/O */
|
||||
if (!rank0_bcast || (rank0_bcast && file->mpi_rank == 0)) {
|
||||
/* How many bytes were actually read? */
|
||||
#if MPI_VERSION >= 3
|
||||
#if H5_CHECK_MPI_VERSION(3, 0)
|
||||
if (MPI_SUCCESS != (mpi_code = MPI_Get_elements_x(&mpi_stat, buf_type, &bytes_read))) {
|
||||
#else
|
||||
if (MPI_SUCCESS != (mpi_code = MPI_Get_elements(&mpi_stat, MPI_BYTE, &bytes_read))) {
|
||||
@ -1407,7 +1407,7 @@ 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_VERSION >= 3
|
||||
#if H5_CHECK_MPI_VERSION(3, 0)
|
||||
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))
|
||||
@ -1415,7 +1415,7 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
|
||||
HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", 0)
|
||||
|
||||
/* Get the type's size */
|
||||
#if MPI_VERSION >= 3
|
||||
#if H5_CHECK_MPI_VERSION(3, 0)
|
||||
if (MPI_SUCCESS != (mpi_code = MPI_Type_size_x(buf_type, &type_size)))
|
||||
#else
|
||||
if (MPI_SUCCESS != (mpi_code = MPI_Type_size(buf_type, &type_size)))
|
||||
@ -1482,7 +1482,7 @@ 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 */
|
||||
#if MPI_VERSION >= 3
|
||||
#if H5_CHECK_MPI_VERSION(3, 0)
|
||||
MPI_Count bytes_written;
|
||||
MPI_Count type_size; /* MPI datatype used for I/O's size */
|
||||
MPI_Count io_size; /* Actual number of bytes requested */
|
||||
@ -1628,7 +1628,7 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h
|
||||
} /* end else */
|
||||
|
||||
/* How many bytes were actually written? */
|
||||
#if MPI_VERSION >= 3
|
||||
#if H5_CHECK_MPI_VERSION(3, 0)
|
||||
if (MPI_SUCCESS != (mpi_code = MPI_Get_elements_x(&mpi_stat, buf_type, &bytes_written)))
|
||||
#else
|
||||
if (MPI_SUCCESS != (mpi_code = MPI_Get_elements(&mpi_stat, MPI_BYTE, &bytes_written)))
|
||||
@ -1636,7 +1636,7 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h
|
||||
HMPI_GOTO_ERROR(FAIL, "MPI_Get_elements failed", mpi_code)
|
||||
|
||||
/* Get the type's size */
|
||||
#if MPI_VERSION >= 3
|
||||
#if H5_CHECK_MPI_VERSION(3, 0)
|
||||
if (MPI_SUCCESS != (mpi_code = MPI_Type_size_x(buf_type, &type_size)))
|
||||
#else
|
||||
if (MPI_SUCCESS != (mpi_code = MPI_Type_size(buf_type, &type_size)))
|
||||
|
@ -223,7 +223,7 @@ H5S__mpio_create_point_datatype(size_t elmt_size, hsize_t num_points, MPI_Aint *
|
||||
|
||||
/* Check whether standard or BIGIO processing will be employeed */
|
||||
if (bigio_count >= num_points) {
|
||||
#if MPI_VERSION >= 3
|
||||
#if H5_CHECK_MPI_VERSION(3, 0)
|
||||
/* Create an MPI datatype for the whole point selection */
|
||||
if (MPI_SUCCESS !=
|
||||
(mpi_code = MPI_Type_create_hindexed_block((int)num_points, 1, disp, elmt_type, new_type)))
|
||||
@ -284,7 +284,7 @@ H5S__mpio_create_point_datatype(size_t elmt_size, hsize_t num_points, MPI_Aint *
|
||||
#endif
|
||||
|
||||
for (i = 0; i < num_big_types; i++) {
|
||||
#if MPI_VERSION >= 3
|
||||
#if H5_CHECK_MPI_VERSION(3, 0)
|
||||
if (MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block((int)bigio_count, 1,
|
||||
&disp[(hsize_t)i * bigio_count],
|
||||
elmt_type, &inner_types[i])))
|
||||
@ -300,7 +300,7 @@ H5S__mpio_create_point_datatype(size_t elmt_size, hsize_t num_points, MPI_Aint *
|
||||
} /* end for*/
|
||||
|
||||
if (remaining_points) {
|
||||
#if MPI_VERSION >= 3
|
||||
#if H5_CHECK_MPI_VERSION(3, 0)
|
||||
if (MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block(
|
||||
remaining_points, 1, &disp[(hsize_t)num_big_types * bigio_count],
|
||||
elmt_type, &inner_types[num_big_types])))
|
||||
|
@ -628,7 +628,7 @@ H5_mpio_gatherv_alloc(void *send_buf, int send_count, MPI_Datatype send_type, co
|
||||
{
|
||||
size_t recv_buf_num_entries = 0;
|
||||
void * recv_buf = NULL;
|
||||
#if MPI_VERSION >= 3
|
||||
#if H5_CHECK_MPI_VERSION(3, 0)
|
||||
MPI_Count type_lb;
|
||||
MPI_Count type_extent;
|
||||
#else
|
||||
@ -645,7 +645,7 @@ H5_mpio_gatherv_alloc(void *send_buf, int send_count, MPI_Datatype send_type, co
|
||||
HDassert(out_buf && out_buf_num_entries);
|
||||
|
||||
/* Retrieve the extent of the MPI Datatype being used */
|
||||
#if MPI_VERSION >= 3
|
||||
#if H5_CHECK_MPI_VERSION(3, 0)
|
||||
if (MPI_SUCCESS != (mpi_code = MPI_Type_get_extent_x(recv_type, &type_lb, &type_extent)))
|
||||
#else
|
||||
if (MPI_SUCCESS != (mpi_code = MPI_Type_get_extent(recv_type, &type_lb, &type_extent)))
|
||||
|
@ -1739,6 +1739,15 @@ typedef struct H5_debug_t {
|
||||
} H5_debug_t;
|
||||
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
|
||||
/*
|
||||
* Check that the MPI library version is at least version
|
||||
* `mpi_version` and subversion `mpi_subversion`
|
||||
*/
|
||||
#define H5_CHECK_MPI_VERSION(mpi_version, mpi_subversion) \
|
||||
((MPI_VERSION > (mpi_version)) || \
|
||||
((MPI_VERSION == (mpi_version)) && (MPI_SUBVERSION >= (mpi_subversion))))
|
||||
|
||||
extern hbool_t H5_coll_api_sanity_check_g;
|
||||
#endif /* H5_HAVE_PARALLEL */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user