diff options
Diffstat (limited to 'src/H5private.h')
-rw-r--r-- | src/H5private.h | 119 |
1 files changed, 64 insertions, 55 deletions
diff --git a/src/H5private.h b/src/H5private.h index 765e7b6..d98d76d 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -44,10 +44,12 @@ #include <sys/time.h> #endif #ifdef H5_HAVE_UNISTD_H +#include <unistd.h> +#endif #ifdef H5_HAVE_PWD_H #include <pwd.h> #endif -#include <unistd.h> +#ifdef H5_HAVE_WAITPID #include <sys/wait.h> #endif @@ -170,7 +172,7 @@ */ #define BEGIN_MPE_LOG \ if (H5_MPEinit_g) { \ - sprintf(p_event_start, "start %s", __func__); \ + snprintf(p_event_start, sizeof(p_event_start), "start %s", __func__); \ if (eventa(__func__) == -1 && eventb(__func__) == -1) { \ const char *p_color = "red"; \ eventa(__func__) = MPE_Log_get_event_number(); \ @@ -385,6 +387,25 @@ #define HSSIZET_MAX ((hssize_t)LLONG_MAX) #define HSSIZET_MIN (~(HSSIZET_MAX)) +#ifdef H5_HAVE_PARALLEL + +/* Define a type for safely sending size_t values with MPI */ +#if SIZE_MAX == UCHAR_MAX +#define H5_SIZE_T_AS_MPI_TYPE MPI_UNSIGNED_CHAR +#elif SIZE_MAX == USHRT_MAX +#define H5_SIZE_T_AS_MPI_TYPE MPI_UNSIGNED_SHORT +#elif SIZE_MAX == UINT_MAX +#define H5_SIZE_T_AS_MPI_TYPE MPI_UNSIGNED +#elif SIZE_MAX == ULONG_MAX +#define H5_SIZE_T_AS_MPI_TYPE MPI_UNSIGNED_LONG +#elif SIZE_MAX == ULLONG_MAX +#define H5_SIZE_T_AS_MPI_TYPE MPI_UNSIGNED_LONG_LONG +#else +#error "no suitable MPI type for size_t" +#endif + +#endif /* H5_HAVE_PARALLEL */ + /* * Types and max sizes for POSIX I/O. * OS X (Darwin) is odd since the max I/O size does not match the types. @@ -506,6 +527,9 @@ #define H5_GCC_CLANG_DIAG_ON(x) #endif +/* Function pointer typedef for qsort */ +typedef int (*H5_sort_func_cb_t)(const void *, const void *); + /* Typedefs and functions for timing certain parts of the library. */ /* A set of elapsed/user/system times emitted as a time point by the @@ -574,7 +598,7 @@ typedef off_t h5_stat_size_t; #define HDoff_t off_t #endif -#/* Redefine all the POSIX and C functions. We should never see an +/* Redefine all the POSIX and C functions. We should never see an * undecorated POSIX or C function (or any other non-HDF5 function) * in the source. */ @@ -1130,57 +1154,6 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDprintf #define HDprintf printf /*varargs*/ #endif -#ifndef HDpthread_attr_destroy -#define HDpthread_attr_destroy(A) pthread_attr_destroy(A) -#endif -#ifndef HDpthread_attr_init -#define HDpthread_attr_init(A) pthread_attr_init(A) -#endif -#ifndef HDpthread_attr_setscope -#define HDpthread_attr_setscope(A, S) pthread_attr_setscope(A, S) -#endif -#ifndef HDpthread_cond_init -#define HDpthread_cond_init(C, A) pthread_cond_init(C, A) -#endif -#ifndef HDpthread_cond_signal -#define HDpthread_cond_signal(C) pthread_cond_signal(C) -#endif -#ifndef HDpthread_cond_wait -#define HDpthread_cond_wait(C, M) pthread_cond_wait(C, M) -#endif -#ifndef HDpthread_create -#define HDpthread_create(R, A, F, U) pthread_create(R, A, F, U) -#endif -#ifndef HDpthread_equal -#define HDpthread_equal(T1, T2) pthread_equal(T1, T2) -#endif -#ifndef HDpthread_getspecific -#define HDpthread_getspecific(K) pthread_getspecific(K) -#endif -#ifndef HDpthread_join -#define HDpthread_join(T, V) pthread_join(T, V) -#endif -#ifndef HDpthread_key_create -#define HDpthread_key_create(K, D) pthread_key_create(K, D) -#endif -#ifndef HDpthread_mutex_init -#define HDpthread_mutex_init(M, A) pthread_mutex_init(M, A) -#endif -#ifndef HDpthread_mutex_lock -#define HDpthread_mutex_lock(M) pthread_mutex_lock(M) -#endif -#ifndef HDpthread_mutex_unlock -#define HDpthread_mutex_unlock(M) pthread_mutex_unlock(M) -#endif -#ifndef HDpthread_self -#define HDpthread_self() pthread_self() -#endif -#ifndef HDpthread_setcancelstate -#define HDpthread_setcancelstate(N, O) pthread_setcancelstate(N, O) -#endif -#ifndef HDpthread_setspecific -#define HDpthread_setspecific(K, V) pthread_setspecific(K, V) -#endif #ifndef HDputc #define HDputc(C, F) putc(C, F) #endif @@ -1766,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 */ @@ -2006,6 +1988,14 @@ extern hbool_t H5_libterm_g; /* Is the library being shutdown? */ #endif /* H5_HAVE_THREADSAFE */ +/* Extern global to determine if we should use selection I/O if available (this + * variable should be removed once selection I/O performs as well as the + * previous scalar I/O implementation + * + * NOTE: Must be exposed via H5_DLLVAR so parallel tests pass on Windows. + */ +H5_DLLVAR hbool_t H5_use_selection_io_g; + #ifdef H5_HAVE_CODESTACK /* Include required function stack header */ @@ -2500,6 +2490,16 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); #define HDcompile_assert(e) do { typedef struct { unsigned int b: (e); } x; } while(0) */ +/* Private typedefs */ + +/* Union for const/non-const pointer for use by functions that manipulate + * pointers but do not write to their targets or return pointers to const + * specified locations. This helps us avoid compiler warnings. */ +typedef union { + void * vp; + const void *cvp; +} H5_flexible_const_ptr_t; + /* Private functions, not part of the publicly documented API */ H5_DLL herr_t H5_init_library(void); H5_DLL void H5_term_library(void); @@ -2600,7 +2600,8 @@ struct h5_long_options { */ }; -H5_DLL int H5_get_option(int argc, const char **argv, const char *opt, const struct h5_long_options *l_opt); +H5_DLL int H5_get_option(int argc, const char *const *argv, const char *opt, + const struct h5_long_options *l_opt); #ifdef H5_HAVE_PARALLEL /* Generic MPI functions */ @@ -2614,6 +2615,14 @@ H5_DLL herr_t H5_mpi_comm_cmp(MPI_Comm comm1, MPI_Comm comm2, int *result); H5_DLL herr_t H5_mpi_info_cmp(MPI_Info info1, MPI_Info info2, int *result); H5_DLL herr_t H5_mpio_create_large_type(hsize_t num_elements, MPI_Aint stride_bytes, MPI_Datatype old_type, MPI_Datatype *new_type); +H5_DLL herr_t H5_mpio_gatherv_alloc(void *send_buf, int send_count, MPI_Datatype send_type, + const int recv_counts[], const int displacements[], + MPI_Datatype recv_type, hbool_t allgather, int root, MPI_Comm comm, + int mpi_rank, int mpi_size, void **out_buf, size_t *out_buf_num_entries); +H5_DLL herr_t H5_mpio_gatherv_alloc_simple(void *send_buf, int send_count, MPI_Datatype send_type, + MPI_Datatype recv_type, hbool_t allgather, int root, MPI_Comm comm, + int mpi_rank, int mpi_size, void **out_buf, + size_t *out_buf_num_entries); #endif /* H5_HAVE_PARALLEL */ /* Functions for debugging */ |