summaryrefslogtreecommitdiffstats
path: root/src/H5Farray.c
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>1998-04-13 04:31:23 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>1998-04-13 04:31:23 (GMT)
commit33a49221fccc5adc7ec9c5a556be4f6cb72f4e34 (patch)
tree9eab81feeb1694e8700bcb2e282d4df673bc2dbd /src/H5Farray.c
parent1a7e4bcd6c61b8f89001b8de9946995e579e1e79 (diff)
downloadhdf5-33a49221fccc5adc7ec9c5a556be4f6cb72f4e34.zip
hdf5-33a49221fccc5adc7ec9c5a556be4f6cb72f4e34.tar.gz
hdf5-33a49221fccc5adc7ec9c5a556be4f6cb72f4e34.tar.bz2
[svn-r343] First implementation of collective access support.
H5D.c Changed H5D_write and H5D_read to recognize collective transfer requests. Current algorithm puts the xfer-mode in the file->mpio structure. Not thread safe. Need to revise it to pass transfer parameter as a function parameters to the lower levels. H5Dprivate.h H5Dpublic.h Added xfer_mode to the transfer property list structure. Added defination of transfer modes, H5D_XFER_INDEPENDENT and H5D_XFER_COLLECTIVE. H5Farray.c Added code to handle collective access requests. Currently works for one contiguous block at a time. Need to revise it with the MPIO low level calls to combine all blocks as one truely collective call. H5P.c H5Ppublic.h Added H5Pset_xfer and H5Pget_xfer routines that can set and get the transfer mode of a data transfer property list.
Diffstat (limited to 'src/H5Farray.c')
-rw-r--r--src/H5Farray.c77
1 files changed, 77 insertions, 0 deletions
diff --git a/src/H5Farray.c b/src/H5Farray.c
index 138a20f..76f09d8 100644
--- a/src/H5Farray.c
+++ b/src/H5Farray.c
@@ -130,6 +130,9 @@ H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout,
haddr_t addr; /*address in file */
intn i, j; /*counters */
hbool_t carray; /*carry for subtraction */
+#ifdef HAVE_PARALLEL
+ intn is_collective; /*collective access flag*/
+#endif
FUNC_ENTER (H5F_arr_read, FAIL);
@@ -145,6 +148,19 @@ H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout,
/* Make a local copy of size so we can modify it */
H5V_vector_cpy (layout->ndims, hslab_size, _hslab_size);
+#ifdef HAVE_PARALLEL
+ is_collective = (f->shared->access_parms.driver==H5F_LOW_MPIO
+ && f->shared->access_parms.u.mpio.access_mode==H5ACC_COLLECTIVE);
+ if (is_collective){
+#ifdef AKC
+ printf("%s: collective read requested\n", FUNC);
+#endif
+ if (layout->type != H5D_CONTIGUOUS)
+ HRETURN_ERROR (H5E_DATASET, H5E_READERROR, FAIL,
+ "collective access on non-contiguous datasets not supported yet");
+ }
+#endif
+
switch (layout->type) {
case H5D_CONTIGUOUS:
ndims = layout->ndims;
@@ -190,6 +206,29 @@ H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout,
* Now begin to walk through the array, copying data from disk to
* memory.
*/
+#ifdef HAVE_PARALLEL
+ if (is_collective){
+ /* Currently supports same number of collective access.
+ * Need to be changed LATER to combine all reads into one
+ * collective MPIO call.
+ */
+ long max, min, temp;
+
+ temp = nelmts;
+ assert(temp==nelmts); /* verify no overflow */
+ MPI_Allreduce(&temp, &max, 1, MPI_LONG, MPI_MAX,
+ f->shared->access_parms.u.mpio.comm);
+ MPI_Allreduce(&temp, &min, 1, MPI_LONG, MPI_MIN,
+ f->shared->access_parms.u.mpio.comm);
+#ifdef AKC
+printf("nelmnts=%ld, min=%ld, max=%ld\n", temp, min, max);
+#endif
+ if (max != min)
+ HRETURN_ERROR(H5E_DATASET, H5E_READERROR, FAIL,
+ "collective access with unequal number of blocks not supported yet");
+ }
+#endif
+
for (z=0; z<nelmts; z++) {
/* Read from file */
@@ -291,6 +330,9 @@ H5F_arr_write (H5F_t *f, const struct H5O_layout_t *layout,
haddr_t addr; /*address in file */
intn i, j; /*counters */
hbool_t carray; /*carry for subtraction */
+#ifdef HAVE_PARALLEL
+ intn is_collective; /*collective access flag*/
+#endif
FUNC_ENTER (H5F_arr_write, FAIL);
@@ -306,6 +348,18 @@ H5F_arr_write (H5F_t *f, const struct H5O_layout_t *layout,
/* Make a local copy of _size so we can modify it */
H5V_vector_cpy (layout->ndims, hslab_size, _hslab_size);
+#ifdef HAVE_PARALLEL
+ is_collective = (f->shared->access_parms.driver==H5F_LOW_MPIO
+ && f->shared->access_parms.u.mpio.access_mode==H5ACC_COLLECTIVE);
+ if (is_collective){
+#ifdef AKC
+ printf("%s: collective write requested\n", FUNC);
+#endif
+ if (layout->type != H5D_CONTIGUOUS)
+ HRETURN_ERROR (H5E_DATASET, H5E_WRITEERROR, FAIL,
+ "collective access on non-contiguous datasets not supported yet");
+ }
+#endif
switch (layout->type) {
case H5D_CONTIGUOUS:
@@ -352,6 +406,29 @@ H5F_arr_write (H5F_t *f, const struct H5O_layout_t *layout,
* Now begin to walk through the array, copying data from memory to
* disk.
*/
+#ifdef HAVE_PARALLEL
+ if (is_collective){
+ /* Currently supports same number of collective access.
+ * Need to be changed LATER to combine all writes into one
+ * collective MPIO call.
+ */
+ long max, min, temp;
+
+ temp = nelmts;
+ assert(temp==nelmts); /* verify no overflow */
+ MPI_Allreduce(&temp, &max, 1, MPI_LONG, MPI_MAX,
+ f->shared->access_parms.u.mpio.comm);
+ MPI_Allreduce(&temp, &min, 1, MPI_LONG, MPI_MIN,
+ f->shared->access_parms.u.mpio.comm);
+#ifdef AKC
+printf("nelmnts=%ld, min=%ld, max=%ld\n", temp, min, max);
+#endif
+ if (max != min)
+ HRETURN_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL,
+ "collective access with unequal number of blocks not supported yet");
+ }
+#endif
+
for (z=0; z<nelmts; z++) {
/* Write to file */