Replace defaults.h with a simple initializer function.

master
Christopher J. Morrone 2011-11-09 16:13:44 -08:00
parent 877fcd305b
commit 4ae5742f87
7 changed files with 68 additions and 162 deletions

View File

@ -476,8 +476,7 @@ RUN
IOR STOP IOR STOP
===============> stop script <=============== ===============> stop script <===============
NOTES: * Not all test parameters need be set. The defaults can be viewed in NOTES: * Not all test parameters need be set.
IOR/src/C/defaults.h.
* White space is ignored in script, as are comments starting with '#'. * White space is ignored in script, as are comments starting with '#'.

View File

@ -1,7 +1,7 @@
bin_PROGRAMS = ior bin_PROGRAMS = ior
ior_SOURCES = ior.c utilities.c parse_options.c ior_SOURCES = ior.c utilities.c parse_options.c
ior_SOURCES += ior.h aiori.h iordef.h defaults.h ior_SOURCES += ior.h aiori.h iordef.h
ior_LDADD = ior_LDADD =
if USE_POSIX_AIORI if USE_POSIX_AIORI

View File

@ -51,8 +51,8 @@
* The parameter struct holds all of the "global" data to be passed, * The parameter struct holds all of the "global" data to be passed,
* as well as results to be parsed. * as well as results to be parsed.
* *
* NOTE: If this is changed, also change: * NOTE: If IOR_Param_t is changed, also change:
* defaultParameters [defaults.h] * init_IOR_Param_t() [ior.c]
* DisplayUsage() [ior.c] * DisplayUsage() [ior.c]
* ShowTest() [ior.c] * ShowTest() [ior.c]
* DecodeDirective() [parse_options.c] * DecodeDirective() [parse_options.c]
@ -182,4 +182,6 @@ typedef struct ior_aiori {
IOR_offset_t (*get_file_size)(IOR_param_t *, MPI_Comm, char *); IOR_offset_t (*get_file_size)(IOR_param_t *, MPI_Comm, char *);
} ior_aiori_t; } ior_aiori_t;
void init_IOR_Param_t(IOR_param_t *p);
#endif /* not _AIORI_H */ #endif /* not _AIORI_H */

View File

@ -1,134 +0,0 @@
/******************************************************************************\
* *
* Copyright (c) 2003, The Regents of the University of California *
* See the file COPYRIGHT for a complete copyright notice and license. *
* *
********************************************************************************
*
* IOR's default settings
*
\******************************************************************************/
#ifndef _IOR_DEFAULTS_H
#define _IOR_DEFAULTS_H
#include "aiori.h"
/*************************** D E F I N I T I O N S ****************************/
/******************************************************************************/
/*
* Default parameter settings for a test script. This should be the minimum
* test runnable.
*/
IOR_param_t defaultParameters = {
"", /* debug info string */
IOR_IRUSR | /* file permissions */
IOR_IWUSR |
IOR_IRGRP |
IOR_IWGRP,
IOR_RDWR | /* open flags POSIX/MPIIO */
IOR_CREAT,
-1, /* test reference number */
"POSIX", /* api */
"", /* api version */
"HOST(OSTYPE)", /* platform */
"testFile", /* test file */
"", /* filename for fpp read check */
"", /* hints file */
"", /* options */
0, /* numTasks */
1, /* nodes */
1, /* tasks per node */
1, /* repetitions */
-1, /* rep counter */
0, /* multiple files */
0, /* intertest delay */
NULL, NULL, /* write results array */
NULL, NULL, /* read results array */
WRITE, /* used in HDF5 for create(WRITE) and open(READ) */
TRUE, /* read flag */
TRUE, /* write flag */
FALSE, /* file-per-proc flag */
FALSE, /* reorder tasks */
1, /* task file offset for read */
FALSE, /* reorder tasks random */
0, /* reorder tasks random seed offset value*/
FALSE, /* check write */
FALSE, /* check read */
FALSE, /* keep test file on exit */
FALSE, /* keep test file with errors */
FALSE, /* error found in data check */
FALSE, /* halt on error */
FALSE, /* collective I/O */
1, /* segment count */
1048576, /* block size */
262144, /* transfer size */
0, /* offset */
NULL, /* expected aggregate file size array */
NULL, /* stat'ed aggregate file size array */
NULL, /* xfered aggregate file size array */
NULL, /* aggregate file size array used for b/w */
FALSE, /* preallocate file size */
FALSE, /* use file view */
FALSE, /* use shared file pointer */
FALSE, /* use strided datatype */
FALSE, /* use O_DIRECT, bypassing I/O buffers */
FALSE, /* show hints */
FALSE, /* show help */
FALSE, /* unique directory for each file-per-process */
FALSE, /* do not delete test file before access */
FALSE, /* use file offset as stored signature */
0, /* deadline in seconds for any test phase (0=off) */
0, /* max time in minutes to run tests (0=off) */
0, /* warn on outlier N seconds from mean (0=off) */
0, /* verbosity */
0, /* set time stamp signature */
0, /* time stamp signature value */
NULL, /* additional fd for fpp read check */
-1, /* random seed for write/read check */
0, /* access is to random, not sequential, offsets */
MPI_COMM_WORLD, /* MPI communicator */
/* POSIX */
FALSE, /* single transfer (no retry) */
FALSE, /* fsync after each POSIX write */
FALSE, /* fsync after POSIX write close */
/* MPI */
0, /* MPI transfer datatype */
0, /* MPI file view datatype */
/* HDF5 */
FALSE, /* individual data sets */
FALSE, /* no fill */
1, /* alignment */
/* NCMPI */
0, /* var_id handle for datasets */
/* Lustre */
0, /* lustre_stripe_count */
0, /* lustre_stripe_size */
-1, /* lustre_start_ost */
0, /* lustre_set_striping */
0, /* lustre_ignore_locks */
#if USE_UNDOC_OPT
0, /* corrupt file(s) */
0, /* fill the file system */
0, /* include delete time */
0, /* multiple rereads of file */
/* NFS */
"", /* absolute path to NFS servers */
"", /* prefix for NFS server name */
0, /* number of NFS servers to be used */
#endif /* USE_UNDOC_OPT */
0, /* test's unique ID */
0 /* intraTestBarriers */
};
#endif /* not _IOR_DEFAULTS_H */

