Skip to content

Commit

Permalink
adding more mpe logging to test_async_perf
Browse files Browse the repository at this point in the history
  • Loading branch information
edhartnett committed Jun 21, 2019
1 parent a01cea3 commit 2704459
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/clib/pio_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void pio_log(int severity, const char *fmt, ...);
#define START 0
#define END 1

/* These are the events. */
/* These are the MPE states (events) we keep track of. */
#define NUM_EVENTS 7
#define INIT 0
#define DECOMP 1
Expand All @@ -106,6 +106,11 @@ void pio_log(int severity, const char *fmt, ...);
#define DARRAY_WRITE 4
#define DARRAY_READ 6
#define CLOSE 5

/* The max length of msg added to log with mpe_log_pack(). (NULL
* terminator is not required by mpe_log_pack(), so need not be
* counted in this total).*/
#define MPE_MAX_MSG_LEN 32
#endif /* USE_MPE */

#if defined(__cplusplus)
Expand Down
10 changes: 9 additions & 1 deletion src/clib/pioc_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,16 +247,24 @@ pio_start_mpe_log(int state)
/**
* End MPE logging.
*
* @param state one of the MPE states defined in pio_internal.h.
* @param msg a text message to describe the state. Will be truncated
* to MPE_MAX_MSG_LEN.
* @author Ed Hartnett
*/
void
pio_stop_mpe_log(int state, const char *msg)
{
MPE_LOG_BYTES bytebuf;
int pos = 0;
int msglen;
int ret;

MPE_Log_pack(bytebuf, &pos, 's', strlen(msg), msg);
/* Truncate messages longer than MPE_MAX_MSG_LEN. */
msglen = strlen(msg) > MPE_MAX_MSG_LEN ? MPE_MAX_MSG_LEN : strlen(msg);

/* Tell MPE to stop the state, with a message. */
MPE_Log_pack(bytebuf, &pos, 's', msglen, msg);
if ((ret = MPE_Log_event(event_num[END][state], 0, bytebuf)))
pio_err(NULL, NULL, PIO_EIO, __FILE__, __LINE__);
}
Expand Down
12 changes: 12 additions & 0 deletions tests/cunit/test_async_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ run_darray_async_test(int iosysid, int fmt, int my_rank, int ntasks, int niotask
for (d = 0; d < elements_per_pe2; d++)
my_data_int[d] = my_rank;

#ifdef USE_MPE
test_start_mpe_log(TEST_CREATE);
#endif /* USE_MPE */

/* Create sample output file. */
/* sprintf(data_filename, "data_%s_iotype_%d_piotype_%d.nc", TEST_NAME, flavor[fmt], */
/* piotype); */
Expand All @@ -151,6 +155,14 @@ run_darray_async_test(int iosysid, int fmt, int my_rank, int ntasks, int niotask
NC_CLOBBER)))
BAIL(ret);

#ifdef USE_MPE
{
char msg[PIO_MAX_NAME + 1];
sprintf(msg, "iotype %d", flavor[fmt]);
test_stop_mpe_log(TEST_CREATE, msg);
}
#endif /* USE_MPE */

/* Find the size of the type. */
if ((ret = PIOc_inq_type(ncid, piotype, NULL, &type_size)))
BAIL(ret);
Expand Down

0 comments on commit 2704459

Please sign in to comment.