Support IO redirect from main()
parent
0052bff3e9
commit
0f7a1f14b9
|
@ -280,7 +280,8 @@ GENERAL:
|
|||
* summaryAlways - Always print the long summary for each test.
|
||||
Useful for long runs that may be interrupted, preventing
|
||||
the final long summary for ALL tests to be printed.
|
||||
|
||||
* summaryFile=File - Output the summary to the file instead on stdout/stderr.
|
||||
* summaryFormat=FMT - Choose the output format -- default, JSON, CSV
|
||||
|
||||
POSIX-ONLY:
|
||||
===========
|
||||
|
|
11
src/ior.c
11
src/ior.c
|
@ -90,6 +90,7 @@ IOR_test_t * ior_run(int argc, char **argv, MPI_Comm world_com, FILE * world_out
|
|||
for (tptr = tests_head; tptr != NULL; tptr = tptr->next) {
|
||||
totalErrorCount = 0;
|
||||
verbose = tptr->params.verbose;
|
||||
tptr->params.testComm = world_com;
|
||||
if (rank == 0 && verbose >= VERBOSE_0) {
|
||||
ShowTestInfo(&tptr->params);
|
||||
}
|
||||
|
@ -125,6 +126,7 @@ int ior_main(int argc, char **argv)
|
|||
int i;
|
||||
IOR_test_t *tests_head;
|
||||
IOR_test_t *tptr;
|
||||
|
||||
out_logfile = stdout;
|
||||
|
||||
/*
|
||||
|
@ -153,6 +155,7 @@ int ior_main(int argc, char **argv)
|
|||
MPI_CHECK(MPI_Comm_size(mpi_comm_world, &numTasksWorld),
|
||||
"cannot get number of tasks");
|
||||
MPI_CHECK(MPI_Comm_rank(mpi_comm_world, &rank), "cannot get rank");
|
||||
|
||||
PrintEarlyHeader();
|
||||
|
||||
/* set error-handling */
|
||||
|
@ -230,6 +233,8 @@ int ior_main(int argc, char **argv)
|
|||
aws_cleanup();
|
||||
#endif
|
||||
|
||||
fflush(out_logfile);
|
||||
|
||||
return totalErrorCount;
|
||||
}
|
||||
|
||||
|
@ -1668,7 +1673,6 @@ static void PrintLongSummaryOneOperation(IOR_test_t *test, double *times, char *
|
|||
struct results *bw;
|
||||
struct results *ops;
|
||||
int reps;
|
||||
|
||||
if (rank != 0 || verbose < VERBOSE_0)
|
||||
return;
|
||||
|
||||
|
@ -1682,14 +1686,12 @@ static void PrintLongSummaryOneOperation(IOR_test_t *test, double *times, char *
|
|||
fprintf(out_logfile, "%10.2f ", bw->max / MEBIBYTE);
|
||||
fprintf(out_logfile, "%10.2f ", bw->min / MEBIBYTE);
|
||||
fprintf(out_logfile, "%10.2f ", bw->mean / MEBIBYTE);
|
||||
|
||||
fprintf(out_logfile, "%10.2f ", bw->sd / MEBIBYTE);
|
||||
fprintf(out_logfile, "%10.2f ", ops->max);
|
||||
fprintf(out_logfile, "%10.2f ", ops->min);
|
||||
fprintf(out_logfile, "%10.2f ", ops->mean);
|
||||
fprintf(out_logfile, "%10.2f ", ops->sd);
|
||||
fprintf(out_logfile, "%10.5f ",
|
||||
mean_of_array_of_doubles(times, reps));
|
||||
fprintf(out_logfile, "%10.5f ", mean_of_array_of_doubles(times, reps));
|
||||
fprintf(out_logfile, "%5d ", params->id);
|
||||
fprintf(out_logfile, "%6d ", params->numTasks);
|
||||
fprintf(out_logfile, "%3d ", params->tasksPerNode);
|
||||
|
@ -1742,7 +1744,6 @@ static void PrintLongSummaryHeader()
|
|||
static void PrintLongSummaryAllTests(IOR_test_t *tests_head)
|
||||
{
|
||||
IOR_test_t *tptr;
|
||||
|
||||
if (rank != 0 || verbose < VERBOSE_0)
|
||||
return;
|
||||
|
||||
|
|
|
@ -82,7 +82,6 @@ typedef struct IO_BUFFERS
|
|||
|
||||
typedef struct
|
||||
{
|
||||
FILE * out_logfile;
|
||||
char debug[MAX_STR]; /* debug info string */
|
||||
unsigned int mode; /* file permissions */
|
||||
unsigned int openFlags; /* open flags (see also <open>) */
|
||||
|
|
|
@ -61,6 +61,12 @@ extern int verbose; /* verbose output */
|
|||
|
||||
/*************************** D E F I N I T I O N S ****************************/
|
||||
|
||||
enum OutputFormat_t{
|
||||
OUTPUT_DEFAULT,
|
||||
OUTPUT_CSV,
|
||||
OUTPUT_JSON
|
||||
};
|
||||
|
||||
#ifndef FALSE
|
||||
# define FALSE 0
|
||||
#endif /* not FALSE */
|
||||
|
|
|
@ -170,6 +170,21 @@ void DecodeDirective(char *line, IOR_param_t *params)
|
|||
}
|
||||
if (strcasecmp(option, "api") == 0) {
|
||||
strcpy(params->api, value);
|
||||
} else if (strcasecmp(option, "summaryFile") == 0) {
|
||||
out_logfile = fopen(value, "w");
|
||||
if (out_logfile == NULL){
|
||||
FAIL("Cannot open output file for writes!");
|
||||
}
|
||||
} else if (strcasecmp(option, "summaryFormat") == 0) {
|
||||
if(strcasecmp(value, "default")){
|
||||
outputFormat = OUTPUT_DEFAULT;
|
||||
}else if(strcasecmp(value, "JSON")){
|
||||
outputFormat = OUTPUT_JSON;
|
||||
}else if(strcasecmp(value, "CSV")){
|
||||
outputFormat = OUTPUT_CSV;
|
||||
}else{
|
||||
FAIL("Unknown summaryFormat");
|
||||
}
|
||||
} else if (strcasecmp(option, "refnum") == 0) {
|
||||
params->referenceNumber = atoi(value);
|
||||
} else if (strcasecmp(option, "debug") == 0) {
|
||||
|
|
|
@ -57,6 +57,7 @@ int verbose = VERBOSE_0; /* verbose output */
|
|||
MPI_Comm testComm;
|
||||
MPI_Comm mpi_comm_world;
|
||||
FILE * out_logfile;
|
||||
enum OutputFormat_t outputFormat;
|
||||
|
||||
/***************************** F U N C T I O N S ******************************/
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ extern int verbose;
|
|||
extern MPI_Comm testComm;
|
||||
extern MPI_Comm mpi_comm_world;
|
||||
extern FILE * out_logfile;
|
||||
extern enum OutputFormat_t outputFormat; /* format of the output */
|
||||
|
||||
/*
|
||||
* Try using the system's PATH_MAX, which is what realpath and such use.
|
||||
|
|
Loading…
Reference in New Issue