View File

@ -24,8 +24,7 @@
/************************** D E C L A R A T I O N S ***************************/ /************************** D E C L A R A T I O N S ***************************/
extern IOR_param_t defaultParameters, extern IOR_param_t initialTestParams;
initialTestParams;
extern int errno; /* error number */ extern int errno; /* error number */
extern char ** environ; extern char ** environ;
int totalErrorCount = 0; int totalErrorCount = 0;
@ -136,6 +135,34 @@ main(int argc,
/***************************** F U N C T I O N S ******************************/ /***************************** F U N C T I O N S ******************************/
/*
* Initialize an IOR_param_t structure to the defaults
*/
void init_IOR_Param_t(IOR_param_t *p)
{
memset(p, 0, sizeof(IOR_param_t));
p->mode = IOR_IRUSR|IOR_IWUSR|IOR_IRGRP|IOR_IWGRP;
p->openFlags = IOR_RDWR|IOR_CREAT;
p->TestNum = -1;
strncpy(p->api, "POSIX", MAX_STR); /* FIXME - use first api in list instead */
strncpy(p->platform, "HOST(OSTYPE)", MAX_STR);
strncpy(p->testFileName, "testFile", MAXPATHLEN);
p->nodes = 1;
p->tasksPerNode = 1;
p->repetitions = 1;
p->repCounter = -1;
p->open = WRITE;
p->taskPerNodeOffset = 1;
p->segmentCount = 1;
p->blockSize = 1048576;
p->transferSize = 262144;
p->randomSeed = -1;
p->testComm = MPI_COMM_WORLD;
p->setAlignment = 1;
p->lustre_start_ost = -1;
}
/******************************************************************************/ /******************************************************************************/
/* /*
* Bind the global "backend" pointer to the requested backend AIORI's * Bind the global "backend" pointer to the requested backend AIORI's
@ -2257,18 +2284,21 @@ TimeDeviation(void)
void void
ValidTests(IOR_param_t * test) ValidTests(IOR_param_t * test)
{ {
/* get the version of the tests */ IOR_param_t defaults;
init_IOR_Param_t(&defaults);
/* get the version of the tests */
AioriBind(test->api); AioriBind(test->api);
backend->set_version(test); backend->set_version(test);
if (test->repetitions <= 0) if (test->repetitions <= 0)
WARN_RESET("too few test repetitions", repetitions); WARN_RESET("too few test repetitions",
test, &defaults, repetitions);
if (test->numTasks <= 0) if (test->numTasks <= 0)
ERR("too few tasks for testing"); ERR("too few tasks for testing");
if (test->interTestDelay < 0) if (test->interTestDelay < 0)
WARN_RESET("inter-test delay must be nonnegative value", WARN_RESET("inter-test delay must be nonnegative value",
interTestDelay); test, &defaults, interTestDelay);
if (test->readFile != TRUE && test->writeFile != TRUE if (test->readFile != TRUE && test->writeFile != TRUE
&& test->checkRead != TRUE && test->checkWrite != TRUE) && test->checkRead != TRUE && test->checkWrite != TRUE)
ERR("test must write, read, or check file"); ERR("test must write, read, or check file");
@ -2316,32 +2346,40 @@ ValidTests(IOR_param_t * test)
&& ((test->numTasks * test->blockSize) > (2*(IOR_offset_t)GIBIBYTE))) && ((test->numTasks * test->blockSize) > (2*(IOR_offset_t)GIBIBYTE)))
ERR("segment size must be < 2GiB"); ERR("segment size must be < 2GiB");
if ((strcmp(test->api, "POSIX") != 0) && test->singleXferAttempt) if ((strcmp(test->api, "POSIX") != 0) && test->singleXferAttempt)
WARN_RESET("retry only available in POSIX", singleXferAttempt); WARN_RESET("retry only available in POSIX",
test, &defaults, singleXferAttempt);
if ((strcmp(test->api, "POSIX") != 0) && test->fsync) if ((strcmp(test->api, "POSIX") != 0) && test->fsync)
WARN_RESET("fsync() only available in POSIX", fsync); WARN_RESET("fsync() only available in POSIX",
test, &defaults, fsync);
if ((strcmp(test->api, "MPIIO") != 0) && test->preallocate) if ((strcmp(test->api, "MPIIO") != 0) && test->preallocate)
WARN_RESET("preallocation only available in MPIIO", preallocate); WARN_RESET("preallocation only available in MPIIO",
test, &defaults, preallocate);
if ((strcmp(test->api, "MPIIO") != 0) && test->useFileView) if ((strcmp(test->api, "MPIIO") != 0) && test->useFileView)
WARN_RESET("file view only available in MPIIO", useFileView); WARN_RESET("file view only available in MPIIO",
test, &defaults, useFileView);
if ((strcmp(test->api, "MPIIO") != 0) && test->useSharedFilePointer) if ((strcmp(test->api, "MPIIO") != 0) && test->useSharedFilePointer)
WARN_RESET("shared file pointer only available in MPIIO", WARN_RESET("shared file pointer only available in MPIIO",
useSharedFilePointer); test, &defaults, useSharedFilePointer);
if ((strcmp(test->api, "MPIIO") == 0) && test->useSharedFilePointer) if ((strcmp(test->api, "MPIIO") == 0) && test->useSharedFilePointer)
WARN_RESET("shared file pointer not implemented", useSharedFilePointer); WARN_RESET("shared file pointer not implemented",
test, &defaults, useSharedFilePointer);
if ((strcmp(test->api, "MPIIO") != 0) && test->useStridedDatatype) if ((strcmp(test->api, "MPIIO") != 0) && test->useStridedDatatype)
WARN_RESET("strided datatype only available in MPIIO", WARN_RESET("strided datatype only available in MPIIO",
useStridedDatatype); test, &defaults, useStridedDatatype);
if ((strcmp(test->api, "MPIIO") == 0) && test->useStridedDatatype) if ((strcmp(test->api, "MPIIO") == 0) && test->useStridedDatatype)
WARN_RESET("strided datatype not implemented", useStridedDatatype); WARN_RESET("strided datatype not implemented",
test, &defaults, useStridedDatatype);
if ((strcmp(test->api, "MPIIO") == 0) if ((strcmp(test->api, "MPIIO") == 0)
&& test->useStridedDatatype && test->useStridedDatatype
&& (test->blockSize < sizeof(IOR_size_t) && (test->blockSize < sizeof(IOR_size_t)
|| test->transferSize < sizeof(IOR_size_t))) || test->transferSize < sizeof(IOR_size_t)))
ERR("need larger file size for strided datatype in MPIIO"); ERR("need larger file size for strided datatype in MPIIO");
if ((strcmp(test->api, "POSIX") == 0) && test->showHints) if ((strcmp(test->api, "POSIX") == 0) && test->showHints)
WARN_RESET("hints not available in POSIX", showHints); WARN_RESET("hints not available in POSIX",
test, &defaults, showHints);
if ((strcmp(test->api, "POSIX") == 0) && test->collective) if ((strcmp(test->api, "POSIX") == 0) && test->collective)
WARN_RESET("collective not available in POSIX", collective); WARN_RESET("collective not available in POSIX",
test, &defaults, collective);
if (test->reorderTasks == TRUE && test->reorderTasksRandom == TRUE) if (test->reorderTasks == TRUE && test->reorderTasksRandom == TRUE)
ERR("Both Constant and Random task re-ordering specified. Choose one and resubmit"); ERR("Both Constant and Random task re-ordering specified. Choose one and resubmit");
if (test->randomOffset && test->reorderTasksRandom && test->filePerProc == FALSE) if (test->randomOffset && test->reorderTasksRandom && test->filePerProc == FALSE)
@ -2362,9 +2400,10 @@ ValidTests(IOR_param_t * test)
ERR("random offset not available with NCMPI"); ERR("random offset not available with NCMPI");
if ((strcmp(test->api, "HDF5") != 0) && test->individualDataSets) if ((strcmp(test->api, "HDF5") != 0) && test->individualDataSets)
WARN_RESET("individual datasets only available in HDF5", WARN_RESET("individual datasets only available in HDF5",
individualDataSets); test, &defaults, individualDataSets);
if ((strcmp(test->api, "HDF5") == 0) && test->individualDataSets) if ((strcmp(test->api, "HDF5") == 0) && test->individualDataSets)
WARN_RESET("individual data sets not implemented", individualDataSets); WARN_RESET("individual data sets not implemented",
test, &defaults, individualDataSets);
if ((strcmp(test->api, "NCMPI") == 0) && test->filePerProc) if ((strcmp(test->api, "NCMPI") == 0) && test->filePerProc)
ERR("file-per-proc not available in current NCMPI"); ERR("file-per-proc not available in current NCMPI");
if (test->noFill) { if (test->noFill) {
@ -2635,3 +2674,4 @@ WriteTimes(IOR_param_t * test,
test->id, iteration, (int)rank, timer[i][iteration], timerName); test->id, iteration, (int)rank, timer[i][iteration], timerName);
} }
} /* WriteTimes() */ } /* WriteTimes() */

