Dry-run option to test the configuration / scripts.

master
Julian M. Kunkel 2018-10-11 19:58:30 +01:00
parent 3b5f4fc002
commit 6c5952906b
6 changed files with 82 additions and 24 deletions

View File

@ -241,13 +241,15 @@ static void *HDF5_Open(char *testFileName, IOR_param_t * param)
#endif
/* open file */
if (param->open == WRITE) { /* WRITE */
*fd = H5Fcreate(testFileName, fd_mode,
createPropList, accessPropList);
HDF5_CHECK(*fd, "cannot create file");
} else { /* READ or CHECK */
*fd = H5Fopen(testFileName, fd_mode, accessPropList);
HDF5_CHECK(*fd, "cannot open file");
if(! param->dryRun){
if (param->open == WRITE) { /* WRITE */
*fd = H5Fcreate(testFileName, fd_mode,
createPropList, accessPropList);
HDF5_CHECK(*fd, "cannot create file");
} else { /* READ or CHECK */
*fd = H5Fopen(testFileName, fd_mode, accessPropList);
HDF5_CHECK(*fd, "cannot open file");
}
}
/* show hints actually attached to file handle */
@ -395,6 +397,9 @@ static IOR_offset_t HDF5_Xfer(int access, void *fd, IOR_size_t * buffer,
}
}
if(param->dryRun)
return length;
/* create new data set */
if (startNewDataSet == TRUE) {
/* if just opened this file, no data set to close yet */
@ -440,6 +445,8 @@ static void HDF5_Fsync(void *fd, IOR_param_t * param)
*/
static void HDF5_Close(void *fd, IOR_param_t * param)
{
if(param->dryRun)
return;
if (param->fd_fppReadCheck == NULL) {
HDF5_CHECK(H5Dclose(dataSet), "cannot close data set");
HDF5_CHECK(H5Sclose(dataSpace), "cannot close data space");
@ -459,7 +466,10 @@ static void HDF5_Close(void *fd, IOR_param_t * param)
*/
static void HDF5_Delete(char *testFileName, IOR_param_t * param)
{
return(MPIIO_Delete(testFileName, param));
if(param->dryRun)
return
MPIIO_Delete(testFileName, param);
return;
}
/*
@ -591,7 +601,9 @@ static void SetupDataSet(void *fd, IOR_param_t * param)
static IOR_offset_t
HDF5_GetFileSize(IOR_param_t * test, MPI_Comm testComm, char *testFileName)
{
return(MPIIO_GetFileSize(test, testComm, testFileName));
if(test->dryRun)
return 0;
return(MPIIO_GetFileSize(test, testComm, testFileName));
}
/*
@ -599,5 +611,7 @@ HDF5_GetFileSize(IOR_param_t * test, MPI_Comm testComm, char *testFileName)
*/
static int HDF5_Access(const char *path, int mode, IOR_param_t *param)
{
return(MPIIO_Access(path, mode, param));
if(param->dryRun)
return 0;
return(MPIIO_Access(path, mode, param));
}

View File

@ -69,6 +69,9 @@ ior_aiori_t mpiio_aiori = {
*/
int MPIIO_Access(const char *path, int mode, IOR_param_t *param)
{
if(param->dryRun){
return MPI_SUCCESS;
}
MPI_File fd;
int mpi_mode = MPI_MODE_UNIQUE_OPEN;
@ -93,7 +96,10 @@ int MPIIO_Access(const char *path, int mode, IOR_param_t *param)
*/
static void *MPIIO_Create(char *testFileName, IOR_param_t * param)
{
return MPIIO_Open(testFileName, param);
if(param->dryRun){
return 0;
}
return MPIIO_Open(testFileName, param);
}
/*
@ -171,11 +177,13 @@ static void *MPIIO_Open(char *testFileName, IOR_param_t * param)
ShowHints(&mpiHints);
fprintf(stdout, "}\n");
}
MPI_CHECK(MPI_File_open(comm, testFileName, fd_mode, mpiHints, fd),
if(! param->dryRun){
MPI_CHECK(MPI_File_open(comm, testFileName, fd_mode, mpiHints, fd),
"cannot open file");
}
/* show hints actually attached to file handle */
if (rank == 0 && param->showHints) {
if (rank == 0 && param->showHints && ! param->dryRun) {
if (mpiHints != MPI_INFO_NULL)
MPI_CHECK(MPI_Info_free(&mpiHints), "MPI_Info_free failed");
MPI_CHECK(MPI_File_get_info(*fd, &mpiHints),
@ -186,7 +194,7 @@ static void *MPIIO_Open(char *testFileName, IOR_param_t * param)
}
/* preallocate space for file */
if (param->preallocate && param->open == WRITE) {
if (param->preallocate && param->open == WRITE && ! param->dryRun) {
MPI_CHECK(MPI_File_preallocate(*fd,
(MPI_Offset) (param->segmentCount
*
@ -232,11 +240,13 @@ static void *MPIIO_Open(char *testFileName, IOR_param_t * param)
MPI_CHECK(MPI_Type_commit(&param->fileType),
"cannot commit datatype");
MPI_CHECK(MPI_File_set_view(*fd, (MPI_Offset) 0,
if(! param->dryRun){
MPI_CHECK(MPI_File_set_view(*fd, (MPI_Offset) 0,
param->transferType,
param->fileType, "native",
(MPI_Info) MPI_INFO_NULL),
"cannot set file view");
}
}
if (mpiHints != MPI_INFO_NULL)
MPI_CHECK(MPI_Info_free(&mpiHints), "MPI_Info_free failed");
@ -254,6 +264,9 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer,
will get "assignment from incompatible pointer-type" warnings,
if we only use this one set of signatures. */
if(param->dryRun)
return length;
int (MPIAPI * Access) (MPI_File, void *, int,
MPI_Datatype, MPI_Status *);
int (MPIAPI * Access_at) (MPI_File, MPI_Offset, void *, int,
@ -382,8 +395,10 @@ static IOR_offset_t MPIIO_Xfer(int access, void *fd, IOR_size_t * buffer,
*/
static void MPIIO_Fsync(void *fdp, IOR_param_t * param)
{
if (MPI_File_sync(*(MPI_File *)fdp) != MPI_SUCCESS)
EWARN("fsync() failed");
if(param->dryRun)
return;
if (MPI_File_sync(*(MPI_File *)fdp) != MPI_SUCCESS)
EWARN("fsync() failed");
}
/*
@ -391,7 +406,9 @@ static void MPIIO_Fsync(void *fdp, IOR_param_t * param)
*/
static void MPIIO_Close(void *fd, IOR_param_t * param)
{
MPI_CHECK(MPI_File_close((MPI_File *) fd), "cannot close file");
if(! param->dryRun){
MPI_CHECK(MPI_File_close((MPI_File *) fd), "cannot close file");
}
if ((param->useFileView == TRUE) && (param->fd_fppReadCheck == NULL)) {
/*
* need to free the datatype, so done in the close process
@ -409,8 +426,10 @@ static void MPIIO_Close(void *fd, IOR_param_t * param)
*/
void MPIIO_Delete(char *testFileName, IOR_param_t * param)
{
MPI_CHECK(MPI_File_delete(testFileName, (MPI_Info) MPI_INFO_NULL),
"cannot delete file");
if(param->dryRun)
return;
MPI_CHECK(MPI_File_delete(testFileName, (MPI_Info) MPI_INFO_NULL),
"cannot delete file");
}
/*
@ -473,6 +492,8 @@ static IOR_offset_t SeekOffset(MPI_File fd, IOR_offset_t offset,
IOR_offset_t MPIIO_GetFileSize(IOR_param_t * test, MPI_Comm testComm,
char *testFileName)
{
if(test->dryRun)
return 0;
IOR_offset_t aggFileSizeFromStat, tmpMin, tmpMax, tmpSum;
MPI_File fd;
MPI_Comm comm;

View File

@ -278,6 +278,9 @@ void *POSIX_Create(char *testFileName, IOR_param_t * param)
if (param->useO_DIRECT == TRUE)
set_o_direct_flag(&fd_oflag);
if(param->dryRun)
return 0;
#ifdef HAVE_LUSTRE_LUSTRE_USER_H
if (param->lustre_set_striping) {
/* In the single-shared-file case, task 0 has to creat the
@ -383,6 +386,10 @@ void *POSIX_Open(char *testFileName, IOR_param_t * param)
set_o_direct_flag(&fd_oflag);
fd_oflag |= O_RDWR;
if(param->dryRun)
return 0;
*fd = open64(testFileName, fd_oflag);
if (*fd < 0)
ERR("open64 failed");
@ -419,6 +426,9 @@ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer,
long long rc;
int fd;
if(param->dryRun)
return length;
fd = *(int *)file;
#ifdef HAVE_GPFS_FCNTL_H
@ -500,6 +510,8 @@ static void POSIX_Fsync(void *fd, IOR_param_t * param)
*/
void POSIX_Close(void *fd, IOR_param_t * param)
{
if(param->dryRun)
return;
if (close(*(int *)fd) != 0)
ERR("close() failed");
free(fd);
@ -510,11 +522,14 @@ void POSIX_Close(void *fd, IOR_param_t * param)
*/
void POSIX_Delete(char *testFileName, IOR_param_t * param)
{
char errmsg[256];
sprintf(errmsg, "[RANK %03d]: unlink() of file \"%s\" failed\n",
rank, testFileName);
if (unlink(testFileName) != 0)
if(param->dryRun)
return;
if (unlink(testFileName) != 0){
char errmsg[256];
sprintf(errmsg, "[RANK %03d]: unlink() of file \"%s\" failed\n",
rank, testFileName);
EWARN(errmsg);
}
}
/*
@ -523,6 +538,8 @@ void POSIX_Delete(char *testFileName, IOR_param_t * param)
IOR_offset_t POSIX_GetFileSize(IOR_param_t * test, MPI_Comm testComm,
char *testFileName)
{
if(test->dryRun)
return 0;
struct stat stat_buf;
IOR_offset_t aggFileSizeFromStat, tmpMin, tmpMax, tmpSum;

View File

@ -338,6 +338,7 @@ void ShowTestStart(IOR_param_t *test)
PrintKeyValInt("outlierThreshold", test->outlierThreshold);
PrintKeyVal("options", test->options);
PrintKeyValInt("dryRun", test->dryRun);
PrintKeyValInt("nodes", test->nodes);
PrintKeyValInt("memoryPerTask", (unsigned long) test->memoryPerTask);
PrintKeyValInt("memoryPerNode", (unsigned long) test->memoryPerNode);
@ -442,6 +443,9 @@ void ShowSetup(IOR_param_t *params)
PrintKeyVal("xfersize", HumanReadable(params->transferSize, BASE_TWO));
PrintKeyVal("blocksize", HumanReadable(params->blockSize, BASE_TWO));
PrintKeyVal("aggregate filesize", HumanReadable(params->expectedAggFileSize, BASE_TWO));
if(params->dryRun){
PrintKeyValInt("dryRun", params->dryRun);
}
#ifdef HAVE_LUSTRE_LUSTRE_USER_H
if (params->lustre_set_striping) {

View File

@ -93,6 +93,7 @@ typedef struct
char * testFileName_fppReadCheck;/* filename for fpp read check */
char * hintsFileName; /* full name for hints file */
char * options; /* options string */
int dryRun; /* do not perform any I/Os just run evtl. inputs print dummy output */
int numTasks; /* number of tasks for test */
int nodes; /* number of nodes for test */
int tasksPerNode; /* number of tasks per node */

View File

@ -524,6 +524,7 @@ IOR_test_t *ParseCommandLine(int argc, char **argv)
{'Z', NULL, "reorderTasksRandom -- changes task ordering to random ordering for readback", OPTION_FLAG, 'd', & initialTestParams.reorderTasksRandom},
{.help=" -O summaryFile=FILE -- store result data into this file", .arg = OPTION_OPTIONAL_ARGUMENT},
{.help=" -O summaryFormat=[default,JSON,CSV] -- use the format for outputing the summary", .arg = OPTION_OPTIONAL_ARGUMENT},
{0, "dryRun", "do not perform any I/Os just run evtl. inputs print dummy output", OPTION_FLAG, 'd', & initialTestParams.dryRun},
LAST_OPTION,
};