2012-01-09 00:51:04 +04:00
/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
* vim : expandtab : shiftwidth = 8 : tabstop = 8 :
*/
2011-06-17 23:20:43 +04:00
/******************************************************************************\
* *
* Copyright ( c ) 2003 , The Regents of the University of California *
* See the file COPYRIGHT for a complete copyright notice and license . *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
2011-10-28 01:12:26 +04:00
* Parse commandline functions .
2011-06-17 23:20:43 +04:00
*
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2011-11-12 04:40:45 +04:00
# ifdef HAVE_CONFIG_H
# include "config.h"
# endif
2011-06-17 23:20:43 +04:00
# include <stdio.h>
# include <stdlib.h>
2011-11-12 04:40:45 +04:00
# include <ctype.h>
2011-06-17 23:20:43 +04:00
# include <string.h>
2018-10-08 23:47:28 +03:00
# if defined(HAVE_STRINGS_H)
# include <strings.h>
# endif
2018-07-07 10:41:33 +03:00
2018-07-07 12:29:27 +03:00
# include "utilities.h"
2011-11-12 04:40:45 +04:00
# include "ior.h"
# include "aiori.h"
# include "parse_options.h"
2018-07-14 10:41:35 +03:00
# include "option.h"
# include "aiori.h"
2011-11-12 04:40:45 +04:00
2011-06-17 23:20:43 +04:00
IOR_param_t initialTestParams ;
2019-03-27 23:04:48 +03:00
option_help * createGlobalOptions ( IOR_param_t * params ) ;
2012-01-09 06:41:30 +04:00
2019-03-27 23:04:48 +03:00
static IOR_param_t * parameters ;
static options_all_t * global_options ;
2012-01-09 06:41:30 +04:00
2011-12-13 09:00:18 +04:00
2011-06-17 23:20:43 +04:00
/*
* Check and correct all settings of each test in queue for correctness .
*/
2011-12-13 09:00:18 +04:00
static void CheckRunSettings ( IOR_test_t * tests )
2011-11-12 02:22:17 +04:00
{
2014-08-26 01:51:28 +04:00
IOR_test_t * ptr ;
IOR_param_t * params ;
for ( ptr = tests ; ptr ! = NULL ; ptr = ptr - > next ) {
params = & ptr - > params ;
2011-12-13 09:00:18 +04:00
2011-11-12 02:22:17 +04:00
/* If no write/read/check action requested, set both write and read */
2011-12-13 09:00:18 +04:00
if ( params - > writeFile = = FALSE
& & params - > readFile = = FALSE
& & params - > checkWrite = = FALSE
& & params - > checkRead = = FALSE ) {
params - > readFile = TRUE ;
params - > writeFile = TRUE ;
2011-11-12 02:22:17 +04:00
}
2014-08-26 01:51:28 +04:00
2019-11-05 17:37:54 +03:00
if ( params - > dualMount & & ! params - > filePerProc ) {
MPI_CHECK ( MPI_Abort ( MPI_COMM_WORLD , - 1 ) , " Dual Mount can only be used with File Per Process " ) ;
}
2011-06-17 23:20:43 +04:00
}
2011-11-12 03:11:28 +04:00
}
2011-06-17 23:20:43 +04:00
/*
* Set flags from commandline string / value pairs .
*/
2019-03-27 23:04:48 +03:00
void DecodeDirective ( char * line , IOR_param_t * params , options_all_t * module_options )
2011-06-17 23:20:43 +04:00
{
2011-11-12 02:22:17 +04:00
char option [ MAX_STR ] ;
char value [ MAX_STR ] ;
int rc ;
2018-10-06 08:20:18 +03:00
int initialized ;
2019-05-23 14:47:43 +03:00
2011-11-12 02:22:17 +04:00
rc = sscanf ( line , " %[^=# \t \r \n ] = %[^# \t \r \n ] " , option , value ) ;
if ( rc ! = 2 & & rank = = 0 ) {
2018-07-07 12:29:27 +03:00
fprintf ( out_logfile , " Syntax error in configuration options: %s \n " ,
2011-11-12 02:22:17 +04:00
line ) ;
2018-10-06 08:20:18 +03:00
MPI_CHECK ( MPI_Initialized ( & initialized ) , " MPI_Initialized() error " ) ;
if ( initialized )
MPI_CHECK ( MPI_Abort ( MPI_COMM_WORLD , - 1 ) , " MPI_Abort() error " ) ;
else
exit ( - 1 ) ;
2011-11-12 02:22:17 +04:00
}
if ( strcasecmp ( option , " api " ) = = 0 ) {
2018-07-14 11:05:23 +03:00
params - > api = strdup ( value ) ;
2019-03-27 23:04:48 +03:00
params - > backend = aiori_select ( params - > api ) ;
if ( params - > backend = = NULL ) {
fprintf ( out_logfile , " Could not load backend API %s \n " , params - > api ) ;
exit ( - 1 ) ;
}
2018-07-08 15:07:32 +03:00
} else if ( strcasecmp ( option , " summaryFile " ) = = 0 ) {
2018-07-08 16:59:54 +03:00
if ( rank = = 0 ) {
out_resultfile = fopen ( value , " w " ) ;
if ( out_resultfile = = NULL ) {
FAIL ( " Cannot open output file for writes! " ) ;
}
printf ( " Writing output to %s \n " , value ) ;
2018-07-08 15:07:32 +03:00
}
} else if ( strcasecmp ( option , " summaryFormat " ) = = 0 ) {
2018-07-08 16:59:54 +03:00
if ( strcasecmp ( value , " default " ) = = 0 ) {
2018-07-08 15:07:32 +03:00
outputFormat = OUTPUT_DEFAULT ;
2018-07-08 16:59:54 +03:00
} else if ( strcasecmp ( value , " JSON " ) = = 0 ) {
2018-07-08 15:07:32 +03:00
outputFormat = OUTPUT_JSON ;
2018-07-08 16:59:54 +03:00
} else if ( strcasecmp ( value , " CSV " ) = = 0 ) {
2018-07-08 15:07:32 +03:00
outputFormat = OUTPUT_CSV ;
} else {
FAIL ( " Unknown summaryFormat " ) ;
}
2012-01-14 02:05:13 +04:00
} else if ( strcasecmp ( option , " refnum " ) = = 0 ) {
params - > referenceNumber = atoi ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " debug " ) = = 0 ) {
2018-07-14 11:05:23 +03:00
params - > debug = strdup ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " platform " ) = = 0 ) {
2018-07-14 11:05:23 +03:00
params - > platform = strdup ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " testfile " ) = = 0 ) {
2018-07-14 11:05:23 +03:00
params - > testFileName = strdup ( value ) ;
2019-11-05 17:37:54 +03:00
} else if ( strcasecmp ( option , " dualmount " ) = = 0 ) {
params - > dualMount = atoi ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " deadlineforstonewalling " ) = = 0 ) {
2011-12-13 09:00:18 +04:00
params - > deadlineForStonewalling = atoi ( value ) ;
2017-10-20 19:02:24 +03:00
} else if ( strcasecmp ( option , " stoneWallingWearOut " ) = = 0 ) {
params - > stoneWallingWearOut = atoi ( value ) ;
2017-10-21 12:59:09 +03:00
} else if ( strcasecmp ( option , " stoneWallingWearOutIterations " ) = = 0 ) {
2018-07-07 12:29:27 +03:00
params - > stoneWallingWearOutIterations = atoll ( value ) ;
2018-07-07 16:01:11 +03:00
} else if ( strcasecmp ( option , " stoneWallingStatusFile " ) = = 0 ) {
2018-07-14 11:05:23 +03:00
params - > stoneWallingStatusFile = strdup ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " maxtimeduration " ) = = 0 ) {
2011-12-13 09:00:18 +04:00
params - > maxTimeDuration = atoi ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " outlierthreshold " ) = = 0 ) {
2011-12-13 09:00:18 +04:00
params - > outlierThreshold = atoi ( value ) ;
2019-08-31 01:45:03 +03:00
} else if ( strcasecmp ( option , " numnodes " ) = = 0 ) {
params - > numNodes = atoi ( value ) ;
} else if ( strcasecmp ( option , " numtasks " ) = = 0 ) {
params - > numTasks = atoi ( value ) ;
} else if ( strcasecmp ( option , " numtasksonnode0 " ) = = 0 ) {
params - > numTasksOnNode0 = atoi ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " repetitions " ) = = 0 ) {
2011-12-13 09:00:18 +04:00
params - > repetitions = atoi ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " intertestdelay " ) = = 0 ) {
2011-12-13 09:00:18 +04:00
params - > interTestDelay = atoi ( value ) ;
2018-09-30 12:01:21 +03:00
} else if ( strcasecmp ( option , " interiodelay " ) = = 0 ) {
params - > interIODelay = atoi ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " readfile " ) = = 0 ) {
2011-12-13 09:00:18 +04:00
params - > readFile = atoi ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " writefile " ) = = 0 ) {
2011-12-13 09:00:18 +04:00
params - > writeFile = atoi ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " fileperproc " ) = = 0 ) {
2011-12-13 09:00:18 +04:00
params - > filePerProc = atoi ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " taskpernodeoffset " ) = = 0 ) {
2011-12-13 09:00:18 +04:00
params - > taskPerNodeOffset = atoi ( value ) ;
2012-01-09 01:21:20 +04:00
} else if ( strcasecmp ( option , " reordertasksconstant " ) = = 0 ) {
params - > reorderTasks = atoi ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " reordertasksrandom " ) = = 0 ) {
2011-12-13 09:00:18 +04:00
params - > reorderTasksRandom = atoi ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " reordertasksrandomSeed " ) = = 0 ) {
2011-12-13 09:00:18 +04:00
params - > reorderTasksRandomSeed = atoi ( value ) ;
2012-01-09 01:21:20 +04:00
} else if ( strcasecmp ( option , " reordertasks " ) = = 0 ) {
/* Backwards compatibility for the "reorderTasks" option.
MUST follow the other longer reordertasks checks . */
params - > reorderTasks = atoi ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " checkwrite " ) = = 0 ) {
2011-12-13 09:00:18 +04:00
params - > checkWrite = atoi ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " checkread " ) = = 0 ) {
2011-12-13 09:00:18 +04:00
params - > checkRead = atoi ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " keepfile " ) = = 0 ) {
2011-12-13 09:00:18 +04:00
params - > keepFile = atoi ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " keepfilewitherror " ) = = 0 ) {
2011-12-13 09:00:18 +04:00
params - > keepFileWithError = atoi ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " multiFile " ) = = 0 ) {
2011-12-13 09:00:18 +04:00
params - > multiFile = atoi ( value ) ;
2020-06-24 13:10:42 +03:00
} else if ( strcasecmp ( option , " warningAsErrors " ) = = 0 ) {
params - > warningAsErrors = atoi ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " segmentcount " ) = = 0 ) {
2018-07-14 10:41:35 +03:00
params - > segmentCount = string_to_bytes ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " blocksize " ) = = 0 ) {
2018-07-14 10:41:35 +03:00
params - > blockSize = string_to_bytes ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " transfersize " ) = = 0 ) {
2018-07-14 10:41:35 +03:00
params - > transferSize = string_to_bytes ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " singlexferattempt " ) = = 0 ) {
2011-12-13 09:00:18 +04:00
params - > singleXferAttempt = atoi ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " intraTestBarriers " ) = = 0 ) {
2011-12-13 09:00:18 +04:00
params - > intraTestBarriers = atoi ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " verbose " ) = = 0 ) {
2011-12-13 09:00:18 +04:00
params - > verbose = atoi ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " settimestampsignature " ) = = 0 ) {
2011-12-13 09:00:18 +04:00
params - > setTimeStampSignature = atoi ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " storefileoffset " ) = = 0 ) {
2011-12-13 09:00:18 +04:00
params - > storeFileOffset = atoi ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " uniqueDir " ) = = 0 ) {
2011-12-13 09:00:18 +04:00
params - > uniqueDir = atoi ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " useexistingtestfile " ) = = 0 ) {
2011-12-13 09:00:18 +04:00
params - > useExistingTestFile = atoi ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " fsyncperwrite " ) = = 0 ) {
2011-12-13 09:00:18 +04:00
params - > fsyncPerWrite = atoi ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " fsync " ) = = 0 ) {
2011-12-13 09:00:18 +04:00
params - > fsync = atoi ( value ) ;
2011-11-12 02:22:17 +04:00
} else if ( strcasecmp ( option , " randomoffset " ) = = 0 ) {
2011-12-13 09:00:18 +04:00
params - > randomOffset = atoi ( value ) ;
2012-01-07 05:29:45 +04:00
} else if ( strcasecmp ( option , " memoryPerTask " ) = = 0 ) {
2018-07-14 10:41:35 +03:00
params - > memoryPerTask = string_to_bytes ( value ) ;
2012-01-09 06:41:30 +04:00
params - > memoryPerNode = 0 ;
} else if ( strcasecmp ( option , " memoryPerNode " ) = = 0 ) {
params - > memoryPerNode = NodeMemoryStringToBytes ( value ) ;
params - > memoryPerTask = 0 ;
2012-01-14 01:27:55 +04:00
} else if ( strcasecmp ( option , " summaryalways " ) = = 0 ) {
params - > summary_every_test = atoi ( value ) ;
2011-11-12 02:22:17 +04:00
} else {
2019-04-02 14:08:31 +03:00
// backward compatibility for now
if ( strcasecmp ( option , " useo_direct " ) = = 0 ) {
strcpy ( option , " --posix.odirect " ) ;
}
2019-03-27 23:04:48 +03:00
int parsing_error = option_parse_key_value ( option , value , module_options ) ;
if ( parsing_error ) {
if ( rank = = 0 )
fprintf ( out_logfile , " Unrecognized parameter \" %s \" \n " ,
option ) ;
MPI_CHECK ( MPI_Initialized ( & initialized ) , " MPI_Initialized() error " ) ;
if ( initialized )
MPI_CHECK ( MPI_Abort ( MPI_COMM_WORLD , - 1 ) , " MPI_Abort() error " ) ;
else
exit ( - 1 ) ;
}
2011-11-12 02:22:17 +04:00
}
2011-11-12 03:11:28 +04:00
}
2011-06-17 23:20:43 +04:00
2019-03-27 23:04:48 +03:00
2011-06-17 23:20:43 +04:00
/*
* Parse a single line , which may contain multiple comma - seperated directives
*/
2019-03-27 23:04:48 +03:00
void ParseLine ( char * line , IOR_param_t * test , options_all_t * module_options )
2011-06-17 23:20:43 +04:00
{
2011-11-12 02:22:17 +04:00
char * start , * end ;
2011-06-17 23:20:43 +04:00
2019-05-23 14:47:43 +03:00
char * newline = strdup ( line ) ;
start = newline ;
2011-11-12 02:22:17 +04:00
do {
2019-04-19 12:20:04 +03:00
end = strchr ( start , ' # ' ) ;
2019-05-23 14:47:43 +03:00
if ( end ! = NULL ) {
2019-04-19 12:20:04 +03:00
* end = ' \0 ' ;
2019-05-23 14:47:43 +03:00
end = NULL ; // stop parsing after comment
}
2011-11-12 02:22:17 +04:00
end = strchr ( start , ' , ' ) ;
2019-05-23 14:47:43 +03:00
if ( end ! = NULL ) {
* end = ' \0 ' ;
}
if ( strlen ( start ) < 3 ) {
fprintf ( out_logfile , " Invalid option substring string: \" %s \" in \" %s \" \n " , start , line ) ;
exit ( 1 ) ;
}
2019-03-27 23:04:48 +03:00
DecodeDirective ( start , test , module_options ) ;
2011-11-12 02:22:17 +04:00
start = end + 1 ;
} while ( end ! = NULL ) ;
2019-05-23 14:47:43 +03:00
free ( newline ) ;
2011-11-12 03:11:28 +04:00
}
2011-06-17 23:20:43 +04:00
2019-05-16 14:56:56 +03:00
static void decodeDirectiveWrapper ( char * line ) {
ParseLine ( line , parameters , global_options ) ;
}
2011-06-17 23:20:43 +04:00
/*
* Determines if the string " haystack " contains only the string " needle " , and
* possibly whitespace before and after needle . Function is case insensitive .
*/
2011-11-12 02:22:17 +04:00
int contains_only ( char * haystack , char * needle )
2011-06-17 23:20:43 +04:00
{
2011-11-12 02:22:17 +04:00
char * ptr , * end ;
2011-06-17 23:20:43 +04:00
2011-11-12 02:22:17 +04:00
end = haystack + strlen ( haystack ) ;
/* skip over leading shitspace */
for ( ptr = haystack ; ptr < end ; ptr + + ) {
if ( ! isspace ( * ptr ) )
break ;
}
/* check for "needle" */
if ( strncasecmp ( ptr , needle , strlen ( needle ) ) ! = 0 )
return 0 ;
2020-07-03 10:09:40 +03:00
/* make sure the rest of the line is only whitespace as well */
2011-11-12 02:22:17 +04:00
for ( ptr + = strlen ( needle ) ; ptr < end ; ptr + + ) {
if ( ! isspace ( * ptr ) )
return 0 ;
}
return 1 ;
2011-11-12 03:11:28 +04:00
}
2011-06-17 23:20:43 +04:00
/*
* Read the configuration script , allocating and filling in the structure of
* global parameters .
*/
2011-12-13 09:00:18 +04:00
IOR_test_t * ReadConfigScript ( char * scriptName )
2011-06-17 23:20:43 +04:00
{
2011-11-12 02:22:17 +04:00
int test_num = 0 ;
int runflag = 0 ;
char linebuf [ MAX_STR ] ;
char empty [ MAX_STR ] ;
2018-10-06 08:50:34 +03:00
char * ptr ;
2011-11-12 02:22:17 +04:00
FILE * file ;
2011-12-13 09:00:18 +04:00
IOR_test_t * head = NULL ;
IOR_test_t * tail = NULL ;
2011-11-12 02:22:17 +04:00
2019-03-27 23:04:48 +03:00
option_help * * option_p = & global_options - > modules [ 0 ] . options ;
2011-11-12 02:22:17 +04:00
/* Initialize the first test */
2019-03-27 23:04:48 +03:00
head = CreateTest ( & initialTestParams , test_num + + ) ;
2011-11-12 02:22:17 +04:00
tail = head ;
2019-03-27 23:04:48 +03:00
* option_p = createGlobalOptions ( & ( ( IOR_test_t * ) head ) - > params ) ; /* The current options */
2011-11-12 02:22:17 +04:00
/* open the script */
file = fopen ( scriptName , " r " ) ;
if ( file = = NULL )
ERR ( " fopen() failed " ) ;
/* search for the "IOR START" line */
while ( fgets ( linebuf , MAX_STR , file ) ! = NULL ) {
if ( contains_only ( linebuf , " ior start " ) ) {
break ;
}
2011-06-17 23:20:43 +04:00
}
2011-11-12 02:22:17 +04:00
/* Iterate over a block of IOR commands */
while ( fgets ( linebuf , MAX_STR , file ) ! = NULL ) {
2018-10-06 08:50:34 +03:00
/* skip over leading whitespace */
ptr = linebuf ;
while ( isspace ( * ptr ) )
ptr + + ;
2011-11-12 02:22:17 +04:00
/* skip empty lines */
2018-10-06 08:50:34 +03:00
if ( sscanf ( ptr , " %s " , empty ) = = - 1 )
2011-11-12 02:22:17 +04:00
continue ;
2018-10-06 08:50:34 +03:00
2011-11-12 02:22:17 +04:00
/* skip lines containing only comments */
2018-10-06 08:50:34 +03:00
if ( sscanf ( ptr , " #%s " , empty ) = = 1 )
2011-11-12 02:22:17 +04:00
continue ;
2018-10-06 08:50:34 +03:00
if ( contains_only ( ptr , " ior stop " ) ) {
2011-11-12 02:22:17 +04:00
break ;
2018-10-06 08:50:34 +03:00
} else if ( contains_only ( ptr , " run " ) ) {
2012-01-14 01:40:03 +04:00
if ( runflag ) {
/* previous line was a "run" as well
create duplicate test */
tail - > next = CreateTest ( & tail - > params , test_num + + ) ;
2018-08-29 19:49:41 +03:00
AllocResults ( tail ) ;
2019-03-27 23:37:46 +03:00
( ( IOR_test_t * ) tail ) - > params . backend_options = airoi_update_module_options ( ( ( IOR_test_t * ) tail ) - > params . backend , global_options ) ;
2019-04-02 14:08:31 +03:00
2012-01-14 01:40:03 +04:00
tail = tail - > next ;
2019-03-27 23:04:48 +03:00
* option_p = createGlobalOptions ( & ( ( IOR_test_t * ) tail - > next ) - > params ) ;
2012-01-14 01:40:03 +04:00
}
2011-11-12 02:22:17 +04:00
runflag = 1 ;
2011-12-13 09:00:18 +04:00
} else if ( runflag ) {
2011-11-12 02:22:17 +04:00
/* If this directive was preceded by a "run" line, then
create and initialize a new test structure */
2014-08-26 01:51:28 +04:00
runflag = 0 ;
tail - > next = CreateTest ( & tail - > params , test_num + + ) ;
2019-03-27 23:04:48 +03:00
* option_p = createGlobalOptions ( & ( ( IOR_test_t * ) tail - > next ) - > params ) ;
2018-08-29 19:49:41 +03:00
AllocResults ( tail ) ;
2019-03-27 23:37:46 +03:00
( ( IOR_test_t * ) tail ) - > params . backend_options = airoi_update_module_options ( ( ( IOR_test_t * ) tail ) - > params . backend , global_options ) ;
2014-08-26 01:51:28 +04:00
tail = tail - > next ;
2019-03-27 23:04:48 +03:00
ParseLine ( ptr , & tail - > params , global_options ) ;
2014-08-26 01:51:28 +04:00
} else {
2019-03-27 23:04:48 +03:00
ParseLine ( ptr , & tail - > params , global_options ) ;
2011-11-12 02:22:17 +04:00
}
2011-06-17 23:20:43 +04:00
}
2011-11-12 02:22:17 +04:00
/* close the script */
if ( fclose ( file ) ! = 0 )
ERR ( " fclose() of script file failed " ) ;
2019-03-27 23:37:46 +03:00
AllocResults ( tail ) ; /* copy the actual module options into the test */
( ( IOR_test_t * ) tail ) - > params . backend_options = airoi_update_module_options ( ( ( IOR_test_t * ) tail ) - > params . backend , global_options ) ;
2011-06-17 23:20:43 +04:00
2011-12-13 09:00:18 +04:00
return head ;
2011-11-12 03:11:28 +04:00
}
2011-06-17 23:20:43 +04:00
2018-07-14 10:41:35 +03:00
2019-03-27 23:04:48 +03:00
option_help * createGlobalOptions ( IOR_param_t * params ) {
char APIs [ 1024 ] ;
char APIs_legacy [ 1024 ] ;
aiori_supported_apis ( APIs , APIs_legacy , IOR ) ;
char apiStr [ 1024 ] ;
sprintf ( apiStr , " API for I/O [%s] " , APIs ) ;
option_help o [ ] = {
{ ' a ' , NULL , apiStr , OPTION_OPTIONAL_ARGUMENT , ' s ' , & params - > api } ,
{ ' A ' , NULL , " refNum -- user supplied reference number to include in the summary " , OPTION_OPTIONAL_ARGUMENT , ' d ' , & params - > referenceNumber } ,
{ ' b ' , NULL , " blockSize -- contiguous bytes to write per task (e.g.: 8, 4k, 2m, 1g) " , OPTION_OPTIONAL_ARGUMENT , ' l ' , & params - > blockSize } ,
2020-05-30 20:19:48 +03:00
{ ' c ' , " collective " , " Use collective I/O " , OPTION_FLAG , ' d ' , & params - > collective } ,
2019-08-01 03:42:03 +03:00
{ ' C ' , NULL , " reorderTasks -- changes task ordering for readback (useful to avoid client cache) " , OPTION_FLAG , ' d ' , & params - > reorderTasks } ,
2019-03-27 23:04:48 +03:00
{ ' d ' , NULL , " interTestDelay -- delay between reps in seconds " , OPTION_OPTIONAL_ARGUMENT , ' d ' , & params - > interTestDelay } ,
{ ' D ' , NULL , " deadlineForStonewalling -- seconds before stopping write or read phase " , OPTION_OPTIONAL_ARGUMENT , ' d ' , & params - > deadlineForStonewalling } ,
2020-07-03 10:09:40 +03:00
{ . help = " -O stoneWallingWearOut=1 -- once the stonewalling timeout is over, all process finish to access the amount of data " , . arg = OPTION_OPTIONAL_ARGUMENT } ,
2019-03-27 23:04:48 +03:00
{ . help = " -O stoneWallingWearOutIterations=N -- stop after processing this number of iterations, needed for reading data back written with stoneWallingWearOut " , . arg = OPTION_OPTIONAL_ARGUMENT } ,
{ . help = " -O stoneWallingStatusFile=FILE -- this file keeps the number of iterations from stonewalling during write and allows to use them for read " , . arg = OPTION_OPTIONAL_ARGUMENT } ,
2019-09-01 17:29:12 +03:00
{ ' e ' , NULL , " fsync -- perform a fsync() operation at the end of each read/write phase " , OPTION_FLAG , ' d ' , & params - > fsync } ,
2019-03-27 23:04:48 +03:00
{ ' E ' , NULL , " useExistingTestFile -- do not remove test file before write access " , OPTION_FLAG , ' d ' , & params - > useExistingTestFile } ,
{ ' f ' , NULL , " scriptFile -- test script name " , OPTION_OPTIONAL_ARGUMENT , ' s ' , & params - > testscripts } ,
{ ' F ' , NULL , " filePerProc -- file-per-process " , OPTION_FLAG , ' d ' , & params - > filePerProc } ,
{ ' g ' , NULL , " intraTestBarriers -- use barriers between open, write/read, and close " , OPTION_FLAG , ' d ' , & params - > intraTestBarriers } ,
/* This option toggles between Incompressible Seed and Time stamp sig based on -l,
* so we ' ll toss the value in both for now , and sort it out in initialization
* after all the arguments are in and we know which it keep .
*/
{ ' G ' , NULL , " setTimeStampSignature -- set value for time stamp signature/random seed " , OPTION_OPTIONAL_ARGUMENT , ' d ' , & params - > setTimeStampSignature } ,
{ ' i ' , NULL , " repetitions -- number of repetitions of test " , OPTION_OPTIONAL_ARGUMENT , ' d ' , & params - > repetitions } ,
{ ' j ' , NULL , " outlierThreshold -- warn on outlier N seconds from mean " , OPTION_OPTIONAL_ARGUMENT , ' d ' , & params - > outlierThreshold } ,
{ ' k ' , NULL , " keepFile -- don't remove the test file(s) on program exit " , OPTION_FLAG , ' d ' , & params - > keepFile } ,
{ ' K ' , NULL , " keepFileWithError -- keep error-filled file(s) after data-checking " , OPTION_FLAG , ' d ' , & params - > keepFileWithError } ,
{ ' l ' , NULL , " datapacket type-- type of packet that will be created [offset|incompressible|timestamp|o|i|t] " , OPTION_OPTIONAL_ARGUMENT , ' s ' , & params - > buffer_type } ,
{ ' m ' , NULL , " multiFile -- use number of reps (-i) for multiple file count " , OPTION_FLAG , ' d ' , & params - > multiFile } ,
{ ' M ' , NULL , " memoryPerNode -- hog memory on the node (e.g.: 2g, 75%) " , OPTION_OPTIONAL_ARGUMENT , ' s ' , & params - > memoryPerNodeStr } ,
2019-08-31 01:45:03 +03:00
{ ' N ' , NULL , " numTasks -- number of tasks that are participating in the test (overrides MPI) " , OPTION_OPTIONAL_ARGUMENT , ' d ' , & params - > numTasks } ,
2019-03-27 23:04:48 +03:00
{ ' o ' , NULL , " testFile -- full name for test " , OPTION_OPTIONAL_ARGUMENT , ' s ' , & params - > testFileName } ,
{ ' O ' , NULL , " string of IOR directives (e.g. -O checkRead=1,lustreStripeCount=32) " , OPTION_OPTIONAL_ARGUMENT , ' p ' , & decodeDirectiveWrapper } ,
{ ' Q ' , NULL , " taskPerNodeOffset for read tests use with -C & -Z options (-C constant N, -Z at least N) " , OPTION_OPTIONAL_ARGUMENT , ' d ' , & params - > taskPerNodeOffset } ,
{ ' r ' , NULL , " readFile -- read existing file " , OPTION_FLAG , ' d ' , & params - > readFile } ,
{ ' R ' , NULL , " checkRead -- verify that the output of read matches the expected signature (used with -G) " , OPTION_FLAG , ' d ' , & params - > checkRead } ,
{ ' s ' , NULL , " segmentCount -- number of segments " , OPTION_OPTIONAL_ARGUMENT , ' d ' , & params - > segmentCount } ,
{ ' t ' , NULL , " transferSize -- size of transfer in bytes (e.g.: 8, 4k, 2m, 1g) " , OPTION_OPTIONAL_ARGUMENT , ' l ' , & params - > transferSize } ,
{ ' T ' , NULL , " maxTimeDuration -- max time in minutes executing repeated test; it aborts only between iterations and not within a test! " , OPTION_OPTIONAL_ARGUMENT , ' d ' , & params - > maxTimeDuration } ,
{ ' u ' , NULL , " uniqueDir -- use unique directory name for each file-per-process " , OPTION_FLAG , ' d ' , & params - > uniqueDir } ,
{ ' v ' , NULL , " verbose -- output information (repeating flag increases level) " , OPTION_FLAG , ' d ' , & params - > verbose } ,
{ ' w ' , NULL , " writeFile -- write file " , OPTION_FLAG , ' d ' , & params - > writeFile } ,
{ ' W ' , NULL , " checkWrite -- check read after write " , OPTION_FLAG , ' d ' , & params - > checkWrite } ,
{ ' x ' , NULL , " singleXferAttempt -- do not retry transfer if incomplete " , OPTION_FLAG , ' d ' , & params - > singleXferAttempt } ,
{ ' X ' , NULL , " reorderTasksRandomSeed -- random seed for -Z option " , OPTION_OPTIONAL_ARGUMENT , ' d ' , & params - > reorderTasksRandomSeed } ,
2019-11-05 17:37:54 +03:00
{ ' y ' , NULL , " dualMount -- use dual mount points for a filesystem " , OPTION_FLAG , ' d ' , & params - > dualMount } ,
2019-03-27 23:04:48 +03:00
{ ' Y ' , NULL , " fsyncPerWrite -- perform sync operation after every write operation " , OPTION_FLAG , ' d ' , & params - > fsyncPerWrite } ,
{ ' z ' , NULL , " randomOffset -- access is to random, not sequential, offsets within a file " , OPTION_FLAG , ' d ' , & params - > randomOffset } ,
{ ' Z ' , NULL , " reorderTasksRandom -- changes task ordering to random ordering for readback " , OPTION_FLAG , ' d ' , & params - > reorderTasksRandom } ,
2020-06-24 13:10:42 +03:00
{ 0 , " warningAsErrors " , " Any warning should lead to an error. " , OPTION_FLAG , ' d ' , & params - > warningAsErrors } ,
2019-03-27 23:04:48 +03:00
{ . help = " -O summaryFile=FILE -- store result data into this file " , . arg = OPTION_OPTIONAL_ARGUMENT } ,
2020-07-03 10:09:40 +03:00
{ . help = " -O summaryFormat=[default,JSON,CSV] -- use the format for outputting the summary " , . arg = OPTION_OPTIONAL_ARGUMENT } ,
2019-03-27 23:04:48 +03:00
{ 0 , " dryRun " , " do not perform any I/Os just run evtl. inputs print dummy output " , OPTION_FLAG , ' d ' , & params - > dryRun } ,
LAST_OPTION ,
} ;
option_help * options = malloc ( sizeof ( o ) ) ;
memcpy ( options , & o , sizeof ( o ) ) ;
return options ;
2018-07-14 10:41:35 +03:00
}
2019-03-27 23:04:48 +03:00
2011-06-17 23:20:43 +04:00
/*
* Parse Commandline .
*/
2011-12-13 09:00:18 +04:00
IOR_test_t * ParseCommandLine ( int argc , char * * argv )
2011-06-17 23:20:43 +04:00
{
2018-07-14 10:41:35 +03:00
init_IOR_Param_t ( & initialTestParams ) ;
2019-03-27 23:04:48 +03:00
IOR_test_t * tests = NULL ;
2018-07-14 10:41:35 +03:00
2019-12-21 17:14:27 +03:00
initialTestParams . platform = GetPlatformName ( ) ;
2019-03-27 23:04:48 +03:00
option_help * options = createGlobalOptions ( & initialTestParams ) ;
parameters = & initialTestParams ;
global_options = airoi_create_all_module_options ( options ) ;
option_parse ( argc , argv , global_options ) ;
updateParsedOptions ( & initialTestParams , global_options ) ;
if ( initialTestParams . testscripts ) {
tests = ReadConfigScript ( initialTestParams . testscripts ) ;
} else {
tests = CreateTest ( & initialTestParams , 0 ) ;
AllocResults ( tests ) ;
}
2011-06-17 23:20:43 +04:00
2019-03-27 23:04:48 +03:00
CheckRunSettings ( tests ) ;
2011-11-10 04:13:44 +04:00
2019-03-27 23:04:48 +03:00
return ( tests ) ;
2011-11-12 03:11:28 +04:00
}