View File

@ -122,11 +122,11 @@ typedef long long int IOR_size_t;
/* /*
* WARN_RESET will display a custom error message and set value to default * WARN_RESET will display a custom error message and set value to default
*/ */
#define WARN_RESET(MSG, VAL) do { \ #define WARN_RESET(MSG, TO_STRUCT_PTR, FROM_STRUCT_PTR, MEMBER) do { \
test->VAL = defaultParameters.VAL; \ (TO_STRUCT_PTR)->MEMBER = (FROM_STRUCT_PTR)->MEMBER; \
if (rank == 0) { \ if (rank == 0) { \
fprintf(stdout, "WARNING: %s. Using value of %d.\n", \ fprintf(stdout, "WARNING: %s. Using value of %d.\n", \
MSG, test->VAL); \ MSG, (TO_STRUCT_PTR)->MEMBER); \
} \ } \
fflush(stdout); \ fflush(stdout); \
} while (0) } while (0)

View File

@ -10,7 +10,6 @@
\******************************************************************************/ \******************************************************************************/
#include "ior.h" #include "ior.h"
#include "defaults.h" /* IOR defaults */
#include <ctype.h> #include <ctype.h>
#include <stdio.h> #include <stdio.h>
@ -331,7 +330,6 @@ ReadConfigScript(char * scriptName)
return(head); return(head);
} /* ReadConfigScript() */ } /* ReadConfigScript() */
/******************************************************************************/ /******************************************************************************/
/* /*
* Parse Commandline. * Parse Commandline.
@ -348,7 +346,7 @@ ParseCommandLine(int argc, char ** argv)
/* suppress getopt() error message when a character is unrecognized */ /* suppress getopt() error message when a character is unrecognized */
opterr = 0; opterr = 0;
initialTestParams = defaultParameters; init_IOR_Param_t(&initialTestParams);
GetPlatformName(initialTestParams.platform); GetPlatformName(initialTestParams.platform);
initialTestParams.writeFile = initialTestParams.readFile = FALSE; initialTestParams.writeFile = initialTestParams.readFile = FALSE;
initialTestParams.checkWrite = initialTestParams.checkRead = FALSE; initialTestParams.checkWrite = initialTestParams.checkRead = FALSE;
@ -432,3 +430,4 @@ ParseCommandLine(int argc, char ** argv)
return(tests); return(tests);
} /* ParseCommandLine() */ } /* ParseCommandLine() */