From 3b5f4fc00271146e3a103e42a8e6bd9e6c1eabf2 Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Thu, 11 Oct 2018 18:59:12 +0100 Subject: [PATCH] Bugfix JSON output for multiple processes --- src/ior-internal.h | 1 - src/ior-output.c | 34 ++++++++++++++++++---------------- src/ior.c | 3 --- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/src/ior-internal.h b/src/ior-internal.h index 11bbb8d..6b89af1 100644 --- a/src/ior-internal.h +++ b/src/ior-internal.h @@ -6,7 +6,6 @@ #define _IOR_INTERNAL_H /* Part of ior-output.c */ -void PrintEarlyHeader(); void PrintHeader(int argc, char **argv); void ShowTestStart(IOR_param_t *params); void ShowTestEnd(IOR_test_t *tptr); diff --git a/src/ior-output.c b/src/ior-output.c index da4f5f1..38dc6e6 100644 --- a/src/ior-output.c +++ b/src/ior-output.c @@ -151,6 +151,9 @@ static void PrintNamedArrayStart(char * key){ } static void PrintEndSection(){ + if (rank != 0) + return; + indent--; if(outputFormat == OUTPUT_JSON){ fprintf(out_resultfile, "\n"); @@ -161,6 +164,8 @@ static void PrintEndSection(){ } static void PrintArrayStart(){ + if (rank != 0) + return; PrintNextToken(); needNextToken = 0; if(outputFormat == OUTPUT_JSON){ @@ -169,6 +174,8 @@ static void PrintArrayStart(){ } static void PrintArrayNamedStart(char * key){ + if (rank != 0) + return; PrintNextToken(); needNextToken = 0; if(outputFormat == OUTPUT_JSON){ @@ -177,6 +184,9 @@ static void PrintArrayNamedStart(char * key){ } static void PrintArrayEnd(){ + if (rank != 0) + return; + indent--; if(outputFormat == OUTPUT_JSON){ fprintf(out_resultfile, "]\n"); @@ -185,10 +195,14 @@ static void PrintArrayEnd(){ } void PrintRepeatEnd(){ + if (rank != 0) + return; PrintArrayEnd(); } void PrintRepeatStart(){ + if (rank != 0) + return; if( outputFormat == OUTPUT_DEFAULT){ return; } @@ -231,13 +245,11 @@ void PrintReducedResult(IOR_test_t *test, int access, double bw, double *diff_su fflush(out_resultfile); } - -/* - * Message to print immediately after MPI_Init so we know that - * ior has started. - */ -void PrintEarlyHeader() +void PrintHeader(int argc, char **argv) { + struct utsname unamebuf; + int i; + if (rank != 0) return; @@ -247,16 +259,6 @@ void PrintEarlyHeader() }else{ 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()); PrintKeyValStart("Command line"); fprintf(out_resultfile, "%s", argv[0]); diff --git a/src/ior.c b/src/ior.c index 66cca76..b84f01a 100755 --- a/src/ior.c +++ b/src/ior.c @@ -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_rank(mpi_comm_world, &rank), "cannot get rank"); - PrintEarlyHeader(); /* setup tests, and validate parameters */ tests_head = ParseCommandLine(argc, argv); @@ -113,8 +112,6 @@ int ior_main(int argc, char **argv) "cannot get number of tasks"); MPI_CHECK(MPI_Comm_rank(mpi_comm_world, &rank), "cannot get rank"); - PrintEarlyHeader(); - /* set error-handling */ /*MPI_CHECK(MPI_Errhandler_set(mpi_comm_world, MPI_ERRORS_RETURN), "cannot set errhandler"); */