Bugfix JSON output for multiple processes

master
Julian M. Kunkel 2018-10-11 18:59:12 +01:00
parent fa38cb7992
commit 3b5f4fc002
3 changed files with 18 additions and 20 deletions

View File

@ -6,7 +6,6 @@
#define _IOR_INTERNAL_H #define _IOR_INTERNAL_H
/* Part of ior-output.c */ /* Part of ior-output.c */
void PrintEarlyHeader();
void PrintHeader(int argc, char **argv); void PrintHeader(int argc, char **argv);
void ShowTestStart(IOR_param_t *params); void ShowTestStart(IOR_param_t *params);
void ShowTestEnd(IOR_test_t *tptr); void ShowTestEnd(IOR_test_t *tptr);

View File

@ -151,6 +151,9 @@ static void PrintNamedArrayStart(char * key){
} }
static void PrintEndSection(){ static void PrintEndSection(){
if (rank != 0)
return;
indent--; indent--;
if(outputFormat == OUTPUT_JSON){ if(outputFormat == OUTPUT_JSON){
fprintf(out_resultfile, "\n"); fprintf(out_resultfile, "\n");
@ -161,6 +164,8 @@ static void PrintEndSection(){
} }
static void PrintArrayStart(){ static void PrintArrayStart(){
if (rank != 0)
return;
PrintNextToken(); PrintNextToken();
needNextToken = 0; needNextToken = 0;
if(outputFormat == OUTPUT_JSON){ if(outputFormat == OUTPUT_JSON){
@ -169,6 +174,8 @@ static void PrintArrayStart(){
} }
static void PrintArrayNamedStart(char * key){ static void PrintArrayNamedStart(char * key){
if (rank != 0)
return;
PrintNextToken(); PrintNextToken();
needNextToken = 0; needNextToken = 0;
if(outputFormat == OUTPUT_JSON){ if(outputFormat == OUTPUT_JSON){
@ -177,6 +184,9 @@ static void PrintArrayNamedStart(char * key){
} }
static void PrintArrayEnd(){ static void PrintArrayEnd(){
if (rank != 0)
return;
indent--; indent--;
if(outputFormat == OUTPUT_JSON){ if(outputFormat == OUTPUT_JSON){
fprintf(out_resultfile, "]\n"); fprintf(out_resultfile, "]\n");
@ -185,10 +195,14 @@ static void PrintArrayEnd(){
} }
void PrintRepeatEnd(){ void PrintRepeatEnd(){
if (rank != 0)
return;
PrintArrayEnd(); PrintArrayEnd();
} }
void PrintRepeatStart(){ void PrintRepeatStart(){
if (rank != 0)
return;
if( outputFormat == OUTPUT_DEFAULT){ if( outputFormat == OUTPUT_DEFAULT){
return; return;
} }
@ -231,13 +245,11 @@ void PrintReducedResult(IOR_test_t *test, int access, double bw, double *diff_su
fflush(out_resultfile); fflush(out_resultfile);
} }
void PrintHeader(int argc, char **argv)
/*
* Message to print immediately after MPI_Init so we know that
* ior has started.
*/
void PrintEarlyHeader()
{ {
struct utsname unamebuf;
int i;
if (rank != 0) if (rank != 0)
return; return;
@ -247,16 +259,6 @@ void PrintEarlyHeader()
}else{ }else{
printf("IOR-" META_VERSION ": MPI Coordinated Test of Parallel I/O\n"); printf("IOR-" META_VERSION ": MPI Coordinated Test of Parallel I/O\n");
} }
}
void PrintHeader(int argc, char **argv)
{
struct utsname unamebuf;
int i;
if (rank != 0)
return;
PrintKeyVal("Began", CurrentTimeString()); PrintKeyVal("Began", CurrentTimeString());
PrintKeyValStart("Command line"); PrintKeyValStart("Command line");
fprintf(out_resultfile, "%s", argv[0]); fprintf(out_resultfile, "%s", argv[0]);

View File

@ -62,7 +62,6 @@ IOR_test_t * ior_run(int argc, char **argv, MPI_Comm world_com, FILE * world_out
MPI_CHECK(MPI_Comm_size(mpi_comm_world, &numTasksWorld), "cannot get number of tasks"); 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"); MPI_CHECK(MPI_Comm_rank(mpi_comm_world, &rank), "cannot get rank");
PrintEarlyHeader();
/* setup tests, and validate parameters */ /* setup tests, and validate parameters */
tests_head = ParseCommandLine(argc, argv); tests_head = ParseCommandLine(argc, argv);
@ -113,8 +112,6 @@ int ior_main(int argc, char **argv)
"cannot get number of tasks"); "cannot get number of tasks");
MPI_CHECK(MPI_Comm_rank(mpi_comm_world, &rank), "cannot get rank"); MPI_CHECK(MPI_Comm_rank(mpi_comm_world, &rank), "cannot get rank");
PrintEarlyHeader();
/* set error-handling */ /* set error-handling */
/*MPI_CHECK(MPI_Errhandler_set(mpi_comm_world, MPI_ERRORS_RETURN), /*MPI_CHECK(MPI_Errhandler_set(mpi_comm_world, MPI_ERRORS_RETURN),
"cannot set errhandler"); */ "cannot set errhandler"); */