summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChee-Wai Lee <cwlee@ncsa.uiuc.edu>1999-12-10 22:38:25 (GMT)
committerChee-Wai Lee <cwlee@ncsa.uiuc.edu>1999-12-10 22:38:25 (GMT)
commitca73fde3ba444896894a56dda3dc9f79d06a7bcd (patch)
tree06804a23fbf5fbe96c9d79e1ffaf570dbbc0977c
parentf30439d5920626e9527817f9168d72ae1594208e (diff)
downloadhdf5-ca73fde3ba444896894a56dda3dc9f79d06a7bcd.zip
hdf5-ca73fde3ba444896894a56dda3dc9f79d06a7bcd.tar.gz
hdf5-ca73fde3ba444896894a56dda3dc9f79d06a7bcd.tar.bz2
[svn-r1873] added new test for multiple dataset writes to parallel tests
-rw-r--r--testpar/Makefile.in2
-rw-r--r--testpar/t_mdset.c58
-rw-r--r--testpar/testphdf5.c7
3 files changed, 65 insertions, 2 deletions
diff --git a/testpar/Makefile.in b/testpar/Makefile.in
index 936f821..cdffca2 100644
--- a/testpar/Makefile.in
+++ b/testpar/Makefile.in
@@ -25,7 +25,7 @@ MOSTLYCLEAN=ParaEg[123].h5f
DISTCLEAN=go
## Test source files
-TEST_SRC=testphdf5.c t_dset.c t_file.c t_mpi.c
+TEST_SRC=testphdf5.c t_dset.c t_file.c t_mpi.c t_mdset.c
TEST_OBJ=$(TEST_SRC:.c=.lo)
TEST_HDR=testphdf5.h
diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c
new file mode 100644
index 0000000..77354d6
--- /dev/null
+++ b/testpar/t_mdset.c
@@ -0,0 +1,58 @@
+#include <testphdf5.h>
+
+#define DIM 2
+#define SIZE 10
+#define NUMITEMS 500 /* 988 */
+
+void multiple_dset_write(char *filename)
+{
+ int i, j, nprocs, rank;
+ hid_t iof, plist, dataset, memspace, filespace;
+ hssize_t chunk_origin [DIM];
+ hsize_t chunk_dims [DIM], file_dims [DIM];
+ double outme [SIZE][SIZE];
+
+ MPI_Comm_rank (MPI_COMM_WORLD, &rank);
+ MPI_Comm_size (MPI_COMM_WORLD, &nprocs);
+
+ chunk_origin [0] = 0;
+ chunk_origin [1] = rank * (SIZE / nprocs);
+ chunk_dims [0] = SIZE;
+ chunk_dims [1] = SIZE / nprocs;
+
+ for (i = 0; i < DIM; i++)
+ file_dims [i] = SIZE;
+
+ for (i = 0; i < SIZE; i++)
+ for (j = 0; j < SIZE; j++)
+ outme [i][j] = rank;
+
+ plist = H5Pcreate (H5P_FILE_ACCESS);
+ H5Pset_fapl_mpio(plist, MPI_COMM_WORLD, MPI_INFO_NULL);
+ iof = H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, plist);
+ H5Pclose (plist);
+
+ memspace = H5Screate_simple (DIM, chunk_dims, NULL);
+ filespace = H5Screate_simple (DIM, file_dims, NULL);
+ H5Sselect_hyperslab (filespace, H5S_SELECT_SET, chunk_origin, NULL, chunk_dims
+, NULL);
+
+ for (i = 0; i < NUMITEMS; i++) {
+ char dname [100];
+
+ sprintf (dname, "dataset %d", i);
+ dataset = H5Dcreate (iof, dname, H5T_NATIVE_FLOAT, filespace, H5P_DEFAULT);
+ if (dataset < 0) {
+ fprintf (stderr, "proc %d: failed to create dataset %d\n", rank, i);
+ exit (-1);
+ }
+
+ H5Dwrite (dataset, H5T_NATIVE_DOUBLE, memspace, filespace, H5P_DEFAULT, outme);
+
+ H5Dclose (dataset);
+ }
+
+ H5Sclose (filespace);
+ H5Sclose (memspace);
+ H5Fclose (iof);
+}
diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c
index 9085f19..c21a90b 100644
--- a/testpar/testphdf5.c
+++ b/testpar/testphdf5.c
@@ -34,7 +34,8 @@ int doread=1; /* read test */
int dowrite=1; /* write test */
char *filenames[]={ "ParaEg1.h5f",
"ParaEg2.h5f",
- "ParaEg3.h5f" };
+ "ParaEg3.h5f",
+ "Mdset.h5f" };
@@ -252,6 +253,10 @@ main(int argc, char **argv)
MPI_BANNER("testing extendible dataset independent write...");
extend_writeInd(filenames[2]);
+
+ MPI_BANNER("testing multiple datasets write ...");
+ multiple_dset_write(filenames[3]);
+
}
if (doread){
MPI_BANNER("testing dataset independent read...");