2
0
mirror of https://github.com/HDFGroup/hdf5.git synced 2025-04-12 17:31:09 +08:00

[svn-r3119] Purpose:

New features
Description:
    Some testers found the filename lengths too short.
    Changed it to use the FILENAME_MAX usually defined in stdio.h.
    If not, set it to 512 which should be sufficient for users
    but should not exceed any system limits.

    Also added a new test parameters of ndatasets so that the tester
    can specific a different number of datasets for the multiple
    datasets tests.

    Changed the datatype of datasets created to DOUBLE.  This eliminates
    the current racing conditions.  But the racing bugs during conversion
    still need to be tracked down and squashed.
Platforms tested:
    Modi4 -64.
This commit is contained in:
Albert Cheng 2000-12-12 18:12:57 -05:00
parent f401dda2d7
commit 061ed07676
4 changed files with 31 additions and 20 deletions

@ -77,6 +77,8 @@ test_split_comm_access(char *filename)
VRFY((mrc==MPI_SUCCESS), "");
}
}
mrc = MPI_Barrier(MPI_COMM_WORLD);
VRFY((mrc==MPI_SUCCESS), "final MPI_Barrier succeeded");
}

@ -2,9 +2,8 @@
#define DIM 2
#define SIZE 32
#define NUMITEMS 300
void multiple_dset_write(char *filename)
void multiple_dset_write(char *filename, int ndatasets)
{
int i, j, n, mpi_size, mpi_rank;
hid_t iof, plist, dataset, memspace, filespace;
@ -37,10 +36,10 @@ void multiple_dset_write(char *filename)
filespace = H5Screate_simple (DIM, file_dims, NULL);
H5Sselect_hyperslab (filespace, H5S_SELECT_SET, chunk_origin, chunk_dims, count, chunk_dims);
for (n = 0; n < NUMITEMS; n++) {
for (n = 0; n < ndatasets; n++) {
sprintf (dname, "dataset %d", n);
dataset = H5Dcreate (iof, dname, H5T_NATIVE_FLOAT, filespace, H5P_DEFAULT);
VRFY((dataset > 0), "dataset create succeeded");
dataset = H5Dcreate (iof, dname, H5T_NATIVE_DOUBLE, filespace, H5P_DEFAULT);
VRFY((dataset > 0), dname);
/* calculate data to write */
for (i = 0; i < SIZE; i++)
@ -52,8 +51,8 @@ void multiple_dset_write(char *filename)
H5Dclose (dataset);
if (! ((n+1) % 10)) {
printf("created %d datasets\n", n+1);
}
MPI_Barrier(MPI_COMM_WORLD);
}
}
H5Sclose (filespace);

@ -6,6 +6,10 @@
#include <testphdf5.h>
#ifndef FILENAME_MAX
#define FILENAME_MAX 512
#endif
/* global variables */
int dim0 = DIM0;
int dim1 = DIM1;
@ -13,6 +17,7 @@ int chunkdim0;
int chunkdim1;
int nerrors = 0; /* errors count */
int verbose = 0; /* verbose, default as no. */
int ndatasets = 300; /*number of datasets to create*/
herr_t (*old_func)(void*); /* previous error handler */
void *old_client_data; /* previous error handler arg.*/
@ -20,7 +25,6 @@ void *old_client_data; /* previous error handler arg.*/
/* other option flags */
int doread=1; /* read test */
int dowrite=1; /* write test */
int domdset=1; /* multiple dataset test */
/* FILENAME and filenames must have the same number of names */
const char *FILENAME[5]={
"ParaEg1",
@ -28,7 +32,7 @@ const char *FILENAME[5]={
"ParaEg3",
"ParaMdset",
NULL};
char filenames[5][200];
char filenames[5][FILENAME_MAX];
hid_t fapl; /* file access property list */
@ -150,10 +154,12 @@ int MPI_Type_create_resized(MPI_Datatype oldtype, MPI_Aint lb, MPI_Aint extent,
void
usage(void)
{
printf("Usage: testphdf5 [-r] [-w] [-v] [-f <prefix>] [-d <dim0> <dim1>]\n");
printf("Usage: testphdf5 [-r] [-w] [-v] [-m<n_datasets>] "
"[-f <prefix>] [-d <dim0> <dim1>]\n");
printf("\t-r\t\tno read test\n");
printf("\t-w\t\tno write test\n");
printf("\t-m\t\tno multiple dataset test\n");
printf("\t-m<n_datasets>"
"\tset number of datasets for the multiple dataset test\n");
printf("\t-v\t\tverbose on\n");
printf("\t-f <prefix>\tfilename prefix\n");
printf("\t-d <dim0> <dim1>\tdataset dimensions\n");
@ -188,7 +194,11 @@ parse_options(int argc, char **argv)
break;
case 'w': dowrite = 0;
break;
case 'm': domdset = 0;
case 'm': ndatasets = atoi((*argv+1)+1);
if (ndatasets < 0){
nerrors++;
return(1);
}
break;
case 'v': verbose = 1;
break;
@ -296,9 +306,9 @@ main(int argc, char **argv)
goto finish;
}
if (domdset){
if (ndatasets){
MPI_BANNER("multiple datasets write ...");
multiple_dset_write(filenames[3]);
multiple_dset_write(filenames[3], ndatasets);
}
else{
MPI_BANNER("Multiple datasets test skipped");
@ -335,7 +345,7 @@ main(int argc, char **argv)
MPI_BANNER("read tests skipped");
}
if (!(dowrite || doread || domdset)){
if (!(dowrite || doread || ndatasets)){
usage();
nerrors++;
}

@ -64,11 +64,11 @@
typedef int DATATYPE;
/* shared global variables */
extern int dim0, dim1; /* Dataset dimensions */
extern int chunkdim0, chunkdim1; /* Chunk dimensions */
extern int nerrors; /* errors count */
extern int verbose; /* verbose, default as no. */
extern herr_t (*old_func)(void*); /* previous error handler */
extern void *old_client_data; /* previous error handler arg.*/
extern int dim0, dim1; /*Dataset dimensions */
extern int chunkdim0, chunkdim1; /*Chunk dimensions */
extern int nerrors; /*errors count */
extern int verbose; /*verbose, default as no. */
extern herr_t (*old_func)(void*); /*previous error handler */
extern void *old_client_data; /*previous error handler arg.*/
#endif /* PHDF5TEST_H */