src/h5core

- h5priv_start_throttle() and h5priv_end_throttle() are now inline
  functions, whereby the serial version is just a dummy
This commit is contained in:
2015-09-11 14:41:52 +02:00
parent 3d8ce28609
commit 03531ab4af
7 changed files with 75 additions and 116 deletions
-63
View File
@@ -157,66 +157,3 @@ h5priv_normalize_dataset_name (
H5_CORE_API_RETURN (H5_SUCCESS);
}
#ifdef PARALLEL_IO
h5_err_t
h5priv_start_throttle (
const h5_file_p f
) {
H5_CORE_API_ENTER (h5_err_t, "f=%p", f);
if (f->props->throttle > 0) {
// throttle only if VFD is MPIO independent od POSIX
h5_int64_t mask = H5_VFD_MPIO_INDEPENDENT;
#if H5_VERSION_LE(1,8,12)
mask |= H5_VFD_MPIO_POSIX;
#endif
if (! (f->props->flags & mask)) {
h5_warn (
"Throttling is only permitted with the MPI-POSIX "
"or MPI-IO Independent VFD." );
H5_CORE_API_LEAVE (H5_SUCCESS);
}
int token = 1;
h5_info (
"Throttling with factor = %lld",
(long long int)f->props->throttle);
if (f->myproc / f->props->throttle > 0) {
h5_debug (
"throttle: waiting on token from %lld",
(long long int)(f->myproc - f->props->throttle));
// wait to receive token before continuing with read
TRY( h5priv_mpi_recv(
&token, 1, MPI_INT,
f->myproc - f->props->throttle, // receive from previous proc
f->myproc, // use this proc id as message tag
f->props->comm
) );
}
h5_debug ("throttle: received token");
}
H5_CORE_API_RETURN (H5_SUCCESS);
}
h5_err_t
h5priv_end_throttle (
const h5_file_p f
) {
H5_PRIV_API_ENTER (h5_err_t, "f=%p", f);
if (f->props->throttle > 0) {
int token;
if (f->myproc + f->props->throttle < f->nprocs) {
// pass token to next proc
h5_debug (
"throttle: passing token to %lld",
(long long int)(f->myproc + f->props->throttle));
TRY (h5priv_mpi_send(
&token, 1, MPI_INT,
f->myproc + f->props->throttle, // send to next proc
f->myproc + f->props->throttle, // use the id of the target as tag
f->props->comm
));
}
}
H5_PRIV_API_RETURN (H5_SUCCESS);
}
#endif // PARALLEL_IO
+75 -5
View File
@@ -26,15 +26,85 @@
#include "h5core/h5_types.h"
#include "h5core/h5_model.h"
#include "h5_mpi_private.h"
h5_err_t
#ifdef PARALLEL_IO
static inline h5_err_t
h5priv_start_throttle (
const h5_file_p);
const h5_file_p f
) {
H5_CORE_API_ENTER (h5_err_t, "f=%p", f);
if (f->props->throttle > 0) {
// throttle only if VFD is MPIO independent
h5_int64_t mask = H5_VFD_MPIO_INDEPENDENT;
#if H5_VERSION_LE(1,8,12)
// or MPI POSIX - which has been removed in newer versions of hdf5
mask |= H5_VFD_MPIO_POSIX;
#endif
if (! (f->props->flags & mask)) {
h5_warn (
"Throttling is only permitted with the MPI-POSIX "
"or MPI-IO Independent VFD." );
H5_CORE_API_LEAVE (H5_SUCCESS);
}
h5_err_t
int token = 1;
h5_info (
"Throttling with factor = %lld",
(long long int)f->props->throttle);
if (f->myproc / f->props->throttle > 0) {
h5_debug (
"throttle: waiting on token from %lld",
(long long int)(f->myproc - f->props->throttle));
// wait to receive token before continuing with read
TRY( h5priv_mpi_recv(
&token, 1, MPI_INT,
f->myproc - f->props->throttle, // receive from previous proc
f->myproc, // use this proc id as message tag
f->props->comm
) );
}
h5_debug ("throttle: received token");
}
H5_CORE_API_RETURN (H5_SUCCESS);
}
static inline h5_err_t
h5priv_end_throttle (
const h5_file_p);
const h5_file_p f
) {
H5_PRIV_API_ENTER (h5_err_t, "f=%p", f);
if (f->props->throttle > 0) {
int token;
if (f->myproc + f->props->throttle < f->nprocs) {
// pass token to next proc
h5_debug (
"throttle: passing token to %lld",
(long long int)(f->myproc + f->props->throttle));
TRY (h5priv_mpi_send(
&token, 1, MPI_INT,
f->myproc + f->props->throttle, // send to next proc
f->myproc + f->props->throttle, // use the id of the target as tag
f->props->comm
));
}
}
H5_PRIV_API_RETURN (H5_SUCCESS);
}
#else // PARALLEL_IO
static inline h5_err_t
h5priv_start_throttle (const h5_file_p f) {
UNUSED_ARGUMENT (f);
return H5_SUCCESS;
}
static inline
h5priv_end_throttle (const h5_file_p f)
UNUSED_ARGUMENT (f);
return H5_SUCCESS;
}
#endif // PARALLEL_IO
h5_err_t
h5priv_close_step (
-9
View File
@@ -80,9 +80,7 @@ h5priv_write_dataset_by_name (
}
TRY (memspace_id = (*set_memspace)(m, 0));
TRY (diskspace_id = (*set_diskspace)(m, dataspace_id));
#ifdef PARALLEL_IO
TRY (h5priv_start_throttle (f));
#endif
TRY (hdf5_write_dataset (
dset_id,
dsinfo->type_id,
@@ -90,9 +88,7 @@ h5priv_write_dataset_by_name (
diskspace_id,
f->props->xfer_prop,
data));
#ifdef PARALLEL_IO
TRY (h5priv_end_throttle (f));
#endif
TRY (hdf5_close_dataspace (diskspace_id));
TRY (hdf5_close_dataspace (memspace_id));
TRY (hdf5_close_dataset (dset_id));
@@ -138,9 +134,7 @@ h5priv_write_dataset_by_name_id (
H5_PRIV_API_LEAVE (h5priv_handle_file_mode_error(f->props->flags));
}
#ifdef PARALLEL_IO
TRY (h5priv_start_throttle (f));
#endif
TRY (hdf5_write_dataset (
dset_id,
dsinfo->type_id,
@@ -148,10 +142,7 @@ h5priv_write_dataset_by_name_id (
diskspace_id,
f->props->xfer_prop,
data));
#ifdef PARALLEL_IO
TRY (h5priv_end_throttle (f));
#endif
H5_PRIV_API_RETURN (H5_SUCCESS);
}
-8
View File
@@ -228,9 +228,7 @@ _write_data (
b->shape,
b->dcreate_prop));
}
#ifdef PARALLEL_IO
TRY (h5priv_start_throttle (f));
#endif
TRY (hdf5_write_dataset(
dataset,
type,
@@ -238,9 +236,7 @@ _write_data (
b->diskshape,
f->props->xfer_prop,
data));
#ifdef PARALLEL_IO
TRY (h5priv_end_throttle (f));
#endif
TRY (hdf5_close_dataset (dataset));
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
@@ -391,9 +387,7 @@ read_data (
TRY (dataset = hdf5_open_dataset (b->field_gid, dataset_name));
TRY (_select_hyperslab_for_reading (f, dataset) );
#ifdef PARALLEL_IO
TRY (h5priv_start_throttle (f));
#endif
TRY (hdf5_read_dataset(
dataset,
type,
@@ -401,9 +395,7 @@ read_data (
f->b->diskshape,
f->props->xfer_prop,
data));
#ifdef PARALLEL_IO
TRY (h5priv_end_throttle (f));
#endif
TRY (hdf5_close_dataset(dataset));
H5_PRIV_FUNC_RETURN (H5_SUCCESS);
-19
View File
@@ -479,10 +479,7 @@ write_vertices_chk (
}
TRY (h5priv_mpi_barrier (m->f->props->comm));
m->timing.measure[m->timing.next_time++] = MPI_Wtime();
#if defined(WITH_PARALLEL_H5FED)
TRY (h5priv_start_throttle (m->f));
#endif
TRY( h5priv_write_dataset_by_name_id (
m->f,
@@ -516,9 +513,7 @@ write_vertices_chk (
m->num_leaf_levels,
1));
#if defined(WITH_PARALLEL_H5FED)
TRY (h5priv_end_throttle (m->f));
#endif
TRY (hdf5_close_dataspace (dspace_id));
TRY (hdf5_close_dataspace (mspace_id));
TRY (hdf5_close_dataset (dset_id));
@@ -1135,10 +1130,7 @@ read_vertices (
TRY (h5tpriv_alloc_loc_vertices (m, num_vertices));
}
#if defined(WITH_PARALLEL_H5FED)
TRY (h5priv_start_throttle (m->f));
#endif
TRY (hdf5_read_dataset (
dset_id,
m->dsinfo_vertices.type_id,
@@ -1146,9 +1138,7 @@ read_vertices (
dspace_id,
m->f->props->xfer_prop,
m->vertices));
#if defined(WITH_PARALLEL_H5FED)
TRY (h5priv_end_throttle (m->f));
#endif
TRY (hdf5_close_dataspace (dspace_id));
TRY (hdf5_close_dataspace (mspace_id));
TRY (hdf5_close_dataset (dset_id));
@@ -1183,10 +1173,7 @@ read_elems (
&hstart, &hstride, &hcount,
NULL));
#ifdef PARALLEL_IO
TRY (h5priv_start_throttle (m->f));
#endif
TRY (hdf5_read_dataset (
dset_id,
m->dsinfo_elems.type_id,
@@ -1194,9 +1181,7 @@ read_elems (
dspace_id,
m->f->props->xfer_prop,
glb_elems));
#ifdef PARALLEL_IO
TRY (h5priv_end_throttle (m->f));
#endif
TRY (hdf5_close_dataspace (dspace_id));
TRY (hdf5_close_dataspace (mspace_id));
@@ -2620,9 +2605,7 @@ read_chunked_elements (
seloper = H5S_SELECT_OR;
}
#ifdef PARALLEL_IO
TRY (h5priv_start_throttle (m->f));
#endif
TRY (hdf5_read_dataset (
dset_id,
m->dsinfo_elems.type_id,
@@ -2630,9 +2613,7 @@ read_chunked_elements (
dspace_id,
m->f->props->xfer_prop,
*glb_elems));
#ifdef PARALLEL_IO
TRY (h5priv_end_throttle (m->f));
#endif
TRY (hdf5_close_dataspace (dspace_id));
TRY (hdf5_close_dataspace (mspace_id));
TRY (hdf5_close_dataset (dset_id));
-4
View File
@@ -49,9 +49,7 @@ read_dataset (
TRY (mspace_id = (*set_mspace)(m, dset_id));
TRY (dspace_id = (*set_dspace)(m, dset_id));
#ifdef PARALLEL_IO
TRY (h5priv_start_throttle (f));
#endif
TRY (hdf5_read_dataset (
dset_id,
dsinfo->type_id,
@@ -59,9 +57,7 @@ read_dataset (
dspace_id,
f->props->xfer_prop,
data));
#ifdef PARALLEL_IO
TRY (h5priv_end_throttle (f));
#endif
TRY (hdf5_close_dataspace (dspace_id));
TRY (hdf5_close_dataspace (mspace_id));
-8
View File
@@ -154,9 +154,7 @@ h5u_read_data (
memspace_id = H5S_ALL;
}
}
#ifdef PARALLEL_IO
TRY (h5priv_start_throttle (f));
#endif
TRY (hdf5_read_dataset (
dataset_id,
type,
@@ -164,9 +162,7 @@ h5u_read_data (
space_id,
f->props->xfer_prop,
data ));
#ifdef PARALLEL_IO
TRY (h5priv_end_throttle (f));
#endif
if (space_id != f->u->diskshape) {
TRY (hdf5_close_dataspace (space_id));
}
@@ -215,9 +211,7 @@ h5u_write_data (
H5P_DEFAULT));
}
#ifdef PARALLEL_IO
TRY (h5priv_start_throttle (f));
#endif
h5_info ("Writing dataset %s/%s.",
hdf5_get_objname(f->step_gid), name2);
TRY (hdf5_write_dataset (
@@ -227,9 +221,7 @@ h5u_write_data (
u->diskshape,
f->props->xfer_prop,
data));
#ifdef PARALLEL_IO
TRY (h5priv_end_throttle (f));
#endif
if (f->props->flags & H5_FLUSH_STEP)
TRY (hdf5_flush (f->step_gid, H5F_SCOPE_LOCAL));