summaryrefslogtreecommitdiffstats
path: root/testpar
diff options
context:
space:
mode:
Diffstat (limited to 'testpar')
-rw-r--r--testpar/Makefile.in2
-rw-r--r--testpar/t_dset.c226
-rw-r--r--testpar/t_file.c144
-rw-r--r--testpar/t_mpi.c135
-rw-r--r--testpar/testphdf5.c8
5 files changed, 258 insertions, 257 deletions
diff --git a/testpar/Makefile.in b/testpar/Makefile.in
index dcab8f1..e6cb86a 100644
--- a/testpar/Makefile.in
+++ b/testpar/Makefile.in
@@ -22,7 +22,7 @@ MOSTLYCLEAN=ParaEg[123].h5f
DISTCLEAN=go
# Test source files
-TEST_SRC=testphdf5.c t_dset.c t_file.c
+TEST_SRC=testphdf5.c t_dset.c t_file.c t_mpi.c
TEST_OBJ=$(TEST_SRC:.c=.o)
PRIVATE_HDR=testphdf5.h
diff --git a/testpar/t_dset.c b/testpar/t_dset.c
index b818103..c71ec79 100644
--- a/testpar/t_dset.c
+++ b/testpar/t_dset.c
@@ -214,18 +214,18 @@ dataset_writeInd(char *filename)
* ---------------------------------------*/
/* setup file access template with parallel IO access. */
acc_tpl = H5Pcreate (H5P_FILE_ACCESS);
- VRFY((acc_tpl != FAIL), "H5Pcreate access succeeded");
+ VRFY((acc_tpl >= 0), "H5Pcreate access succeeded");
/* set Parallel access with communicator */
ret = H5Pset_mpi(acc_tpl, comm, info);
- VRFY((ret != FAIL), "H5Pset_mpi succeeded");
+ VRFY((ret >= 0), "H5Pset_mpi succeeded");
/* create the file collectively */
fid=H5Fcreate(filename,H5F_ACC_TRUNC,H5P_DEFAULT,acc_tpl);
- VRFY((fid != FAIL), "H5Fcreate succeeded");
+ VRFY((fid >= 0), "H5Fcreate succeeded");
/* Release file-access template */
ret=H5Pclose(acc_tpl);
- VRFY((ret != FAIL), "");
+ VRFY((ret >= 0), "");
/* ---------------------------------------------
@@ -234,18 +234,18 @@ dataset_writeInd(char *filename)
* ------------------------------------------- */
/* setup dimensionality object */
sid = H5Screate_simple (RANK, dims, NULL);
- VRFY((sid != FAIL), "H5Screate_simple succeeded");
+ VRFY((sid >= 0), "H5Screate_simple succeeded");
/* create a dataset collectively */
dataset1 = H5Dcreate(fid, DATASETNAME1, H5T_NATIVE_INT, sid,
H5P_DEFAULT);
- VRFY((dataset1 != FAIL), "H5Dcreate succeeded");
+ VRFY((dataset1 >= 0), "H5Dcreate succeeded");
/* create another dataset collectively */
dataset2 = H5Dcreate(fid, DATASETNAME2, H5T_NATIVE_INT, sid,
H5P_DEFAULT);
- VRFY((dataset2 != FAIL), "H5Dcreate succeeded");
+ VRFY((dataset2 >= 0), "H5Dcreate succeeded");
/*
@@ -263,31 +263,31 @@ dataset_writeInd(char *filename)
/* create a file dataspace independently */
file_dataspace = H5Dget_space (dataset1);
- VRFY((file_dataspace != FAIL), "H5Dget_space succeeded");
+ VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, NULL);
- VRFY((ret != FAIL), "H5Sset_hyperslab succeeded");
+ VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* create a memory dataspace independently */
mem_dataspace = H5Screate_simple (RANK, count, NULL);
- VRFY((mem_dataspace != FAIL), "");
+ VRFY((mem_dataspace >= 0), "");
/* write data independently */
ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
H5P_DEFAULT, data_array1);
- VRFY((ret != FAIL), "H5Dwrite dataset1 succeeded");
+ VRFY((ret >= 0), "H5Dwrite dataset1 succeeded");
/* write data independently */
ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
H5P_DEFAULT, data_array1);
- VRFY((ret != FAIL), "H5Dwrite dataset2 succeeded");
+ VRFY((ret >= 0), "H5Dwrite dataset2 succeeded");
/* release dataspace ID */
H5Sclose(file_dataspace);
/* close dataset collectively */
ret=H5Dclose(dataset1);
- VRFY((ret != FAIL), "H5Dclose1 succeeded");
+ VRFY((ret >= 0), "H5Dclose1 succeeded");
ret=H5Dclose(dataset2);
- VRFY((ret != FAIL), "H5Dclose2 succeeded");
+ VRFY((ret >= 0), "H5Dclose2 succeeded");
/* release all IDs created */
H5Sclose(sid);
@@ -330,27 +330,27 @@ dataset_readInd(char *filename)
/* setup file access template */
acc_tpl = H5Pcreate (H5P_FILE_ACCESS);
- VRFY((acc_tpl != FAIL), "");
+ VRFY((acc_tpl >= 0), "");
/* set Parallel access with communicator */
ret = H5Pset_mpi(acc_tpl, comm, info);
- VRFY((ret != FAIL), "");
+ VRFY((ret >= 0), "");
/* open the file collectively */
fid=H5Fopen(filename,H5F_ACC_RDONLY,acc_tpl);
- VRFY((fid != FAIL), "");
+ VRFY((fid >= 0), "");
/* Release file-access template */
ret=H5Pclose(acc_tpl);
- VRFY((ret != FAIL), "");
+ VRFY((ret >= 0), "");
/* open the dataset1 collectively */
dataset1 = H5Dopen(fid, DATASETNAME1);
- VRFY((dataset1 != FAIL), "");
+ VRFY((dataset1 >= 0), "");
/* open another dataset collectively */
dataset2 = H5Dopen(fid, DATASETNAME1);
- VRFY((dataset2 != FAIL), "");
+ VRFY((dataset2 >= 0), "");
/* set up dimensions of the slab this process accesses */
@@ -358,13 +358,13 @@ dataset_readInd(char *filename)
/* create a file dataspace independently */
file_dataspace = H5Dget_space (dataset1);
- VRFY((file_dataspace != FAIL), "");
+ VRFY((file_dataspace >= 0), "");
ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, NULL);
- VRFY((ret != FAIL), "");
+ VRFY((ret >= 0), "");
/* create a memory dataspace independently */
mem_dataspace = H5Screate_simple (RANK, count, NULL);
- VRFY((mem_dataspace != FAIL), "");
+ VRFY((mem_dataspace >= 0), "");
/* fill dataset with test data */
dataset_fill(start, count, stride, &data_origin1[0][0]);
@@ -372,7 +372,7 @@ dataset_readInd(char *filename)
/* read data independently */
ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
H5P_DEFAULT, data_array1);
- VRFY((ret != FAIL), "");
+ VRFY((ret >= 0), "");
/* verify the read data with original expected data */
ret = dataset_vrfy(start, count, stride, &data_array1[0][0], &data_origin1[0][0]);
@@ -381,7 +381,7 @@ dataset_readInd(char *filename)
/* read data independently */
ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
H5P_DEFAULT, data_array1);
- VRFY((ret != FAIL), "");
+ VRFY((ret >= 0), "");
/* verify the read data with original expected data */
ret = dataset_vrfy(start, count, stride, &data_array1[0][0], &data_origin1[0][0]);
@@ -389,9 +389,9 @@ dataset_readInd(char *filename)
/* close dataset collectively */
ret=H5Dclose(dataset1);
- VRFY((ret != FAIL), "");
+ VRFY((ret >= 0), "");
ret=H5Dclose(dataset2);
- VRFY((ret != FAIL), "");
+ VRFY((ret >= 0), "");
/* release all IDs created */
H5Sclose(file_dataspace);
@@ -449,18 +449,18 @@ dataset_writeAll(char *filename)
* -------------------*/
/* setup file access template with parallel IO access. */
acc_tpl = H5Pcreate (H5P_FILE_ACCESS);
- VRFY((acc_tpl != FAIL), "H5Pcreate access succeeded");
+ VRFY((acc_tpl >= 0), "H5Pcreate access succeeded");
/* set Parallel access with communicator */
ret = H5Pset_mpi(acc_tpl, comm, info);
- VRFY((ret != FAIL), "H5Pset_mpi succeeded");
+ VRFY((ret >= 0), "H5Pset_mpi succeeded");
/* create the file collectively */
fid=H5Fcreate(filename,H5F_ACC_TRUNC,H5P_DEFAULT,acc_tpl);
- VRFY((fid != FAIL), "H5Fcreate succeeded");
+ VRFY((fid >= 0), "H5Fcreate succeeded");
/* Release file-access template */
ret=H5Pclose(acc_tpl);
- VRFY((ret != FAIL), "");
+ VRFY((ret >= 0), "");
/* --------------------------
@@ -469,20 +469,20 @@ dataset_writeAll(char *filename)
* ------------------------- */
/* setup dimensionality object */
sid = H5Screate_simple (RANK, dims, NULL);
- VRFY((sid != FAIL), "H5Screate_simple succeeded");
+ VRFY((sid >= 0), "H5Screate_simple succeeded");
/* create a dataset collectively */
dataset1 = H5Dcreate(fid, DATASETNAME1, H5T_NATIVE_INT, sid, H5P_DEFAULT);
- VRFY((dataset1 != FAIL), "H5Dcreate succeeded");
+ VRFY((dataset1 >= 0), "H5Dcreate succeeded");
/* create another dataset collectively */
datatype = H5Tcopy(H5T_NATIVE_INT);
ret = H5Tset_order(datatype, H5T_ORDER_LE);
- VRFY((ret != FAIL), "H5Tset_order succeeded");
+ VRFY((ret >= 0), "H5Tset_order succeeded");
dataset2 = H5Dcreate(fid, DATASETNAME2, datatype, sid, H5P_DEFAULT);
- VRFY((dataset2 != FAIL), "H5Dcreate 2 succeeded");
+ VRFY((dataset2 >= 0), "H5Dcreate 2 succeeded");
/*
* Set up dimensions of the slab this process accesses.
@@ -493,13 +493,13 @@ dataset_writeAll(char *filename)
/* create a file dataspace independently */
file_dataspace = H5Dget_space (dataset1);
- VRFY((file_dataspace != FAIL), "H5Dget_space succeeded");
+ VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, NULL);
- VRFY((ret != FAIL), "H5Sset_hyperslab succeeded");
+ VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* create a memory dataspace independently */
mem_dataspace = H5Screate_simple (RANK, count, NULL);
- VRFY((mem_dataspace != FAIL), "");
+ VRFY((mem_dataspace >= 0), "");
/* fill the local slab with some trivial data */
dataset_fill(start, count, stride, &data_array1[0][0]);
@@ -511,14 +511,14 @@ dataset_writeAll(char *filename)
/* set up the collective transfer properties list */
xfer_plist = H5Pcreate (H5P_DATASET_XFER);
- VRFY((xfer_plist != FAIL), "");
+ VRFY((xfer_plist >= 0), "");
ret=H5Pset_xfer(xfer_plist, H5D_XFER_COLLECTIVE);
- VRFY((ret != FAIL), "H5Pcreate xfer succeeded");
+ VRFY((ret >= 0), "H5Pcreate xfer succeeded");
/* write data collectively */
ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
xfer_plist, data_array1);
- VRFY((ret != FAIL), "H5Dwrite dataset1 succeeded");
+ VRFY((ret >= 0), "H5Dwrite dataset1 succeeded");
/* release all temporary handles. */
/* Could have used them for dataset2 but it is cleaner */
@@ -540,13 +540,13 @@ dataset_writeAll(char *filename)
/* create a file dataspace independently */
file_dataspace = H5Dget_space (dataset1);
- VRFY((file_dataspace != FAIL), "H5Dget_space succeeded");
+ VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, NULL);
- VRFY((ret != FAIL), "H5Sset_hyperslab succeeded");
+ VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* create a memory dataspace independently */
mem_dataspace = H5Screate_simple (RANK, count, NULL);
- VRFY((mem_dataspace != FAIL), "");
+ VRFY((mem_dataspace >= 0), "");
/* fill the local slab with some trivial data */
dataset_fill(start, count, stride, &data_array1[0][0]);
@@ -558,14 +558,14 @@ dataset_writeAll(char *filename)
/* set up the collective transfer properties list */
xfer_plist = H5Pcreate (H5P_DATASET_XFER);
- VRFY((xfer_plist != FAIL), "");
+ VRFY((xfer_plist >= 0), "");
ret=H5Pset_xfer(xfer_plist, H5D_XFER_COLLECTIVE);
- VRFY((ret != FAIL), "H5Pcreate xfer succeeded");
+ VRFY((ret >= 0), "H5Pcreate xfer succeeded");
/* write data independently */
ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
xfer_plist, data_array1);
- VRFY((ret != FAIL), "H5Dwrite dataset2 succeeded");
+ VRFY((ret >= 0), "H5Dwrite dataset2 succeeded");
/* release all temporary handles. */
H5Sclose(file_dataspace);
@@ -577,9 +577,9 @@ dataset_writeAll(char *filename)
* All writes completed. Close datasets collectively
*/
ret=H5Dclose(dataset1);
- VRFY((ret != FAIL), "H5Dclose1 succeeded");
+ VRFY((ret >= 0), "H5Dclose1 succeeded");
ret=H5Dclose(dataset2);
- VRFY((ret != FAIL), "H5Dclose2 succeeded");
+ VRFY((ret >= 0), "H5Dclose2 succeeded");
/* release all IDs created */
H5Sclose(sid);
@@ -632,18 +632,18 @@ dataset_readAll(char *filename)
* -------------------*/
/* setup file access template with parallel IO access. */
acc_tpl = H5Pcreate (H5P_FILE_ACCESS);
- VRFY((acc_tpl != FAIL), "H5Pcreate access succeeded");
+ VRFY((acc_tpl >= 0), "H5Pcreate access succeeded");
/* set Parallel access with communicator */
ret = H5Pset_mpi(acc_tpl, comm, info);
- VRFY((ret != FAIL), "H5Pset_mpi succeeded");
+ VRFY((ret >= 0), "H5Pset_mpi succeeded");
/* open the file collectively */
fid=H5Fopen(filename,H5F_ACC_RDONLY,acc_tpl);
- VRFY((fid != FAIL), "H5Fopen succeeded");
+ VRFY((fid >= 0), "H5Fopen succeeded");
/* Release file-access template */
ret=H5Pclose(acc_tpl);
- VRFY((ret != FAIL), "");
+ VRFY((ret >= 0), "");
/* --------------------------
@@ -651,11 +651,11 @@ dataset_readAll(char *filename)
* ------------------------- */
/* open the dataset1 collectively */
dataset1 = H5Dopen(fid, DATASETNAME1);
- VRFY((dataset1 != FAIL), "H5Dopen succeeded");
+ VRFY((dataset1 >= 0), "H5Dopen succeeded");
/* open another dataset collectively */
dataset2 = H5Dopen(fid, DATASETNAME2);
- VRFY((dataset2 != FAIL), "H5Dopen 2 succeeded");
+ VRFY((dataset2 >= 0), "H5Dopen 2 succeeded");
/*
* Set up dimensions of the slab this process accesses.
@@ -666,13 +666,13 @@ dataset_readAll(char *filename)
/* create a file dataspace independently */
file_dataspace = H5Dget_space (dataset1);
- VRFY((file_dataspace != FAIL), "H5Dget_space succeeded");
+ VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, NULL);
- VRFY((ret != FAIL), "H5Sset_hyperslab succeeded");
+ VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* create a memory dataspace independently */
mem_dataspace = H5Screate_simple (RANK, count, NULL);
- VRFY((mem_dataspace != FAIL), "");
+ VRFY((mem_dataspace >= 0), "");
/* fill dataset with test data */
dataset_fill(start, count, stride, &data_origin1[0][0]);
@@ -684,14 +684,14 @@ dataset_readAll(char *filename)
/* set up the collective transfer properties list */
xfer_plist = H5Pcreate (H5P_DATASET_XFER);
- VRFY((xfer_plist != FAIL), "");
+ VRFY((xfer_plist >= 0), "");
ret=H5Pset_xfer(xfer_plist, H5D_XFER_COLLECTIVE);
- VRFY((ret != FAIL), "H5Pcreate xfer succeeded");
+ VRFY((ret >= 0), "H5Pcreate xfer succeeded");
/* read data collectively */
ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
xfer_plist, data_array1);
- VRFY((ret != FAIL), "H5Dread succeeded");
+ VRFY((ret >= 0), "H5Dread succeeded");
/* verify the read data with original expected data */
ret = dataset_vrfy(start, count, stride, &data_array1[0][0], &data_origin1[0][0]);
@@ -709,13 +709,13 @@ dataset_readAll(char *filename)
/* create a file dataspace independently */
file_dataspace = H5Dget_space (dataset1);
- VRFY((file_dataspace != FAIL), "H5Dget_space succeeded");
+ VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, NULL);
- VRFY((ret != FAIL), "H5Sset_hyperslab succeeded");
+ VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* create a memory dataspace independently */
mem_dataspace = H5Screate_simple (RANK, count, NULL);
- VRFY((mem_dataspace != FAIL), "");
+ VRFY((mem_dataspace >= 0), "");
/* fill dataset with test data */
dataset_fill(start, count, stride, &data_origin1[0][0]);
@@ -727,14 +727,14 @@ dataset_readAll(char *filename)
/* set up the collective transfer properties list */
xfer_plist = H5Pcreate (H5P_DATASET_XFER);
- VRFY((xfer_plist != FAIL), "");
+ VRFY((xfer_plist >= 0), "");
ret=H5Pset_xfer(xfer_plist, H5D_XFER_COLLECTIVE);
- VRFY((ret != FAIL), "H5Pcreate xfer succeeded");
+ VRFY((ret >= 0), "H5Pcreate xfer succeeded");
/* read data independently */
ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
xfer_plist, data_array1);
- VRFY((ret != FAIL), "H5Dread succeeded");
+ VRFY((ret >= 0), "H5Dread succeeded");
/* verify the read data with original expected data */
ret = dataset_vrfy(start, count, stride, &data_array1[0][0], &data_origin1[0][0]);
@@ -750,9 +750,9 @@ dataset_readAll(char *filename)
* All reads completed. Close datasets collectively
*/
ret=H5Dclose(dataset1);
- VRFY((ret != FAIL), "H5Dclose1 succeeded");
+ VRFY((ret >= 0), "H5Dclose1 succeeded");
ret=H5Dclose(dataset2);
- VRFY((ret != FAIL), "H5Dclose2 succeeded");
+ VRFY((ret >= 0), "H5Dclose2 succeeded");
/* close the file collectively */
H5Fclose(fid);
@@ -812,18 +812,18 @@ extend_writeInd(char *filename)
* -------------------*/
/* setup file access template with parallel IO access. */
acc_tpl = H5Pcreate (H5P_FILE_ACCESS);
- VRFY((acc_tpl != FAIL), "H5Pcreate access succeeded");
+ VRFY((acc_tpl >= 0), "H5Pcreate access succeeded");
/* set Parallel access with communicator */
ret = H5Pset_mpi(acc_tpl, comm, info);
- VRFY((ret != FAIL), "H5Pset_mpi succeeded");
+ VRFY((ret >= 0), "H5Pset_mpi succeeded");
/* create the file collectively */
fid=H5Fcreate(filename,H5F_ACC_TRUNC,H5P_DEFAULT,acc_tpl);
- VRFY((fid != FAIL), "H5Fcreate succeeded");
+ VRFY((fid >= 0), "H5Fcreate succeeded");
/* Release file-access template */
ret=H5Pclose(acc_tpl);
- VRFY((ret != FAIL), "");
+ VRFY((ret >= 0), "");
/* --------------------------------------------------------------
@@ -834,23 +834,23 @@ extend_writeInd(char *filename)
if (verbose)
printf("chunks[]=%d,%d\n", chunk_dims[0], chunk_dims[1]);
dataset_pl = H5Pcreate(H5P_DATASET_CREATE);
- VRFY((dataset_pl != FAIL), "H5Pcreate succeeded");
+ VRFY((dataset_pl >= 0), "H5Pcreate succeeded");
ret = H5Pset_chunk(dataset_pl, RANK, chunk_dims);
- VRFY((ret != FAIL), "H5Pset_chunk succeeded");
+ VRFY((ret >= 0), "H5Pset_chunk succeeded");
/* setup dimensionality object */
/* start out with no rows, extend it later. */
dims[0] = dims[1] = 0;
sid = H5Screate_simple (RANK, dims, max_dims);
- VRFY((sid != FAIL), "H5Screate_simple succeeded");
+ VRFY((sid >= 0), "H5Screate_simple succeeded");
/* create an extendible dataset collectively */
dataset1 = H5Dcreate(fid, DATASETNAME1, H5T_NATIVE_INT, sid, dataset_pl);
- VRFY((dataset1 != FAIL), "H5Dcreate succeeded");
+ VRFY((dataset1 >= 0), "H5Dcreate succeeded");
/* create another extendible dataset collectively */
dataset2 = H5Dcreate(fid, DATASETNAME2, H5T_NATIVE_INT, sid, dataset_pl);
- VRFY((dataset2 != FAIL), "H5Dcreate succeeded");
+ VRFY((dataset2 >= 0), "H5Dcreate succeeded");
/* release resource */
H5Sclose(sid);
@@ -873,24 +873,24 @@ extend_writeInd(char *filename)
/* create a memory dataspace independently */
mem_dataspace = H5Screate_simple (RANK, count, NULL);
- VRFY((mem_dataspace != FAIL), "");
+ VRFY((mem_dataspace >= 0), "");
/* Extend its current dim sizes before writing */
dims[0] = DIM1;
dims[1] = DIM2;
ret = H5Dextend (dataset1, dims);
- VRFY((ret != FAIL), "H5Dextend succeeded");
+ VRFY((ret >= 0), "H5Dextend succeeded");
/* create a file dataspace independently */
file_dataspace = H5Dget_space (dataset1);
- VRFY((file_dataspace != FAIL), "H5Dget_space succeeded");
+ VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, NULL);
- VRFY((ret != FAIL), "H5Sset_hyperslab succeeded");
+ VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* write data independently */
ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
H5P_DEFAULT, data_array1);
- VRFY((ret != FAIL), "H5Dwrite succeeded");
+ VRFY((ret >= 0), "H5Dwrite succeeded");
/* release resource */
H5Sclose(file_dataspace);
@@ -913,7 +913,7 @@ extend_writeInd(char *filename)
/* create a memory dataspace independently */
mem_dataspace = H5Screate_simple (RANK, count, NULL);
- VRFY((mem_dataspace != FAIL), "");
+ VRFY((mem_dataspace >= 0), "");
#ifndef DISABLE
/* Try write to dataset2 beyond its current dim sizes. Should fail. */
@@ -923,14 +923,14 @@ extend_writeInd(char *filename)
/* create a file dataspace independently */
file_dataspace = H5Dget_space (dataset2);
- VRFY((file_dataspace != FAIL), "H5Dget_space succeeded");
+ VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, NULL);
- VRFY((ret != FAIL), "H5Sset_hyperslab succeeded");
+ VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* write data independently. Should fail. */
ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
H5P_DEFAULT, data_array1);
- VRFY((ret == FAIL), "H5Dwrite failed as expected");
+ VRFY((ret < 0), "H5Dwrite failed as expected");
/* restore auto error reporting */
H5Eset_auto(old_func, old_client_data);
@@ -944,31 +944,31 @@ extend_writeInd(char *filename)
dims[0] = DIM1;
dims[1] = DIM2;
ret = H5Dextend (dataset2, dims);
- VRFY((ret != FAIL), "H5Dextend succeeded");
+ VRFY((ret >= 0), "H5Dextend succeeded");
/* create a file dataspace independently */
file_dataspace = H5Dget_space (dataset2);
- VRFY((file_dataspace != FAIL), "H5Dget_space succeeded");
+ VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, NULL);
- VRFY((ret != FAIL), "H5Sset_hyperslab succeeded");
+ VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* write data independently */
ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
H5P_DEFAULT, data_array1);
- VRFY((ret != FAIL), "H5Dwrite succeeded");
+ VRFY((ret >= 0), "H5Dwrite succeeded");
/* release resource */
ret=H5Sclose(file_dataspace);
- VRFY((ret != FAIL), "H5Sclose succeeded");
+ VRFY((ret >= 0), "H5Sclose succeeded");
ret=H5Sclose(mem_dataspace);
- VRFY((ret != FAIL), "H5Sclose succeeded");
+ VRFY((ret >= 0), "H5Sclose succeeded");
/* close dataset collectively */
ret=H5Dclose(dataset1);
- VRFY((ret != FAIL), "H5Dclose1 succeeded");
+ VRFY((ret >= 0), "H5Dclose1 succeeded");
ret=H5Dclose(dataset2);
- VRFY((ret != FAIL), "H5Dclose2 succeeded");
+ VRFY((ret >= 0), "H5Dclose2 succeeded");
/* close the file collectively */
H5Fclose(fid);
@@ -1012,26 +1012,26 @@ extend_readInd(char *filename)
* -------------------*/
/* setup file access template */
acc_tpl = H5Pcreate (H5P_FILE_ACCESS);
- VRFY((acc_tpl != FAIL), "");
+ VRFY((acc_tpl >= 0), "");
/* set Parallel access with communicator */
ret = H5Pset_mpi(acc_tpl, comm, info);
- VRFY((ret != FAIL), "");
+ VRFY((ret >= 0), "");
/* open the file collectively */
fid=H5Fopen(filename,H5F_ACC_RDONLY,acc_tpl);
- VRFY((fid != FAIL), "");
+ VRFY((fid >= 0), "");
/* Release file-access template */
ret=H5Pclose(acc_tpl);
- VRFY((ret != FAIL), "");
+ VRFY((ret >= 0), "");
/* open the dataset1 collectively */
dataset1 = H5Dopen(fid, DATASETNAME1);
- VRFY((dataset1 != FAIL), "");
+ VRFY((dataset1 >= 0), "");
/* open another dataset collectively */
dataset2 = H5Dopen(fid, DATASETNAME1);
- VRFY((dataset2 != FAIL), "");
+ VRFY((dataset2 >= 0), "");
/* Try extend dataset1 which is open RDONLY. Should fail. */
/* first turn off auto error reporting */
@@ -1039,12 +1039,12 @@ extend_readInd(char *filename)
H5Eset_auto(NULL, NULL);
file_dataspace = H5Dget_space (dataset1);
- VRFY((file_dataspace != FAIL), "H5Dget_space succeeded");
+ VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret=H5Sget_simple_extent_dims(file_dataspace, dims, NULL);
VRFY((ret > 0), "H5Sget_simple_extent_dims succeeded");
dims[0]++;
ret=H5Dextend(dataset1, dims);
- VRFY((ret == FAIL), "H5Dextend failed as expected");
+ VRFY((ret < 0), "H5Dextend failed as expected");
/* restore auto error reporting */
H5Eset_auto(old_func, old_client_data);
@@ -1057,13 +1057,13 @@ extend_readInd(char *filename)
/* create a file dataspace independently */
file_dataspace = H5Dget_space (dataset1);
- VRFY((file_dataspace != FAIL), "");
+ VRFY((file_dataspace >= 0), "");
ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, NULL);
- VRFY((ret != FAIL), "");
+ VRFY((ret >= 0), "");
/* create a memory dataspace independently */
mem_dataspace = H5Screate_simple (RANK, count, NULL);
- VRFY((mem_dataspace != FAIL), "");
+ VRFY((mem_dataspace >= 0), "");
/* fill dataset with test data */
dataset_fill(start, count, stride, &data_origin1[0][0]);
@@ -1075,7 +1075,7 @@ extend_readInd(char *filename)
/* read data independently */
ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
H5P_DEFAULT, data_array1);
- VRFY((ret != FAIL), "H5Dread succeeded");
+ VRFY((ret >= 0), "H5Dread succeeded");
/* verify the read data with original expected data */
ret = dataset_vrfy(start, count, stride, &data_array1[0][0], &data_origin1[0][0]);
@@ -1092,13 +1092,13 @@ extend_readInd(char *filename)
/* create a file dataspace independently */
file_dataspace = H5Dget_space (dataset2);
- VRFY((file_dataspace != FAIL), "");
+ VRFY((file_dataspace >= 0), "");
ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, NULL);
- VRFY((ret != FAIL), "");
+ VRFY((ret >= 0), "");
/* create a memory dataspace independently */
mem_dataspace = H5Screate_simple (RANK, count, NULL);
- VRFY((mem_dataspace != FAIL), "");
+ VRFY((mem_dataspace >= 0), "");
/* fill dataset with test data */
dataset_fill(start, count, stride, &data_origin1[0][0]);
@@ -1110,7 +1110,7 @@ extend_readInd(char *filename)
/* read data independently */
ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
H5P_DEFAULT, data_array1);
- VRFY((ret != FAIL), "H5Dread succeeded");
+ VRFY((ret >= 0), "H5Dread succeeded");
/* verify the read data with original expected data */
ret = dataset_vrfy(start, count, stride, &data_array1[0][0], &data_origin1[0][0]);
@@ -1122,9 +1122,9 @@ extend_readInd(char *filename)
/* close dataset collectively */
ret=H5Dclose(dataset1);
- VRFY((ret != FAIL), "");
+ VRFY((ret >= 0), "");
ret=H5Dclose(dataset2);
- VRFY((ret != FAIL), "");
+ VRFY((ret >= 0), "");
/* close the file collectively */
diff --git a/testpar/t_file.c b/testpar/t_file.c
index c615663..737e107 100644
--- a/testpar/t_file.c
+++ b/testpar/t_file.c
@@ -53,23 +53,23 @@ test_split_comm_access(char *filename[])
/* setup file access template */
acc_tpl = H5Pcreate (H5P_FILE_ACCESS);
- VRFY((acc_tpl != FAIL), "");
+ VRFY((acc_tpl >= 0), "");
/* set Parallel access with communicator */
ret = H5Pset_mpi(acc_tpl, comm, info);
- VRFY((ret != FAIL), "");
+ VRFY((ret >= 0), "");
/* create the file collectively */
fid=H5Fcreate(filename[color],H5F_ACC_TRUNC,H5P_DEFAULT,acc_tpl);
- VRFY((fid != FAIL), "H5Fcreate succeeded");
+ VRFY((fid >= 0), "H5Fcreate succeeded");
/* Release file-access template */
ret=H5Pclose(acc_tpl);
- VRFY((ret != FAIL), "");
+ VRFY((ret >= 0), "");
/* close the file */
ret=H5Fclose(fid);
- VRFY((ret != FAIL), "");
+ VRFY((ret >= 0), "");
/* detele the test file */
if (sub_mpi_rank == 0){
@@ -80,137 +80,3 @@ test_split_comm_access(char *filename[])
}
-
-/*
- * MPIO independent overlapping writes.
- *
- * First n-1 processes open 1 file.
- * Each of the n-1 process writes chunks of data to the file in round-robin
- * fashion, in a interleaved but not overlapped fashion. Using increasing
- * chunk sizes for the benefits of testing different write sizes and also
- * reducing the numbers of writes.
- *
- * Last process (n-1) just waits.
- * First n-1 processes finish writing and cloose the file.
- * Last process opens the same file and verifies the data.
- */
-
-#define MPIO_TEST_WRITE_SIZE 1024*1024 /* 1 MB */
-
-void
-test_mpio_overlap_writes(char *filename[])
-{
- int mpi_size, mpi_rank;
- MPI_Comm comm;
- MPI_Info info = MPI_INFO_NULL;
- int color, mrc;
- MPI_File fh;
- int newrank, newprocs;
- hid_t fid; /* file IDs */
- hid_t acc_tpl; /* File access properties */
- herr_t ret; /* generic return value */
- int i;
- char buf[4093]; /* use some prime number for size */
- int bufsize = sizeof(buf);
- int stride;
- MPI_Offset mpi_off;
- MPI_Status mpi_stat;
-
-
- if (verbose)
- printf("MPIO independent overlapping writes test on file %s\n",
- filename[0]);
-
- /* set up MPI parameters */
- MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
- MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank);
-
- /* Need at least 2 processes */
- VRFY((mpi_size >= 2), "Has at least 2 processes");
-
- /* splits processes 0 to n-2 into one comm. and the last one into another */
- color = ((mpi_rank < (mpi_size - 1)) ? 0 : 1);
- mrc = MPI_Comm_split (MPI_COMM_WORLD, color, mpi_rank, &comm);
- VRFY((mrc==MPI_SUCCESS), "Comm_split succeeded");
-
- if (color==0){
- /* First n-1 processes (color==0) open a file and write it */
- mrc = MPI_File_open(comm, filename[0], MPI_MODE_CREATE|MPI_MODE_RDWR,
- info, &fh);
- VRFY((mrc==MPI_SUCCESS), "");
-
- stride = 1;
- mpi_off = mpi_rank*stride;
- while (mpi_off < MPIO_TEST_WRITE_SIZE){
- /* make sure the write does not exceed the TEST_WRITE_SIZE */
- if (mpi_off+stride > MPIO_TEST_WRITE_SIZE)
- stride = MPIO_TEST_WRITE_SIZE - mpi_off;
-
- /* set data to some trivial pattern for easy verification */
- for (i=0; i<stride; i++)
- buf[i] = (mpi_off+i) & 0x7f;
- mrc = MPI_File_write_at(fh, mpi_off, buf, stride, MPI_BYTE,
- &mpi_stat);
- VRFY((mrc==MPI_SUCCESS), "");
-
- /* move the offset pointer to last byte written by all processes */
- mpi_off += (mpi_size - 1 - mpi_rank) * stride;
-
- /* Increase chunk size without exceeding buffer size. */
- /* Then move the starting offset for next write. */
- stride *= 2;
- if (stride > bufsize)
- stride = bufsize;
- mpi_off += mpi_rank*stride;
- }
-
- /* close file and free the communicator */
- mrc = MPI_File_close(&fh);
- VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE");
- mrc = MPI_Comm_free(&comm);
- VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free");
-
- /* sync with the other waiting processes */
- mrc = MPI_Barrier(MPI_COMM_WORLD);
- VRFY((mrc==MPI_SUCCESS), "Sync after writes");
- }else{
- /* last process waits till writes are done,
- * then opens file to verify data.
- */
- mrc = MPI_Barrier(MPI_COMM_WORLD);
- VRFY((mrc==MPI_SUCCESS), "Sync after writes");
-
- mrc = MPI_File_open(comm, filename[0], MPI_MODE_RDONLY,
- info, &fh);
- VRFY((mrc==MPI_SUCCESS), "");
-
- stride = bufsize;
- for (mpi_off=0; mpi_off < MPIO_TEST_WRITE_SIZE; mpi_off += bufsize){
- /* make sure it does not read beyond end of data */
- if (mpi_off+stride > MPIO_TEST_WRITE_SIZE)
- stride = MPIO_TEST_WRITE_SIZE - mpi_off;
- mrc = MPI_File_read_at(fh, mpi_off, buf, stride, MPI_BYTE,
- &mpi_stat);
- VRFY((mrc==MPI_SUCCESS), "");
- for (i=0; i<stride; i++){
- if (buf[i] != ((mpi_off+i) & 0x7f))
- printf("proc %d: found data error at [%d], expect %d, got %d\n",
- mpi_rank, mpi_off+i, mpi_off & 0x7f, buf[0]);
- }
- }
-
- /* close file and free the communicator */
- mrc = MPI_File_close(&fh);
- VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE");
- mrc = MPI_Comm_free(&comm);
- VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free");
- }
-
- /*
- * one more sync to ensure all processes have done reading
- * before ending this test.
- */
- mrc = MPI_Barrier(MPI_COMM_WORLD);
- VRFY((mrc==MPI_SUCCESS), "Sync before leaving test");
-}
-
diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c
new file mode 100644
index 0000000..0d6d390
--- /dev/null
+++ b/testpar/t_mpi.c
@@ -0,0 +1,135 @@
+/*
+ * MPIO independent overlapping writes.
+ *
+ * First n-1 processes open 1 file.
+ * Each of the n-1 process writes chunks of data to the file in round-robin
+ * fashion, in a interleaved but not overlapped fashion. Using increasing
+ * chunk sizes for the benefits of testing different write sizes and also
+ * reducing the numbers of writes.
+ *
+ * Last process (n-1) just waits.
+ * First n-1 processes finish writing and cloose the file.
+ * Last process opens the same file and verifies the data.
+ */
+
+#include <testphdf5.h>
+
+#define MPIO_TEST_WRITE_SIZE 1024*1024 /* 1 MB */
+
+void
+test_mpio_overlap_writes(char *filename[])
+{
+ int mpi_size, mpi_rank;
+ MPI_Comm comm;
+ MPI_Info info = MPI_INFO_NULL;
+ int color, mrc;
+ MPI_File fh;
+ int newrank, newprocs;
+ hid_t fid; /* file IDs */
+ hid_t acc_tpl; /* File access properties */
+ herr_t ret; /* generic return value */
+ int i;
+ char buf[4093]; /* use some prime number for size */
+ int bufsize = sizeof(buf);
+ int stride;
+ MPI_Offset mpi_off;
+ MPI_Status mpi_stat;
+
+
+ if (verbose)
+ printf("MPIO independent overlapping writes test on file %s\n",
+ filename[0]);
+
+ /* set up MPI parameters */
+ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
+ MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank);
+
+ /* Need at least 2 processes */
+ VRFY((mpi_size >= 2), "Has at least 2 processes");
+
+ /* splits processes 0 to n-2 into one comm. and the last one into another */
+ color = ((mpi_rank < (mpi_size - 1)) ? 0 : 1);
+ mrc = MPI_Comm_split (MPI_COMM_WORLD, color, mpi_rank, &comm);
+ VRFY((mrc==MPI_SUCCESS), "Comm_split succeeded");
+
+ if (color==0){
+ /* First n-1 processes (color==0) open a file and write it */
+ mrc = MPI_File_open(comm, filename[0], MPI_MODE_CREATE|MPI_MODE_RDWR,
+ info, &fh);
+ VRFY((mrc==MPI_SUCCESS), "");
+
+ stride = 1;
+ mpi_off = mpi_rank*stride;
+ while (mpi_off < MPIO_TEST_WRITE_SIZE){
+ /* make sure the write does not exceed the TEST_WRITE_SIZE */
+ if (mpi_off+stride > MPIO_TEST_WRITE_SIZE)
+ stride = MPIO_TEST_WRITE_SIZE - mpi_off;
+
+ /* set data to some trivial pattern for easy verification */
+ for (i=0; i<stride; i++)
+ buf[i] = (mpi_off+i) & 0x7f;
+ mrc = MPI_File_write_at(fh, mpi_off, buf, stride, MPI_BYTE,
+ &mpi_stat);
+ VRFY((mrc==MPI_SUCCESS), "");
+
+ /* move the offset pointer to last byte written by all processes */
+ mpi_off += (mpi_size - 1 - mpi_rank) * stride;
+
+ /* Increase chunk size without exceeding buffer size. */
+ /* Then move the starting offset for next write. */
+ stride *= 2;
+ if (stride > bufsize)
+ stride = bufsize;
+ mpi_off += mpi_rank*stride;
+ }
+
+ /* close file and free the communicator */
+ mrc = MPI_File_close(&fh);
+ VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE");
+ mrc = MPI_Comm_free(&comm);
+ VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free");
+
+ /* sync with the other waiting processes */
+ mrc = MPI_Barrier(MPI_COMM_WORLD);
+ VRFY((mrc==MPI_SUCCESS), "Sync after writes");
+ }else{
+ /* last process waits till writes are done,
+ * then opens file to verify data.
+ */
+ mrc = MPI_Barrier(MPI_COMM_WORLD);
+ VRFY((mrc==MPI_SUCCESS), "Sync after writes");
+
+ mrc = MPI_File_open(comm, filename[0], MPI_MODE_RDONLY,
+ info, &fh);
+ VRFY((mrc==MPI_SUCCESS), "");
+
+ stride = bufsize;
+ for (mpi_off=0; mpi_off < MPIO_TEST_WRITE_SIZE; mpi_off += bufsize){
+ /* make sure it does not read beyond end of data */
+ if (mpi_off+stride > MPIO_TEST_WRITE_SIZE)
+ stride = MPIO_TEST_WRITE_SIZE - mpi_off;
+ mrc = MPI_File_read_at(fh, mpi_off, buf, stride, MPI_BYTE,
+ &mpi_stat);
+ VRFY((mrc==MPI_SUCCESS), "");
+ for (i=0; i<stride; i++){
+ if (buf[i] != ((mpi_off+i) & 0x7f))
+ printf("proc %d: found data error at [%d], expect %d, got %d\n",
+ mpi_rank, mpi_off+i, mpi_off & 0x7f, buf[0]);
+ }
+ }
+
+ /* close file and free the communicator */
+ mrc = MPI_File_close(&fh);
+ VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE");
+ mrc = MPI_Comm_free(&comm);
+ VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free");
+ }
+
+ /*
+ * one more sync to ensure all processes have done reading
+ * before ending this test.
+ */
+ mrc = MPI_Barrier(MPI_COMM_WORLD);
+ VRFY((mrc==MPI_SUCCESS), "Sync before leaving test");
+}
+
diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c
index b067dd5..dfa0ab8 100644
--- a/testpar/testphdf5.c
+++ b/testpar/testphdf5.c
@@ -197,14 +197,14 @@ main(int argc, char **argv)
}
if (dowrite){
- MPI_BANNER("testing dataset using split communicators...");
- test_split_comm_access(filenames);
-
-#ifdef MPIOTEST
+#ifndef MPIOTEST
MPI_BANNER("testing MPIO independent overlapping writes...");
test_mpio_overlap_writes(filenames);
#endif
+ MPI_BANNER("testing dataset using split communicators...");
+ test_split_comm_access(filenames);
+
MPI_BANNER("testing dataset independent write...");
dataset_writeInd(filenames[0]);