[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
This commit is contained in:
Albert Cheng 2002-05-07 10:22:31 -05:00
parent 74861bfaeb
commit 3984d62ca3
4 changed files with 61 additions and 5 deletions

View File

@ -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 */

View File

@ -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);

View File

@ -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 */

View File

@ -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;
}
/*