summaryrefslogtreecommitdiffstats
path: root/testpar
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2002-06-19 16:06:55 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2002-06-19 16:06:55 (GMT)
commitea052ffd55cabca3ef756a7f44e7f3f2fa32b679 (patch)
treeb7c28b9fa9d1552d5a0bcfbaba686d925d5470a5 /testpar
parent29a0f3e3586080a69f0048bf79dec5e9749fcb5d (diff)
downloadhdf5-ea052ffd55cabca3ef756a7f44e7f3f2fa32b679.zip
hdf5-ea052ffd55cabca3ef756a7f44e7f3f2fa32b679.tar.gz
hdf5-ea052ffd55cabca3ef756a7f44e7f3f2fa32b679.tar.bz2
[svn-r5674] Purpose:
Code cleanup Description: Removed more compiler warnings, etc. Platforms tested: Linux 2.2.x (eirene) w/parallel
Diffstat (limited to 'testpar')
-rw-r--r--testpar/t_dset.c68
-rw-r--r--testpar/t_mdset.c11
-rw-r--r--testpar/t_mpi.c7
-rw-r--r--testpar/testphdf5.c12
-rw-r--r--testpar/testphdf5.h6
5 files changed, 51 insertions, 53 deletions
diff --git a/testpar/t_dset.c b/testpar/t_dset.c
index 91b6bd5..6e18453 100644
--- a/testpar/t_dset.c
+++ b/testpar/t_dset.c
@@ -28,7 +28,7 @@
* ZROW same as BYROW except process 0 gets 0 rows
* ZCOL same as BYCOL except process 0 gets 0 columns
*/
-void
+static void
slab_set(int mpi_rank, int mpi_size, hssize_t start[], hsize_t count[],
hsize_t stride[], hsize_t block[], int mode)
{
@@ -108,16 +108,16 @@ if (verbose){
* Fill the dataset with trivial data for testing.
* Assume dimension rank is 2 and data is stored contiguous.
*/
-void
-dataset_fill(hssize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], DATATYPE * dataset)
+static void
+dataset_fill(hssize_t start[], hsize_t block[], DATATYPE * dataset)
{
DATATYPE *dataptr = dataset;
- int i, j;
+ hsize_t i, j;
/* put some trivial data in the data_array */
for (i=0; i < block[0]; i++){
for (j=0; j < block[1]; j++){
- *dataptr = (i+start[0])*100 + (j+start[1]+1);
+ *dataptr = (DATATYPE)((i+start[0])*100 + (j+start[1]+1));
dataptr++;
}
}
@@ -127,10 +127,11 @@ dataset_fill(hssize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[
/*
* Print the content of the dataset.
*/
-void dataset_print(hssize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], DATATYPE * dataset)
+static void
+dataset_print(hssize_t start[], hsize_t block[], DATATYPE * dataset)
{
DATATYPE *dataptr = dataset;
- int i, j;
+ hsize_t i, j;
/* print the column heading */
printf("%-8s", "Cols:");
@@ -155,7 +156,8 @@ void dataset_print(hssize_t start[], hsize_t count[], hsize_t stride[], hsize_t
*/
int dataset_vrfy(hssize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], DATATYPE *dataset, DATATYPE *original)
{
- int i, j, vrfyerrs;
+ hsize_t i, j;
+ int vrfyerrs;
/* print it if verbose */
if (verbose) {
@@ -164,9 +166,9 @@ int dataset_vrfy(hssize_t start[], hsize_t count[], hsize_t stride[], hsize_t bl
(long)start[0], (long)start[1], (unsigned long)count[0], (unsigned long)count[1],
(unsigned long)stride[0], (unsigned long)stride[1], (unsigned long)block[0], (unsigned long)block[1]);
printf("original values:\n");
- dataset_print(start, count, stride, block, original);
+ dataset_print(start, block, original);
printf("compared values:\n");
- dataset_print(start, count, stride, block, dataset);
+ dataset_print(start, block, dataset);
}
vrfyerrs = 0;
@@ -174,9 +176,9 @@ int dataset_vrfy(hssize_t start[], hsize_t count[], hsize_t stride[], hsize_t bl
for (j=0; j < block[1]; j++){
if (*dataset != *original){
if (vrfyerrs++ < MAX_ERR_REPORT || verbose){
- printf("Dataset Verify failed at [%d][%d](row %d, col %d): expect %d, got %d\n",
- i, j,
- (int)(i+start[0]), (int)(j+start[1]),
+ printf("Dataset Verify failed at [%ld][%ld](row %ld, col %ld): expect %d, got %d\n",
+ (long)i, (long)j,
+ (long)(i+start[0]), (long)(j+start[1]),
*(original), *(dataset));
}
dataset++;
@@ -285,7 +287,7 @@ dataset_writeInd(char *filename)
slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW);
/* put some trivial data in the data_array */
- dataset_fill(start, count, stride, block, data_array1);
+ dataset_fill(start, block, data_array1);
MESG("data_array initialized");
/* create a file dataspace independently */
@@ -415,7 +417,7 @@ dataset_readInd(char *filename)
VRFY((mem_dataspace >= 0), "");
/* fill dataset with test data */
- dataset_fill(start, count, stride, block, data_origin1);
+ dataset_fill(start, block, data_origin1);
/* read data independently */
ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace,
@@ -558,11 +560,11 @@ dataset_writeAll(char *filename)
VRFY((mem_dataspace >= 0), "");
/* fill the local slab with some trivial data */
- dataset_fill(start, count, stride, block, data_array1);
+ dataset_fill(start, block, data_array1);
MESG("data_array initialized");
if (verbose){
MESG("data_array created");
- dataset_print(start, count, stride, block, data_array1);
+ dataset_print(start, block, data_array1);
}
/* set up the collective transfer properties list */
@@ -604,11 +606,11 @@ dataset_writeAll(char *filename)
slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL);
/* put some trivial data in the data_array */
- dataset_fill(start, count, stride, block, data_array1);
+ dataset_fill(start, block, data_array1);
MESG("data_array initialized");
if (verbose){
MESG("data_array created");
- dataset_print(start, count, stride, block, data_array1);
+ dataset_print(start, block, data_array1);
}
/* create a file dataspace independently */
@@ -622,11 +624,11 @@ dataset_writeAll(char *filename)
VRFY((mem_dataspace >= 0), "");
/* fill the local slab with some trivial data */
- dataset_fill(start, count, stride, block, data_array1);
+ dataset_fill(start, block, data_array1);
MESG("data_array initialized");
if (verbose){
MESG("data_array created");
- dataset_print(start, count, stride, block, data_array1);
+ dataset_print(start, block, data_array1);
}
/* set up the collective transfer properties list */
@@ -769,11 +771,11 @@ dataset_readAll(char *filename)
VRFY((mem_dataspace >= 0), "");
/* fill dataset with test data */
- dataset_fill(start, count, stride, block, data_origin1);
+ dataset_fill(start, block, data_origin1);
MESG("data_array initialized");
if (verbose){
MESG("data_array created");
- dataset_print(start, count, stride, block, data_origin1);
+ dataset_print(start, block, data_origin1);
}
/* set up the collective transfer properties list */
@@ -832,11 +834,11 @@ dataset_readAll(char *filename)
VRFY((mem_dataspace >= 0), "");
/* fill dataset with test data */
- dataset_fill(start, count, stride, block, data_origin1);
+ dataset_fill(start, block, data_origin1);
MESG("data_array initialized");
if (verbose){
MESG("data_array created");
- dataset_print(start, count, stride, block, data_origin1);
+ dataset_print(start, block, data_origin1);
}
/* set up the collective transfer properties list */
@@ -1006,11 +1008,11 @@ extend_writeInd(char *filename)
slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW);
/* put some trivial data in the data_array */
- dataset_fill(start, count, stride, block, data_array1);
+ dataset_fill(start, block, data_array1);
MESG("data_array initialized");
if (verbose){
MESG("data_array created");
- dataset_print(start, count, stride, block, data_array1);
+ dataset_print(start, block, data_array1);
}
/* create a memory dataspace independently */
@@ -1046,11 +1048,11 @@ extend_writeInd(char *filename)
slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL);
/* put some trivial data in the data_array */
- dataset_fill(start, count, stride, block, data_array1);
+ dataset_fill(start, block, data_array1);
MESG("data_array initialized");
if (verbose){
MESG("data_array created");
- dataset_print(start, count, stride, block, data_array1);
+ dataset_print(start, block, data_array1);
}
/* create a memory dataspace independently */
@@ -1209,10 +1211,10 @@ extend_readInd(char *filename)
VRFY((mem_dataspace >= 0), "");
/* fill dataset with test data */
- dataset_fill(start, count, stride, block, data_origin1);
+ dataset_fill(start, block, data_origin1);
if (verbose){
MESG("data_array created");
- dataset_print(start, count, stride, block, data_array1);
+ dataset_print(start, block, data_array1);
}
/* read data independently */
@@ -1244,10 +1246,10 @@ extend_readInd(char *filename)
VRFY((mem_dataspace >= 0), "");
/* fill dataset with test data */
- dataset_fill(start, count, stride, block, data_origin1);
+ dataset_fill(start, block, data_origin1);
if (verbose){
MESG("data_array created");
- dataset_print(start, count, stride, block, data_array1);
+ dataset_print(start, block, data_array1);
}
/* read data independently */
diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c
index bd06cc9..0b6de7a 100644
--- a/testpar/t_mdset.c
+++ b/testpar/t_mdset.c
@@ -280,12 +280,12 @@ void multiple_group_read(char *filename, int ngroups)
/* check the data. */
if(m != 0)
- if( error_num = read_dataset(memspace, filespace, gid) )
+ if( (error_num = read_dataset(memspace, filespace, gid))>0)
nerrors += error_num;
/* check attribute.*/
error_num = 0;
- if( error_num = read_attribute(gid, is_group, m) )
+ if( (error_num = read_attribute(gid, is_group, m))>0 )
nerrors += error_num;
H5Gclose(gid);
@@ -343,7 +343,7 @@ int read_dataset(hid_t memspace, hid_t filespace, hid_t gid)
vrfy_errors = check_value(indata, outdata);
/* check attribute.*/
- if( attr_errors = read_attribute(did, is_dset, n) )
+ if( (attr_errors = read_attribute(did, is_dset, n))>0 )
vrfy_errors += attr_errors;
H5Dclose(did);
@@ -455,7 +455,8 @@ int read_attribute(hid_t obj_id, int this_type, int num)
* hyperslab part only by process ID. */
int check_value(DATATYPE *indata, DATATYPE *outdata)
{
- int mpi_rank, mpi_size, i, j, err_num=0;
+ int mpi_rank, mpi_size, err_num=0;
+ hsize_t i, j;
hssize_t chunk_origin[DIM];
hsize_t chunk_dims[DIM], count[DIM];
@@ -470,7 +471,7 @@ int check_value(DATATYPE *indata, DATATYPE *outdata)
for(j=chunk_origin[1]; j<(chunk_origin[1]+chunk_dims[1]); j++) {
if( *indata != *outdata )
if(err_num++ < MAX_ERR_REPORT || verbose)
- printf("Dataset Verify failed at [%d][%d](row %d, col%d): expect %d, got %d\n", i, j, i, j, *outdata, *indata);
+ printf("Dataset Verify failed at [%ld][%ld](row %ld, col%ld): expect %d, got %d\n", (long)i, (long)j, (long)i, (long)j, *outdata, *indata);
}
if(err_num > MAX_ERR_REPORT && !verbose)
printf("[more errors ...]\n");
diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c
index 8f6b55a..3a28146 100644
--- a/testpar/t_mpi.c
+++ b/testpar/t_mpi.c
@@ -26,7 +26,6 @@ hid_t fapl; /* file access property list */
/* protocols */
static void test_mpio_overlap_writes(char *filename);
static void test_mpio_gb_file(char *filename);
-static void test_mpio_gb_file(char *filename);
static int parse_options(int argc, char **argv);
static void usage(void);
@@ -282,13 +281,13 @@ test_mpio_gb_file(char *filename)
for (i=ntimes-2; i <= ntimes; i++){
mpi_off = (i*mpi_size + mpi_rank)*(MPI_Offset)MB;
if (verbose)
- printf("proc %d: write to mpi_off=%016llx, %lld\n",
+ HDfprintf(stdout,"proc %d: write to mpi_off=%016llx, %lld\n",
mpi_rank, mpi_off, mpi_off);
/* set data to some trivial pattern for easy verification */
for (j=0; j<MB; j++)
*(buf+j) = i*mpi_size + mpi_rank;
if (verbose)
- printf("proc %d: writing %d bytes at offset %lld\n",
+ HDfprintf(stdout,"proc %d: writing %d bytes at offset %lld\n",
mpi_rank, MB, mpi_off);
mrc = MPI_File_write_at(fh, mpi_off, buf, MB, MPI_BYTE, &mpi_stat);
INFO((mrc==MPI_SUCCESS), "GB size file write");
@@ -321,7 +320,7 @@ test_mpio_gb_file(char *filename)
for (i=ntimes-2; i <= ntimes; i++){
mpi_off = (i*mpi_size + (mpi_size - mpi_rank - 1))*(MPI_Offset)MB;
if (verbose)
- printf("proc %d: read from mpi_off=%016llx, %lld\n",
+ HDfprintf(stdout,"proc %d: read from mpi_off=%016llx, %lld\n",
mpi_rank, mpi_off, mpi_off);
mrc = MPI_File_read_at(fh, mpi_off, buf, MB, MPI_BYTE, &mpi_stat);
INFO((mrc==MPI_SUCCESS), "GB size file read");
diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c
index da77585..e193177 100644
--- a/testpar/testphdf5.c
+++ b/testpar/testphdf5.c
@@ -93,7 +93,7 @@ int MPI_Init(int *argc, char ***argv)
/*
* Show command usage
*/
-void
+static void
usage(void)
{
printf("Usage: testphdf5 [-r] [-w] [-v] [-m<n_datasets>] [-n<n_groups>] "
@@ -244,7 +244,7 @@ parse_options(int argc, char **argv)
* Create the appropriate File access property list
*/
hid_t
-create_faccess_plist(MPI_Comm comm, MPI_Info info, int facc_type )
+create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type )
{
hid_t ret_pl = -1;
herr_t ret; /* generic return value */
@@ -256,17 +256,17 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int facc_type )
ret_pl = H5Pcreate (H5P_FILE_ACCESS);
VRFY((ret_pl >= 0), "H5P_FILE_ACCESS");
- if (facc_type == FACC_DEFAULT)
+ if (l_facc_type == FACC_DEFAULT)
return (ret_pl);
- if (facc_type == FACC_MPIO){
+ if (l_facc_type == FACC_MPIO){
/* set Parallel access with communicator */
ret = H5Pset_fapl_mpio(ret_pl, comm, info);
VRFY((ret >= 0), "");
return(ret_pl);
}
- if (facc_type == (FACC_MPIO | FACC_SPLIT)){
+ if (l_facc_type == (FACC_MPIO | FACC_SPLIT)){
hid_t mpio_pl;
mpio_pl = H5Pcreate (H5P_FILE_ACCESS);
@@ -290,7 +290,7 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int facc_type )
}
-main(int argc, char **argv)
+int main(int argc, char **argv)
{
int mpi_size, mpi_rank; /* mpi variables */
diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h
index 636769d..57510df 100644
--- a/testpar/testphdf5.h
+++ b/testpar/testphdf5.h
@@ -3,10 +3,6 @@
#ifndef PHDF5TEST_H
#define PHDF5TEST_H
-#include <assert.h>
-#include <stdlib.h>
-
-#include "hdf5.h"
#include "h5test.h"
/* Define some handy debugging shorthands, routines, ... */
@@ -102,7 +98,7 @@ extern void *old_client_data; /*previous error handler arg.*/
extern int facc_type; /*Test file access type */
/* prototypes */
-hid_t create_faccess_plist(MPI_Comm comm, MPI_Info info, int facc_type );
+hid_t create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type );
void multiple_dset_write(char *filename, int ndatasets);
void multiple_group_write(char *filename, int ngroups);
void multiple_group_read(char *filename, int ngroups);