summaryrefslogtreecommitdiffstats
path: root/testpar
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2000-11-17 20:16:09 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2000-11-17 20:16:09 (GMT)
commit4fb1bc1319aa1cf6f1f814481b76cdbb58177849 (patch)
treebbd6ec673ec79549fc74d3e5c4c22f334e55c328 /testpar
parent2bc81f8736c26a40451f1915cb83f830b3781cd2 (diff)
downloadhdf5-4fb1bc1319aa1cf6f1f814481b76cdbb58177849.zip
hdf5-4fb1bc1319aa1cf6f1f814481b76cdbb58177849.tar.gz
hdf5-4fb1bc1319aa1cf6f1f814481b76cdbb58177849.tar.bz2
[svn-r2973] Purpose:
Bug fix, cleanup,... Description: The test was doing the hyperslab select incorrectly (thinking count was the block length. Solution: Fixed it to do the correct hyperslab selection. Changed it to calculate different data for different datasets. Changed output by rows instead by cols. It tests the purpose of creating multiple datasets the same but runs faster. Platforms tested: modi4-64.
Diffstat (limited to 'testpar')
-rw-r--r--testpar/t_mdset.c81
1 files changed, 41 insertions, 40 deletions
diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c
index 3fd3bdb..86f393e 100644
--- a/testpar/t_mdset.c
+++ b/testpar/t_mdset.c
@@ -2,60 +2,61 @@
#define DIM 2
#define SIZE 32
-#define NUMITEMS 500 /* 988 */
+#define NUMITEMS 300
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];
+ int i, j, n, nprocs, rank;
+ hid_t iof, plist, dataset, memspace, filespace;
+ hssize_t chunk_origin [DIM];
+ hsize_t chunk_dims [DIM], file_dims [DIM];
+ hsize_t count[DIM]={1,1};
+ double outme [SIZE][SIZE];
+ char dname [100];
- MPI_Comm_rank (MPI_COMM_WORLD, &rank);
- MPI_Comm_size (MPI_COMM_WORLD, &nprocs);
- VRFY((nprocs <= SIZE), "nprocs <= 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;
+ VRFY((nprocs <= SIZE), "nprocs <= SIZE");
- for (i = 0; i < DIM; i++)
- file_dims [i] = SIZE;
+ chunk_origin [0] = rank * (SIZE / nprocs);
+ chunk_origin [1] = 0;
+ chunk_dims [0] = SIZE / nprocs;
+ chunk_dims [1] = SIZE;
- for (i = 0; i < SIZE; i++)
- for (j = 0; j < SIZE; j++)
- outme [i][j] = rank;
+ for (i = 0; i < DIM; i++)
+ file_dims [i] = SIZE;
- 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);
+ 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);
+ memspace = H5Screate_simple (DIM, chunk_dims, NULL);
+ filespace = H5Screate_simple (DIM, file_dims, NULL);
+ H5Sselect_hyperslab (filespace, H5S_SELECT_SET, chunk_origin, chunk_dims, count, chunk_dims);
- for (i = 0; i < NUMITEMS; i++) {
- char dname [100];
+ for (n = 0; n < NUMITEMS; n++) {
+ sprintf (dname, "dataset %d", n);
+ dataset = H5Dcreate (iof, dname, H5T_NATIVE_FLOAT, filespace, H5P_DEFAULT);
+ VRFY((dataset > 0), "dataset create succeeded");
- sprintf (dname, "dataset %d", i);
- dataset = H5Dcreate (iof, dname, H5T_NATIVE_FLOAT, filespace, H5P_DEFAULT);
- VRFY((dataset > 0), "dataset create succeeded");
+ /* calculate data to write */
+ for (i = 0; i < SIZE; i++)
+ for (j = 0; j < SIZE; j++)
+ outme [i][j] = n*1000 + rank;
- H5Dwrite (dataset, H5T_NATIVE_DOUBLE, memspace, filespace, H5P_DEFAULT, outme);
+ H5Dwrite (dataset, H5T_NATIVE_DOUBLE, memspace, filespace, H5P_DEFAULT, outme);
- H5Dclose (dataset);
- if (! ((i+1) % 10)) {
- printf("created %d datasets\n", i+1);
- MPI_Barrier(MPI_COMM_WORLD);
+ H5Dclose (dataset);
+ if (! ((n+1) % 10)) {
+ printf("created %d datasets\n", n+1);
+ }
+ MPI_Barrier(MPI_COMM_WORLD);
}
-}
- H5Sclose (filespace);
- H5Sclose (memspace);
- H5Fclose (iof);
+ H5Sclose (filespace);
+ H5Sclose (memspace);
+ H5Fclose (iof);
}