From 3984d62ca3f7043f428bf0b8e25695ef09482aa7 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Tue, 7 May 2002 10:22:31 -0500 Subject: [svn-r5368] Purpose: Bug fix, feature Description: Added code to time pure MPI_File_write_xxx and read_xxx routines. Moved the setting of the timer_g to when timer is created (new) and destroyed. Platforms tested: modi4pp --- perform/pio_engine.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++-- perform/pio_perf.c | 2 -- perform/pio_perf.h | 2 +- perform/pio_timer.c | 7 +++++++ 4 files changed, 61 insertions(+), 5 deletions(-) diff --git a/perform/pio_engine.c b/perform/pio_engine.c index 0c5a9f3..acc62ad 100644 --- a/perform/pio_engine.c +++ b/perform/pio_engine.c @@ -228,8 +228,8 @@ do_pio(parameters param) GOTOERROR(FAIL); } -#if AKCDEBUG -/* DEBUG*/ +#if akcdebug +/* debug*/ fprintf(stderr, "nfiles=%d\n", nfiles); fprintf(stderr, "ndsets=%ld\n", ndsets); fprintf(stderr, "nelmts=%ld\n", nelmts); @@ -1105,4 +1105,55 @@ do_cleanupfile(iotype iot, char *fname) } } } + + +#ifndef TIME_MPI +#define TIME_MPI +#endif +#ifdef TIME_MPI +/* instrument the MPI_File_wrirte_xxx and read_xxx calls to measure + * pure time spent in MPI_File code. + */ +int MPI_File_read_at(MPI_File fh, MPI_Offset offset, void *buf, + int count, MPI_Datatype datatype, MPI_Status *status) +{ + int err; + set_time(timer_g, HDF5_MPI_READ, START); + err=PMPI_File_read_at(fh, offset, buf, count, datatype, status); + set_time(timer_g, HDF5_MPI_READ, STOP); + return err; +} + + +int MPI_File_read_at_all(MPI_File fh, MPI_Offset offset, void *buf, + int count, MPI_Datatype datatype, MPI_Status *status) +{ + int err; + set_time(timer_g, HDF5_MPI_READ, START); + err=PMPI_File_read_at_all(fh, offset, buf, count, datatype, status); + set_time(timer_g, HDF5_MPI_READ, STOP); + return err; +} + +int MPI_File_write_at(MPI_File fh, MPI_Offset offset, void *buf, + int count, MPI_Datatype datatype, MPI_Status *status) +{ + int err; + set_time(timer_g, HDF5_MPI_WRITE, START); + err=PMPI_File_write_at(fh, offset, buf, count, datatype, status); + set_time(timer_g, HDF5_MPI_WRITE, STOP); + return err; +} + +int MPI_File_write_at_all(MPI_File fh, MPI_Offset offset, void *buf, + int count, MPI_Datatype datatype, MPI_Status *status) +{ + int err; + set_time(timer_g, HDF5_MPI_WRITE, START); + err=PMPI_File_write_at_all(fh, offset, buf, count, datatype, status); + set_time(timer_g, HDF5_MPI_WRITE, STOP); + return err; +} + +#endif /* TIME_MPI */ #endif /* H5_HAVE_PARALLEL */ diff --git a/perform/pio_perf.c b/perform/pio_perf.c index 7dca0e4..7d36b26 100644 --- a/perform/pio_perf.c +++ b/perform/pio_perf.c @@ -80,7 +80,6 @@ /* global variables */ FILE *output; /* output file */ -pio_time *timer; /* timer: global for stub functions */ int comm_world_rank_g; /* my rank in MPI_COMM_RANK */ int comm_world_nprocs_g;/* num. of processes of MPI_COMM_WORLD */ MPI_Comm pio_comm_g; /* Communicator to run the PIO */ @@ -475,7 +474,6 @@ run_test(iotype iot, parameters parms) MPI_Barrier(pio_comm_g); res = do_pio(parms); - timer = res.timers; /* gather all of the "write" times */ t = get_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS); diff --git a/perform/pio_perf.h b/perform/pio_perf.h index 89cba72..12811e3 100644 --- a/perform/pio_perf.h +++ b/perform/pio_perf.h @@ -41,7 +41,7 @@ typedef struct results_ { #endif /* !FAIL */ extern FILE *output; /* output file */ -extern pio_time *timer; /* timer: global for stub functions */ +extern pio_time *timer_g; /* timer: global for stub functions */ extern int comm_world_rank_g; /* my rank in MPI_COMM_RANK */ extern int comm_world_nprocs_g;/* num. of processes of MPI_COMM_WORLD */ extern MPI_Comm pio_comm_g; /* Communicator to run the PIO */ diff --git a/perform/pio_timer.c b/perform/pio_timer.c index 1bf1b0c..cee7f6d 100644 --- a/perform/pio_timer.c +++ b/perform/pio_timer.c @@ -27,6 +27,9 @@ */ #define MILLISECOND 1000000.0 +/* global variables */ +pio_time *timer_g; /* timer: global for stub functions */ + /* * Function: pio_time_new * Purpose: Build us a brand, spankin', new performance time object. @@ -43,6 +46,8 @@ pio_time_new(unsigned int type) pio_time *pt = (pio_time *)calloc(1, sizeof(struct pio_time_)); register int i; + /* set global timer variable */ + timer_g = pt; for (i = 0; i < NUM_TIMERS; ++i) pt->total_time[i] = 0.0; @@ -63,6 +68,8 @@ void pio_time_destroy(pio_time *pt) { free(pt); + /* reset the global timer pointer too. */ + timer_g = NULL; } /* -- cgit v0.12