summaryrefslogtreecommitdiffstats
path: root/testpar
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2014-08-01 19:24:52 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2014-08-01 19:24:52 (GMT)
commit8771fba1de67c170813b622812ea943d682104ec (patch)
treeb2a9f3a3e8e7dfb11883c656b7e57b5bd21abde9 /testpar
parentbeb6f83cfd696e835970091f730a23db31381455 (diff)
downloadhdf5-8771fba1de67c170813b622812ea943d682104ec.zip
hdf5-8771fba1de67c170813b622812ea943d682104ec.tar.gz
hdf5-8771fba1de67c170813b622812ea943d682104ec.tar.bz2
[svn-r25503] - fix bug in encode/decode plist parallel test when 1 proccess is used to run the test.
- fix warning in t_chunk_alloc.
Diffstat (limited to 'testpar')
-rw-r--r--testpar/t_chunk_alloc.c21
-rw-r--r--testpar/t_prop.c38
-rw-r--r--testpar/testphdf5.c2
3 files changed, 36 insertions, 25 deletions
diff --git a/testpar/t_chunk_alloc.c b/testpar/t_chunk_alloc.c
index b2ddc23..bc233c7 100644
--- a/testpar/t_chunk_alloc.c
+++ b/testpar/t_chunk_alloc.c
@@ -37,7 +37,7 @@ get_filesize(const char *filename)
MPI_File fd;
MPI_Offset filesize;
- mpierr = MPI_File_open(MPI_COMM_SELF, (char*)filename, MPI_MODE_RDONLY,
+ mpierr = MPI_File_open(MPI_COMM_SELF, filename, MPI_MODE_RDONLY,
MPI_INFO_NULL, &fd);
VRFY((mpierr == MPI_SUCCESS), "");
@@ -275,8 +275,9 @@ parallel_access_dataset(const char *filename, int chunk_factor, access_type acti
/* only opens the *dataset */
case open_only:
-
break;
+ default:
+ HDassert(0);
}
/* Close up */
@@ -319,7 +320,8 @@ parallel_access_dataset(const char *filename, int chunk_factor, access_type acti
* interleaved pattern.
*/
static void
-verify_data(const char *filename, int chunk_factor, write_type write_pattern, int close, hid_t *file_id, hid_t *dataset)
+verify_data(const char *filename, int chunk_factor, write_type write_pattern, int vclose,
+ hid_t *file_id, hid_t *dataset)
{
/* HDF5 gubbins */
hid_t dataspace, memspace; /* HDF5 file identifier */
@@ -334,7 +336,7 @@ verify_data(const char *filename, int chunk_factor, write_type write_pattern, in
/* Variables used in reading data back */
char buffer[CHUNK_SIZE];
int value, i;
- int index;
+ int index_l;
long nchunks;
/* Initialize MPI */
MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
@@ -397,11 +399,14 @@ verify_data(const char *filename, int chunk_factor, write_type write_pattern, in
value = 100;
else
value = 0;
+ break;
+ default:
+ HDassert(0);
}
/* verify content of the chunk */
- for (index = 0; index < CHUNK_SIZE; index++)
- VRFY((buffer[index] == value), "data verification");
+ for (index_l = 0; index_l < CHUNK_SIZE; index_l++)
+ VRFY((buffer[index_l] == value), "data verification");
}
hrc = H5Sclose (dataspace);
@@ -415,7 +420,7 @@ verify_data(const char *filename, int chunk_factor, write_type write_pattern, in
VRFY((hrc >= 0), "");
/* Close up */
- if (close){
+ if (vclose){
hrc = H5Dclose(*dataset);
VRFY((hrc >= 0), "");
*dataset = -1;
@@ -464,7 +469,7 @@ test_chunk_alloc(void)
MPI_Comm_size(MPI_COMM_WORLD,&mpi_size);
MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank);
- filename = GetTestParameters();
+ filename = (const char*)GetTestParameters();
if (VERBOSE_MED)
printf("Extend Chunked allocation test on file %s\n", filename);
diff --git a/testpar/t_prop.c b/testpar/t_prop.c
index c588ad2..2cc0f5e 100644
--- a/testpar/t_prop.c
+++ b/testpar/t_prop.c
@@ -27,50 +27,57 @@ test_encode_decode(hid_t orig_pl, int mpi_rank, int recv_proc)
MPI_Request req[2];
MPI_Status status;
hid_t pl; /* Decoded property list */
- void *buf = NULL;
size_t buf_size = 0;
- int casted_size;
+ void *sbuf = NULL;
herr_t ret; /* Generic return value */
if(mpi_rank == 0) {
+ int send_size = 0;
+
/* first call to encode returns only the size of the buffer needed */
ret = H5Pencode(orig_pl, NULL, &buf_size);
VRFY((ret >= 0), "H5Pencode succeeded");
- buf = (uint8_t *)HDmalloc(buf_size);
+ sbuf = (uint8_t *)HDmalloc(buf_size);
- ret = H5Pencode(orig_pl, buf, &buf_size);
+ ret = H5Pencode(orig_pl, sbuf, &buf_size);
VRFY((ret >= 0), "H5Pencode succeeded");
/* this is a temp fix to send this size_t */
- casted_size = (int)buf_size;
+ send_size = (int)buf_size;
- MPI_Isend(&casted_size, 1, MPI_INT, recv_proc, 123, MPI_COMM_WORLD, &req[0]);
- MPI_Isend(buf, casted_size, MPI_BYTE, recv_proc, 124, MPI_COMM_WORLD, &req[1]);
+ MPI_Isend(&send_size, 1, MPI_INT, recv_proc, 123, MPI_COMM_WORLD, &req[0]);
+ MPI_Isend(sbuf, send_size, MPI_BYTE, recv_proc, 124, MPI_COMM_WORLD, &req[1]);
} /* end if */
+
if(mpi_rank == recv_proc) {
- MPI_Recv(&casted_size, 1, MPI_INT, 0, 123, MPI_COMM_WORLD, &status);
- buf_size = casted_size;
- buf = (uint8_t *)HDmalloc(buf_size);
- MPI_Recv(buf, casted_size, MPI_BYTE, 0, 124, MPI_COMM_WORLD, &status);
+ int recv_size;
+ void *rbuf;
+
+ MPI_Recv(&recv_size, 1, MPI_INT, 0, 123, MPI_COMM_WORLD, &status);
+ buf_size = recv_size;
+ rbuf = (uint8_t *)HDmalloc(buf_size);
+ MPI_Recv(rbuf, recv_size, MPI_BYTE, 0, 124, MPI_COMM_WORLD, &status);
- pl = H5Pdecode(buf);
+ pl = H5Pdecode(rbuf);
VRFY((pl >= 0), "H5Pdecode succeeded");
VRFY(H5Pequal(orig_pl, pl), "Property List Equal Succeeded");
ret = H5Pclose(pl);
VRFY((ret >= 0), "H5Pclose succeeded");
+
+ if(NULL != rbuf)
+ HDfree(rbuf);
} /* end if */
if(0 == mpi_rank)
MPI_Waitall(2, req, MPI_STATUSES_IGNORE);
- if(NULL != buf)
- HDfree(buf);
+ if(NULL != sbuf)
+ HDfree(sbuf);
MPI_Barrier(MPI_COMM_WORLD);
-
return(0);
}
@@ -135,7 +142,6 @@ test_plist_ed(void)
herr_t ret; /* Generic return value */
-
if(VERBOSE_MED)
printf("Encode/Decode DCPLs\n");
diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c
index 057ac88..df6257f 100644
--- a/testpar/testphdf5.c
+++ b/testpar/testphdf5.c
@@ -368,7 +368,7 @@ int main(int argc, char **argv)
AddTest("selnone", none_selection_chunk, NULL,
"chunked dataset with none-selection", PARATESTFILE);
AddTest("calloc", test_chunk_alloc, NULL,
- "parallel extend Chunked allocation on serial file", PARATESTFILE);
+ "parallel extend Chunked allocation on serial file", PARATESTFILE);
AddTest("fltread", test_filter_read, NULL,
"parallel read of dataset written serially with filters", PARATESTFILE);