2003-04-01 02:02:10 +08:00
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
* Copyright by the Board of Trustees of the University of Illinois. *
|
|
|
|
* All rights reserved. *
|
|
|
|
* *
|
|
|
|
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
|
|
|
* terms governing use, modification, and redistribution, is contained in *
|
|
|
|
* the files COPYING and Copyright.html. COPYING can be found at the root *
|
|
|
|
* of the source code distribution tree; Copyright.html can be found at the *
|
|
|
|
* root level of an installed copy of the electronic HDF5 document set and *
|
|
|
|
* is linked from the top-level documents page. It can also be found at *
|
|
|
|
* http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
|
|
|
|
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
|
|
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
|
|
|
1998-02-17 05:06:48 +08:00
|
|
|
/*
|
1998-07-02 05:33:35 +08:00
|
|
|
* Main driver of the Parallel HDF5 tests
|
1998-02-17 05:06:48 +08:00
|
|
|
*/
|
1998-02-14 14:22:11 +08:00
|
|
|
|
2001-04-06 01:09:42 +08:00
|
|
|
#include "testphdf5.h"
|
1998-04-13 12:35:49 +08:00
|
|
|
|
2001-05-12 06:01:08 +08:00
|
|
|
#ifndef PATH_MAX
|
|
|
|
#define PATH_MAX 512
|
|
|
|
#endif /* !PATH_MAX */
|
2000-12-13 07:12:57 +08:00
|
|
|
|
1998-04-13 12:35:49 +08:00
|
|
|
/* global variables */
|
1999-07-01 06:04:22 +08:00
|
|
|
int dim0 = DIM0;
|
|
|
|
int dim1 = DIM1;
|
1999-07-03 08:27:36 +08:00
|
|
|
int chunkdim0;
|
|
|
|
int chunkdim1;
|
1998-07-06 06:58:37 +08:00
|
|
|
int nerrors = 0; /* errors count */
|
2001-06-21 04:11:11 +08:00
|
|
|
int ndatasets = 300; /* number of datasets to create*/
|
|
|
|
int ngroups = 512; /* number of groups to create in root
|
|
|
|
* group. */
|
2001-11-02 23:21:51 +08:00
|
|
|
int facc_type = FACC_MPIO; /*Test file access type */
|
1998-08-04 04:22:23 +08:00
|
|
|
|
2003-10-14 03:26:55 +08:00
|
|
|
H5E_auto_t old_func; /* previous error handler */
|
1998-07-06 06:58:37 +08:00
|
|
|
void *old_client_data; /* previous error handler arg.*/
|
1998-07-02 05:33:35 +08:00
|
|
|
|
|
|
|
/* other option flags */
|
1998-04-13 12:35:49 +08:00
|
|
|
int doread=1; /* read test */
|
|
|
|
int dowrite=1; /* write test */
|
2002-08-21 00:18:02 +08:00
|
|
|
int docompact=1; /* compact dataset test */
|
2004-05-18 03:59:04 +08:00
|
|
|
int donull=1; /* null dataset test */
|
2003-02-19 05:50:42 +08:00
|
|
|
int doindependent=1; /* independent test */
|
2003-10-09 04:29:27 +08:00
|
|
|
unsigned dobig=0; /* "big" dataset tests */
|
2003-02-19 05:50:42 +08:00
|
|
|
|
2000-01-26 12:33:38 +08:00
|
|
|
/* FILENAME and filenames must have the same number of names */
|
2004-07-22 07:42:10 +08:00
|
|
|
const char *FILENAME[15]={
|
2000-01-26 12:33:38 +08:00
|
|
|
"ParaEg1",
|
|
|
|
"ParaEg2",
|
|
|
|
"ParaEg3",
|
|
|
|
"ParaMdset",
|
2001-06-21 04:11:11 +08:00
|
|
|
"ParaMgroup",
|
2002-08-21 00:18:02 +08:00
|
|
|
"ParaCompact",
|
2004-05-18 03:59:04 +08:00
|
|
|
"ParaNull",
|
2003-02-19 05:50:42 +08:00
|
|
|
"ParaIndividual",
|
2003-09-17 01:33:00 +08:00
|
|
|
"ParaBig",
|
2004-01-03 10:54:50 +08:00
|
|
|
"ParaFill",
|
2004-07-21 05:41:44 +08:00
|
|
|
"ParaCC1",
|
|
|
|
"ParaCC2",
|
|
|
|
"ParaCC3",
|
2004-07-22 07:42:10 +08:00
|
|
|
"ParaCC4",
|
2000-01-26 12:33:38 +08:00
|
|
|
NULL};
|
2004-07-22 07:42:10 +08:00
|
|
|
char filenames[15][PATH_MAX];
|
2000-10-20 14:19:21 +08:00
|
|
|
hid_t fapl; /* file access property list */
|
1999-04-27 12:12:18 +08:00
|
|
|
|
1998-04-13 12:35:49 +08:00
|
|
|
#ifdef USE_PAUSE
|
1998-03-31 01:03:46 +08:00
|
|
|
/* pause the process for a moment to allow debugger to attach if desired. */
|
|
|
|
/* Will pause more if greenlight file is not persent but will eventually */
|
|
|
|
/* continue. */
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
1999-12-18 02:54:52 +08:00
|
|
|
|
1999-12-20 22:53:44 +08:00
|
|
|
void pause_proc(void)
|
1998-03-31 01:03:46 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
int pid;
|
2002-04-23 04:24:59 +08:00
|
|
|
h5_stat_t statbuf;
|
1998-03-31 01:03:46 +08:00
|
|
|
char greenlight[] = "go";
|
|
|
|
int maxloop = 10;
|
1998-04-13 12:35:49 +08:00
|
|
|
int loops = 0;
|
1998-03-31 01:03:46 +08:00
|
|
|
int time_int = 10;
|
|
|
|
|
1998-07-02 05:33:35 +08:00
|
|
|
/* mpi variables */
|
|
|
|
int mpi_size, mpi_rank;
|
|
|
|
int mpi_namelen;
|
|
|
|
char mpi_name[MPI_MAX_PROCESSOR_NAME];
|
|
|
|
|
1998-03-31 01:03:46 +08:00
|
|
|
pid = getpid();
|
1998-07-02 05:33:35 +08:00
|
|
|
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
|
|
|
|
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
|
|
|
|
MPI_Get_processor_name(mpi_name, &mpi_namelen);
|
1998-03-31 01:03:46 +08:00
|
|
|
|
1998-07-02 05:33:35 +08:00
|
|
|
if (MAINPROCESS)
|
1998-04-13 12:35:49 +08:00
|
|
|
while ((stat(greenlight, &statbuf) == -1) && loops < maxloop){
|
|
|
|
if (!loops++){
|
1998-07-13 13:35:14 +08:00
|
|
|
printf("Proc %d (%*s, %d): to debug, attach %d\n",
|
1998-04-13 12:35:49 +08:00
|
|
|
mpi_rank, mpi_namelen, mpi_name, pid, pid);
|
|
|
|
}
|
|
|
|
printf("waiting(%ds) for file %s ...\n", time_int, greenlight);
|
1998-03-31 01:03:46 +08:00
|
|
|
fflush(stdout);
|
|
|
|
sleep(time_int);
|
|
|
|
}
|
1999-12-18 02:54:52 +08:00
|
|
|
MPI_Barrier(MPI_COMM_WORLD);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Use the Profile feature of MPI to call the pause_proc() */
|
|
|
|
int MPI_Init(int *argc, char ***argv)
|
|
|
|
{
|
|
|
|
int ret_code;
|
|
|
|
ret_code=PMPI_Init(argc, argv);
|
|
|
|
pause_proc();
|
|
|
|
return (ret_code);
|
1998-03-31 01:03:46 +08:00
|
|
|
}
|
1998-04-13 12:35:49 +08:00
|
|
|
#endif /* USE_PAUSE */
|
1998-03-31 01:03:46 +08:00
|
|
|
|
1998-03-11 14:13:01 +08:00
|
|
|
|
1998-04-13 12:35:49 +08:00
|
|
|
/*
|
|
|
|
* Show command usage
|
|
|
|
*/
|
2002-06-20 00:06:55 +08:00
|
|
|
static void
|
1999-04-27 12:12:18 +08:00
|
|
|
usage(void)
|
1998-02-14 14:22:11 +08:00
|
|
|
{
|
2004-01-25 07:04:22 +08:00
|
|
|
printf("Usage: testphdf5 [-r] [-w] [-v<verbosity>] [-m<n_datasets>] [-n<n_groups>] "
|
2002-08-21 00:18:02 +08:00
|
|
|
"[-o] [-f <prefix>] [-d <dim0> <dim1>]\n");
|
2000-10-10 02:23:20 +08:00
|
|
|
printf("\t-r\t\tno read test\n");
|
|
|
|
printf("\t-w\t\tno write test\n");
|
2000-12-13 07:12:57 +08:00
|
|
|
printf("\t-m<n_datasets>"
|
|
|
|
"\tset number of datasets for the multiple dataset test\n");
|
2001-06-21 04:11:11 +08:00
|
|
|
printf("\t-n<n_groups>"
|
|
|
|
"\tset number of groups for the multiple group test\n");
|
2002-08-21 00:18:02 +08:00
|
|
|
printf("\t-o\t\tno compact dataset test\n");
|
2004-05-18 03:59:04 +08:00
|
|
|
printf("\t-e\t\tno null dataset test\n");
|
2003-02-19 05:50:42 +08:00
|
|
|
printf("\t-i\t\tno independent read test\n");
|
2003-10-09 04:29:27 +08:00
|
|
|
printf("\t-b\t\trun big dataset test\n");
|
2004-01-25 07:04:22 +08:00
|
|
|
printf("\t-v<verbosity>\tset verbose level (0-9,l,m,h)\n");
|
1999-07-01 06:04:22 +08:00
|
|
|
printf("\t-f <prefix>\tfilename prefix\n");
|
2001-11-02 23:21:51 +08:00
|
|
|
printf("\t-s\t\tuse Split-file together with MPIO\n");
|
2002-07-15 23:21:44 +08:00
|
|
|
printf("\t-p\t\tuse combo MPI-POSIX driver\n");
|
1999-07-01 06:04:22 +08:00
|
|
|
printf("\t-d <dim0> <dim1>\tdataset dimensions\n");
|
1999-07-03 08:27:36 +08:00
|
|
|
printf("\t-c <dim0> <dim1>\tdataset chunk dimensions\n");
|
1999-07-01 06:04:22 +08:00
|
|
|
printf("\tDefault: do write then read with dimensions %dx%d\n",
|
|
|
|
DIM0, DIM1);
|
1998-02-14 14:22:11 +08:00
|
|
|
printf("\n");
|
|
|
|
}
|
1998-03-11 14:13:01 +08:00
|
|
|
|
|
|
|
|
1998-04-13 12:35:49 +08:00
|
|
|
/*
|
|
|
|
* parse the command line options
|
|
|
|
*/
|
2002-08-27 21:42:40 +08:00
|
|
|
static int
|
1999-07-01 06:04:22 +08:00
|
|
|
parse_options(int argc, char **argv)
|
|
|
|
{
|
|
|
|
int mpi_size, mpi_rank; /* mpi variables */
|
|
|
|
|
|
|
|
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
|
|
|
|
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
|
|
|
|
|
1999-07-03 08:27:36 +08:00
|
|
|
/* setup default chunk-size. Make sure sizes are > 0 */
|
|
|
|
chunkdim0 = (dim0+9)/10;
|
|
|
|
chunkdim1 = (dim1+9)/10;
|
|
|
|
|
1998-02-14 14:22:11 +08:00
|
|
|
while (--argc){
|
|
|
|
if (**(++argv) != '-'){
|
|
|
|
break;
|
|
|
|
}else{
|
|
|
|
switch(*(*argv+1)){
|
1998-03-31 01:03:46 +08:00
|
|
|
case 'r': doread = 0;
|
|
|
|
break;
|
|
|
|
case 'w': dowrite = 0;
|
|
|
|
break;
|
2000-12-13 07:12:57 +08:00
|
|
|
case 'm': ndatasets = atoi((*argv+1)+1);
|
|
|
|
if (ndatasets < 0){
|
|
|
|
nerrors++;
|
|
|
|
return(1);
|
|
|
|
}
|
2000-10-10 02:23:20 +08:00
|
|
|
break;
|
2001-06-21 04:11:11 +08:00
|
|
|
case 'n': ngroups = atoi((*argv+1)+1);
|
|
|
|
if (ngroups < 0){
|
|
|
|
nerrors++;
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
break;
|
2002-08-21 00:18:02 +08:00
|
|
|
case 'o': docompact = 0;
|
|
|
|
break;
|
2004-05-18 03:59:04 +08:00
|
|
|
case 'e': donull = 0;
|
|
|
|
break;
|
2003-02-19 05:50:42 +08:00
|
|
|
case 'i': doindependent = 0;
|
|
|
|
break;
|
2003-10-09 04:29:27 +08:00
|
|
|
case 'b': dobig = 1;
|
2003-09-17 01:33:00 +08:00
|
|
|
break;
|
2004-01-25 07:04:22 +08:00
|
|
|
case 'v': if (*((*argv+1)+1))
|
|
|
|
ParseTestVerbosity((*argv+1)+1);
|
|
|
|
else
|
|
|
|
SetTestVerbosity(VERBO_MED);
|
1998-03-31 01:03:46 +08:00
|
|
|
break;
|
1999-07-01 06:04:22 +08:00
|
|
|
case 'f': if (--argc < 1) {
|
1998-08-04 04:22:23 +08:00
|
|
|
nerrors++;
|
|
|
|
return(1);
|
|
|
|
}
|
1999-04-27 12:12:18 +08:00
|
|
|
if (**(++argv) == '-') {
|
1998-08-04 04:22:23 +08:00
|
|
|
nerrors++;
|
|
|
|
return(1);
|
|
|
|
}
|
2000-01-26 12:33:38 +08:00
|
|
|
paraprefix = *argv;
|
1998-08-04 04:22:23 +08:00
|
|
|
break;
|
2002-07-15 23:21:44 +08:00
|
|
|
case 'p': /* Use the MPI-POSIX driver access */
|
|
|
|
facc_type = FACC_MPIPOSIX;
|
|
|
|
break;
|
2001-11-02 23:21:51 +08:00
|
|
|
case 's': /* Use the split-file driver with MPIO access */
|
|
|
|
/* Can use $HDF5_METAPREFIX to define the */
|
|
|
|
/* meta-file-prefix. */
|
|
|
|
facc_type = FACC_MPIO | FACC_SPLIT;
|
|
|
|
break;
|
1999-07-01 06:04:22 +08:00
|
|
|
case 'd': /* dimensizes */
|
|
|
|
if (--argc < 2){
|
|
|
|
nerrors++;
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
dim0 = atoi(*(++argv));
|
|
|
|
argc--;
|
|
|
|
dim1 = atoi(*(++argv));
|
1999-07-03 08:27:36 +08:00
|
|
|
/* set default chunkdim sizes too */
|
|
|
|
chunkdim0 = (dim0+9)/10;
|
|
|
|
chunkdim1 = (dim1+9)/10;
|
|
|
|
break;
|
|
|
|
case 'c': /* chunk dimensions */
|
|
|
|
if (--argc < 2){
|
|
|
|
nerrors++;
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
chunkdim0 = atoi(*(++argv));
|
|
|
|
argc--;
|
|
|
|
chunkdim1 = atoi(*(++argv));
|
1999-07-01 06:04:22 +08:00
|
|
|
break;
|
|
|
|
case 'h': /* print help message--return with nerrors set */
|
|
|
|
return(1);
|
1999-04-27 12:12:18 +08:00
|
|
|
default: nerrors++;
|
1998-04-13 12:35:49 +08:00
|
|
|
return(1);
|
1998-02-14 14:22:11 +08:00
|
|
|
}
|
|
|
|
}
|
1999-04-27 12:12:18 +08:00
|
|
|
} /*while*/
|
|
|
|
|
1999-07-03 08:27:36 +08:00
|
|
|
/* check validity of dimension and chunk sizes */
|
1999-07-01 06:04:22 +08:00
|
|
|
if (dim0 <= 0 || dim1 <= 0){
|
|
|
|
printf("Illegal dim sizes (%d, %d)\n", dim0, dim1);
|
|
|
|
nerrors++;
|
|
|
|
return(1);
|
|
|
|
}
|
1999-07-03 08:27:36 +08:00
|
|
|
if (chunkdim0 <= 0 || chunkdim1 <= 0){
|
|
|
|
printf("Illegal chunkdim sizes (%d, %d)\n", chunkdim0, chunkdim1);
|
|
|
|
nerrors++;
|
|
|
|
return(1);
|
|
|
|
}
|
1999-07-01 06:04:22 +08:00
|
|
|
|
|
|
|
/* Make sure datasets can be divided into equal portions by the processes */
|
|
|
|
if ((dim0 % mpi_size) || (dim1 % mpi_size)){
|
|
|
|
if (MAINPROCESS)
|
|
|
|
printf("dim0(%d) and dim1(%d) must be multiples of processes(%d)\n",
|
|
|
|
dim0, dim1, mpi_size);
|
|
|
|
nerrors++;
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
2000-01-26 12:33:38 +08:00
|
|
|
/* compose the test filenames */
|
|
|
|
{
|
|
|
|
int i, n;
|
|
|
|
|
|
|
|
n = sizeof(FILENAME)/sizeof(FILENAME[0]) - 1; /* exclude the NULL */
|
|
|
|
|
|
|
|
for (i=0; i < n; i++)
|
2000-10-20 14:19:21 +08:00
|
|
|
if (h5_fixname(FILENAME[i],fapl,filenames[i],sizeof(filenames[i]))
|
2000-01-26 12:33:38 +08:00
|
|
|
== NULL){
|
|
|
|
printf("h5_fixname failed\n");
|
1999-04-27 12:12:18 +08:00
|
|
|
nerrors++;
|
|
|
|
return(1);
|
|
|
|
}
|
2000-10-20 14:19:21 +08:00
|
|
|
printf("Test filenames are:\n");
|
|
|
|
for (i=0; i < n; i++)
|
|
|
|
printf(" %s\n", filenames[i]);
|
1998-02-14 14:22:11 +08:00
|
|
|
}
|
1999-04-27 12:12:18 +08:00
|
|
|
|
1998-04-13 12:35:49 +08:00
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-11-02 23:21:51 +08:00
|
|
|
/*
|
|
|
|
* Create the appropriate File access property list
|
|
|
|
*/
|
|
|
|
hid_t
|
2003-05-06 04:48:33 +08:00
|
|
|
create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type,
|
|
|
|
hbool_t use_gpfs)
|
2001-11-02 23:21:51 +08:00
|
|
|
{
|
|
|
|
hid_t ret_pl = -1;
|
|
|
|
herr_t ret; /* generic return value */
|
|
|
|
int mpi_rank; /* mpi variables */
|
|
|
|
|
|
|
|
/* need the rank for error checking macros */
|
|
|
|
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
|
|
|
|
|
|
|
|
ret_pl = H5Pcreate (H5P_FILE_ACCESS);
|
|
|
|
VRFY((ret_pl >= 0), "H5P_FILE_ACCESS");
|
|
|
|
|
2002-06-20 00:06:55 +08:00
|
|
|
if (l_facc_type == FACC_DEFAULT)
|
2001-11-02 23:21:51 +08:00
|
|
|
return (ret_pl);
|
|
|
|
|
2002-06-20 00:06:55 +08:00
|
|
|
if (l_facc_type == FACC_MPIO){
|
2001-11-02 23:21:51 +08:00
|
|
|
/* set Parallel access with communicator */
|
|
|
|
ret = H5Pset_fapl_mpio(ret_pl, comm, info);
|
|
|
|
VRFY((ret >= 0), "");
|
|
|
|
return(ret_pl);
|
|
|
|
}
|
|
|
|
|
2002-06-20 00:06:55 +08:00
|
|
|
if (l_facc_type == (FACC_MPIO | FACC_SPLIT)){
|
2001-11-02 23:21:51 +08:00
|
|
|
hid_t mpio_pl;
|
|
|
|
|
|
|
|
mpio_pl = H5Pcreate (H5P_FILE_ACCESS);
|
|
|
|
VRFY((mpio_pl >= 0), "");
|
|
|
|
/* set Parallel access with communicator */
|
|
|
|
ret = H5Pset_fapl_mpio(mpio_pl, comm, info);
|
|
|
|
VRFY((ret >= 0), "");
|
|
|
|
|
|
|
|
/* setup file access template */
|
|
|
|
ret_pl = H5Pcreate (H5P_FILE_ACCESS);
|
|
|
|
VRFY((ret_pl >= 0), "");
|
|
|
|
/* set Parallel access with communicator */
|
|
|
|
ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl);
|
|
|
|
VRFY((ret >= 0), "H5Pset_fapl_split succeeded");
|
|
|
|
H5Pclose(mpio_pl);
|
|
|
|
return(ret_pl);
|
|
|
|
}
|
|
|
|
|
2002-07-15 23:21:44 +08:00
|
|
|
if (l_facc_type == FACC_MPIPOSIX) {
|
|
|
|
/* set Parallel access with communicator */
|
2003-05-06 04:48:33 +08:00
|
|
|
ret = H5Pset_fapl_mpiposix(ret_pl, comm, use_gpfs);
|
|
|
|
VRFY((ret >= 0), "H5Pset_fapl_mpiposix succeeded");
|
2002-07-15 23:21:44 +08:00
|
|
|
return(ret_pl);
|
|
|
|
}
|
|
|
|
|
2001-11-02 23:21:51 +08:00
|
|
|
/* unknown file access types */
|
|
|
|
return (ret_pl);
|
|
|
|
}
|
|
|
|
|
2003-09-17 01:33:00 +08:00
|
|
|
/*
|
|
|
|
* Check the size of a file using MPI routines
|
|
|
|
*/
|
|
|
|
MPI_Offset
|
|
|
|
h5_mpi_get_file_size(const char *filename, MPI_Comm comm, MPI_Info info)
|
|
|
|
{
|
|
|
|
MPI_File fh; /* MPI file handle */
|
|
|
|
MPI_Offset size=0; /* File size to return */
|
|
|
|
|
|
|
|
if (MPI_SUCCESS != MPI_File_open(comm, (char*)filename, MPI_MODE_RDONLY, info, &fh))
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
if (MPI_SUCCESS != (MPI_File_get_size(fh, &size)))
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
if (MPI_SUCCESS != MPI_File_close(&fh))
|
|
|
|
size=0;
|
|
|
|
|
|
|
|
done:
|
|
|
|
return(size);
|
|
|
|
}
|
2001-11-02 23:21:51 +08:00
|
|
|
|
2002-06-20 00:06:55 +08:00
|
|
|
int main(int argc, char **argv)
|
1998-04-13 12:35:49 +08:00
|
|
|
{
|
1998-07-02 05:33:35 +08:00
|
|
|
int mpi_size, mpi_rank; /* mpi variables */
|
2004-04-02 07:00:13 +08:00
|
|
|
H5Ptest_param_t ndsets_params, ngroups_params;
|
|
|
|
H5Ptest_param_t collngroups_params;
|
2004-08-14 06:06:42 +08:00
|
|
|
int Summary = 0;
|
|
|
|
int CleanUp = 1;
|
1998-07-02 05:33:35 +08:00
|
|
|
|
2002-07-15 23:21:44 +08:00
|
|
|
/* Un-buffer the stdout and stderr */
|
|
|
|
setbuf(stderr, NULL);
|
|
|
|
setbuf(stdout, NULL);
|
|
|
|
|
1998-07-02 05:33:35 +08:00
|
|
|
MPI_Init(&argc, &argv);
|
|
|
|
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
|
|
|
|
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
|
|
|
|
|
|
|
|
if (MAINPROCESS){
|
|
|
|
printf("===================================\n");
|
|
|
|
printf("PHDF5 TESTS START\n");
|
|
|
|
printf("===================================\n");
|
|
|
|
}
|
2003-04-18 11:04:56 +08:00
|
|
|
H5open();
|
2002-04-23 04:24:59 +08:00
|
|
|
h5_show_hostname();
|
|
|
|
|
2004-04-02 07:00:13 +08:00
|
|
|
/* Initialize testing framework */
|
|
|
|
TestInit();
|
|
|
|
|
|
|
|
/* Tests are generally arranged from least to most complexity... */
|
|
|
|
AddTest("mpio_dup", test_fapl_mpio_dup, NULL,
|
|
|
|
"fapl_mpio_dup", NULL);
|
|
|
|
AddTest("mpiposix_dup", test_fapl_mpiposix_dup, NULL,
|
|
|
|
"fapl_mpiposix_dup", NULL);
|
|
|
|
|
|
|
|
ndsets_params.name = filenames[3];
|
|
|
|
ndsets_params.count = ndatasets;
|
|
|
|
AddTest("ndatasets", multiple_dset_write, NULL,
|
|
|
|
"multiple datasets write", &ndsets_params);
|
|
|
|
|
|
|
|
ngroups_params.name = filenames[4];
|
|
|
|
ngroups_params.count = ngroups;
|
|
|
|
AddTest("ngroups", multiple_group_write, NULL,
|
|
|
|
"multiple groups write", &ngroups_params);
|
|
|
|
AddTest("ngroups_read", multiple_group_read, NULL,
|
|
|
|
"multiple groups read", &ngroups_params);
|
|
|
|
|
|
|
|
AddTest("split", test_split_comm_access, NULL,
|
|
|
|
"dataset using split communicators", filenames[0]);
|
|
|
|
AddTest("indwrite", dataset_writeInd, NULL,
|
|
|
|
"dataset independent write", filenames[0]);
|
|
|
|
AddTest("collwrite", dataset_writeAll, NULL,
|
|
|
|
"dataset collective write", filenames[1]);
|
|
|
|
AddTest("indwriteext", extend_writeInd, NULL,
|
|
|
|
"extendible dataset independent write", filenames[2]);
|
2004-07-14 02:42:47 +08:00
|
|
|
AddTest("indwriteext2", extend_writeInd2, NULL,
|
|
|
|
"extendible dataset independent write #2", filenames[2]);
|
2004-04-02 07:00:13 +08:00
|
|
|
AddTest("collwriteext", extend_writeAll, NULL,
|
|
|
|
"extendible dataset collective write", filenames[2]);
|
|
|
|
|
|
|
|
AddTest("indread", dataset_readInd, NULL,
|
|
|
|
"dataset independent read", filenames[0]);
|
|
|
|
AddTest("collread", dataset_readAll, NULL,
|
|
|
|
"dataset collective read", filenames[1]);
|
|
|
|
AddTest("indreadext", extend_readInd, NULL,
|
|
|
|
"extendible dataset independent read", filenames[2]);
|
|
|
|
AddTest("collreadext", extend_readAll, NULL,
|
|
|
|
"extendible dataset collective read", filenames[2]);
|
|
|
|
|
|
|
|
AddTest("compact", compact_dataset, NULL,
|
|
|
|
"compact dataset test", filenames[5]);
|
2004-05-18 03:59:04 +08:00
|
|
|
AddTest("null", null_dataset, NULL,
|
|
|
|
"null dataset test", filenames[6]);
|
2004-04-02 07:00:13 +08:00
|
|
|
|
|
|
|
collngroups_params.name = filenames[6];
|
|
|
|
collngroups_params.count = ngroups;
|
|
|
|
AddTest("coll_ngroups", collective_group_write, NULL,
|
|
|
|
"collective group and dataset write", &collngroups_params);
|
|
|
|
AddTest("indngroupsread", independent_group_read, NULL,
|
|
|
|
"independent group and dataset read", &collngroups_params);
|
|
|
|
|
2004-08-08 10:26:44 +08:00
|
|
|
/* By default, do not run big dataset. */
|
|
|
|
AddTest("-bigdataset", big_dataset, NULL,
|
|
|
|
"big dataset test", filenames[7]);
|
2004-04-02 07:00:13 +08:00
|
|
|
AddTest("fillvalue", dataset_fillvalue, NULL,
|
|
|
|
"dataset fill value", filenames[8]);
|
2004-08-13 21:29:43 +08:00
|
|
|
|
2004-08-18 02:44:26 +08:00
|
|
|
if(mpi_size > 64) {
|
2004-08-13 21:29:43 +08:00
|
|
|
if(MAINPROCESS) {
|
2004-08-18 02:44:26 +08:00
|
|
|
printf("Collective chunk IO tests haven't been tested \n");
|
|
|
|
printf(" for the number of process greater than 64.\n");
|
|
|
|
printf("Please try with the number of process \n");
|
|
|
|
printf(" no greater than 64 for collective chunk IO test.\n");
|
|
|
|
printf("Collective chunk tests will be skipped \n");
|
2004-08-13 21:29:43 +08:00
|
|
|
}
|
|
|
|
}
|
2004-08-18 02:44:26 +08:00
|
|
|
else {
|
|
|
|
AddTest("coll_chunked1", coll_chunk1,NULL,
|
|
|
|
"simple collective chunk io",filenames[10]);
|
|
|
|
AddTest("coll_chunked2", coll_chunk2,NULL,
|
|
|
|
"noncontiguous collective chunk io",filenames[11]);
|
|
|
|
AddTest("coll_chunked3", coll_chunk3,NULL,
|
|
|
|
"multi-chunk collective chunk io",filenames[12]);
|
|
|
|
AddTest("coll_chunked4", coll_chunk4,NULL,
|
|
|
|
"collective to independent chunk io",filenames[13]);
|
|
|
|
}
|
2004-08-03 01:51:50 +08:00
|
|
|
|
2004-04-02 07:00:13 +08:00
|
|
|
/* Display testing information */
|
|
|
|
TestInfo(argv[0]);
|
|
|
|
|
2004-08-14 06:06:42 +08:00
|
|
|
/* setup file access property list */
|
|
|
|
fapl = H5Pcreate (H5P_FILE_ACCESS);
|
|
|
|
H5Pset_fapl_mpio(fapl, MPI_COMM_WORLD, MPI_INFO_NULL);
|
|
|
|
|
2004-04-02 07:00:13 +08:00
|
|
|
/* Parse command line arguments */
|
2004-08-14 06:06:42 +08:00
|
|
|
TestParseCmdLine(argc, argv, &Summary, &CleanUp, parse_options);
|
|
|
|
|
|
|
|
/*
|
|
|
|
if (parse_options(argc, argv) != 0){
|
|
|
|
if (MAINPROCESS)
|
|
|
|
usage();
|
|
|
|
goto finish;
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (facc_type == FACC_MPIPOSIX && MAINPROCESS){
|
|
|
|
printf("===================================\n"
|
|
|
|
" Using MPIPOSIX driver\n"
|
|
|
|
"===================================\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Argument requests */
|
|
|
|
if (dobig && sizeof(MPI_Offset)>4){
|
|
|
|
SetTest("bigdataset", ONLYTEST);
|
|
|
|
}
|
2004-04-02 07:00:13 +08:00
|
|
|
|
|
|
|
/* Perform requested testing */
|
|
|
|
PerformTests();
|
|
|
|
|
|
|
|
/* Display test summary, if requested */
|
|
|
|
if (Summary)
|
|
|
|
TestSummary();
|
|
|
|
|
|
|
|
/* Clean up test files, if allowed */
|
|
|
|
if (CleanUp && !getenv("HDF5_NOCLEANUP"))
|
|
|
|
TestCleanup();
|
|
|
|
|
2004-07-14 02:42:47 +08:00
|
|
|
nerrors += GetTestNumErrs();
|
2004-04-02 07:00:13 +08:00
|
|
|
|
|
|
|
|
2004-05-18 03:59:04 +08:00
|
|
|
if (!(dowrite || doread || ndatasets || ngroups || docompact || donull || doindependent || dobig )){
|
1998-02-14 14:22:11 +08:00
|
|
|
usage();
|
1998-03-31 01:03:46 +08:00
|
|
|
nerrors++;
|
|
|
|
}
|
1998-02-14 14:22:11 +08:00
|
|
|
|
1998-03-31 01:03:46 +08:00
|
|
|
finish:
|
2003-04-18 11:04:56 +08:00
|
|
|
/* make sure all processes are finished before final report, cleanup
|
|
|
|
* and exit.
|
|
|
|
*/
|
|
|
|
MPI_Barrier(MPI_COMM_WORLD);
|
2004-07-14 02:42:47 +08:00
|
|
|
|
|
|
|
/* Gather errors from all processes */
|
|
|
|
{
|
|
|
|
int temp;
|
|
|
|
MPI_Reduce(&nerrors, &temp, 1, MPI_INT, MPI_MAX, 0, MPI_COMM_WORLD);
|
|
|
|
if(mpi_rank==0)
|
|
|
|
nerrors=temp;
|
|
|
|
}
|
|
|
|
|
1998-07-02 05:33:35 +08:00
|
|
|
if (MAINPROCESS){ /* only process 0 reports */
|
1998-05-30 03:57:05 +08:00
|
|
|
printf("===================================\n");
|
2004-07-14 02:42:47 +08:00
|
|
|
if (nerrors)
|
1998-03-31 01:03:46 +08:00
|
|
|
printf("***PHDF5 tests detected %d errors***\n", nerrors);
|
2004-07-14 02:42:47 +08:00
|
|
|
else
|
1998-03-31 01:03:46 +08:00
|
|
|
printf("PHDF5 tests finished with no errors\n");
|
1998-05-30 03:57:05 +08:00
|
|
|
printf("===================================\n");
|
1998-03-31 01:03:46 +08:00
|
|
|
}
|
2004-07-14 02:42:47 +08:00
|
|
|
if (dowrite)
|
2000-10-20 14:19:21 +08:00
|
|
|
h5_cleanup(FILENAME, fapl);
|
2004-07-14 02:42:47 +08:00
|
|
|
else
|
2003-02-18 13:12:58 +08:00
|
|
|
/* h5_cleanup would have closed fapl. Now must do it explicitedly */
|
2000-10-20 14:19:21 +08:00
|
|
|
H5Pclose(fapl);
|
2003-02-18 13:12:58 +08:00
|
|
|
|
|
|
|
/* close HDF5 library */
|
|
|
|
H5close();
|
2003-04-18 11:04:56 +08:00
|
|
|
|
2003-02-18 13:12:58 +08:00
|
|
|
/* MPI_Finalize must be called AFTER H5close which may use MPI calls */
|
|
|
|
MPI_Finalize();
|
1998-03-31 01:03:46 +08:00
|
|
|
return(nerrors);
|
1998-02-14 14:22:11 +08:00
|
|
|
}
|
|
|
|
|