[svn-r564] Purpose:

New feature

Problem:
    Source code must be modified prior to compiling to allow full
    filenames to contain preferred user directories. Source must be
    recompiled everytime the preferred user directory changes.

Solution:
    Instead, allow file prefixes preferred by user to be passed at
    runtime using the arguments "-f <prefix>".  The "-f" to signal the
    next argument is to be a file prefix, and the "<prefix>" to be the
    actual prefix used.

Platform tested:
    ASCI Red
This commit is contained in:
Paul Harten 1998-08-03 15:22:23 -05:00
parent 6c6d0c90a2
commit 96106282bb
3 changed files with 92 additions and 19 deletions

View File

@ -16,7 +16,7 @@ MPIO_INC=-I$(ROMIO)/include
MPIO_LIBS=$(ROMIO)/lib/tflop/libmpio.a
RUN=yod -sz 8
RUNSEQ=yod -sz 1
TEST_FLAGS=-f "pfs:/pfs/multi/tmp_1/your_own"
LIBS = -lnoop_stubs
CC=cicc
@ -67,7 +67,7 @@ progs: $(PROGS)
# Runs each test in order, passing $(TEST_FLAGS) to the program.
test: $(PROGS)
$(RUN) testphdf5
$(RUN) testphdf5 $(TEST_FLAGS)
# Removes temporary files without removing the final target files. That is,
# remove things like object files but not libraries or executables.

View File

@ -1,6 +1,6 @@
hdf5/testpar/README
-------------------
(last update: Feb 16 1998)
(last update: Aug 3rd 1998)
This directory holds tests for the parallel HDF5 library. It is in
its "infancy" and is not integrated with the rest of the HDF5 software
@ -8,14 +8,35 @@ yet. It will be smothed out in the next release.
Steps to compile and test:
1) Makefile.irix64 is one that works for IRIX64 -64 platform.
You may use it as a template to create Makefile for other platforms.
1a) Makefile.irix64 is one that works for IRIX64 -64 platform.
You may use it as a template to create Makefile for other platforms.
2) "make all" creates two tests. testphdf5 uses parallel I/O access
while shdf5 does the same tests but uses the default sequential I/O
access.
1b) Makefile.ascired is one that works for the ASCI Red platform.
3) "make test" runs both tests.
2) "make all -f Makefile.xxxxx >&! make.out1" creates testphdf5.
3) "make test -f Makefile.xxxxx >&! make.out2" runs testphdf5.
When running "make test -f Makefile.xxxxx" the line that executes is:
$(RUN) testphdf5 $(TEST_FLAGS)
For the ASCI Red users:
In the file Makefile.ascired, the variables RUN and TEST_FLAGS are:
RUN=yod -sz 8
TEST_FLAGS=-f "pfs:/pfs/multi/tmp_1/your_own"
The TEST_FLAGS variable contains an optional file prefix which needs
to be changed to your own Intel PFS directory name.
/* change "your_own" to your own directory name */
RUN=yod -sz 8
TEST_FLAGS=-f "pfs:/pfs/multi/tmp_1/my_dir"
After the above change to Makefile.ascired, upon execution of
"make test -f Makefile.ascired >&! make.out2",
the prefix will be attached to filenames in testphdf5 at execution.
----

View File

@ -9,6 +9,15 @@
/* global variables */
int nerrors = 0; /* errors count */
int verbose = 0; /* verbose, default as no. */
#ifdef POOMA_ARCH
char *fileprefix = "pfs:/pfs/multi/tmp_1/your_own";
int fileprefixlen = 29;
#else
char *fileprefix = NULL; /* file prefix, default as NULL */
int fileprefixlen = 0; /* file prefix length, default as 0 */
#endif
herr_t (*old_func)(void*); /* previous error handler */
void *old_client_data; /* previous error handler arg.*/
@ -69,10 +78,11 @@ void pause_proc(MPI_Comm comm, int argc, char **argv)
void
usage()
{
printf("Usage: testphdf5 [-r] [-w] [-v]\n");
printf("\t-r\tno read\n");
printf("\t-w\tno write\n");
printf("\t-v\tverbose on\n");
printf("Usage: testphdf5 [-r] [-w] [-v] [-f <prefix>]\n");
printf("\t-f <prefix>\tfilename prefix\n");
printf("\t-r\t\tno read\n");
printf("\t-w\t\tno write\n");
printf("\t-v\t\tverbose on\n");
printf("\tdefault do write then read\n");
printf("\n");
}
@ -94,6 +104,36 @@ parse_options(int argc, char **argv){
break;
case 'v': verbose = 1;
break;
case 'f': if (--argc <= 0) {
nerrors++;
return(1);
} else if (**(++argv) == '-') {
nerrors++;
return(1);
} else if (**(argv) == '"') {
fileprefixlen = strlen(*(argv)+1)-1;
fileprefix = (char *)HDmalloc(fileprefixlen+1);
if (!fileprefix) {
printf("%s\n","memory allocation failed");
nerrors++;
return(1);
}
fileprefix = strncpy(fileprefix,*(argv)+1,fileprefixlen);
} else {
fileprefixlen = strlen(*(argv));
fileprefix = (char *)HDmalloc(fileprefixlen+1);
if (!fileprefix) {
printf("%s\n","memory allocation failed");
nerrors++;
return(1);
}
fileprefix = strncpy(fileprefix,*(argv),fileprefixlen);
}
if (fileprefixlen < 5) {
nerrors++;
return(1);
}
break;
default: usage();
nerrors++;
return(1);
@ -106,17 +146,13 @@ parse_options(int argc, char **argv){
main(int argc, char **argv)
{
#ifdef POOMA_ARCH
char *filenames[]={ "pfs:/pfs/multi/tmp_1/your_own/ParaEg1.h5f",
"pfs:/pfs/multi/tmp_1/your_own/ParaEg2.h5f",
"pfs:/pfs/multi/tmp_1/your_own/ParaEg3.h5f" };
#else
char *filenames[]={ "ParaEg1.h5f",
"ParaEg2.h5f",
"ParaEg3.h5f" };
#endif
int mpi_size, mpi_rank; /* mpi variables */
int i;
char *tmpptr;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
@ -144,6 +180,22 @@ main(int argc, char **argv)
if (parse_options(argc, argv) != 0)
goto finish;
if (fileprefix != NULL) {
for (i=0;i<3;i++) {
tmpptr = filenames[i];
filenames[i] = (char *)HDmalloc ( fileprefixlen + strlen(tmpptr) + 2);
if (!filenames[i]) {
printf("%s\n","memory allocation failed");
nerrors++;
goto finish;
}
filenames[i] = strcpy(filenames[i],fileprefix);
if (fileprefix[fileprefixlen-1] != '/') filenames[i] = strcat(filenames[i],"/");
filenames[i] = strcat(filenames[i],tmpptr);
H5MM_xfree(tmpptr);
}
}
if (dowrite){
MPI_BANNER("testing dataset using split communicators...");
test_split_comm_access(filenames);