Skip to content

Commit

Permalink
now logging init_async with MPE
Browse files Browse the repository at this point in the history
  • Loading branch information
edhartnett committed Jun 14, 2019
1 parent 1747d7f commit 0e0643b
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 7 deletions.
28 changes: 26 additions & 2 deletions src/clib/pioc.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
#include <pio.h>
#include <pio_internal.h>

#ifdef USE_MPE
/* The event numbers for MPE logging. */
extern int event_num[2][NUM_EVENTS];
#endif /* USE_MPE */

/**
* @defgroup PIO_init_c Initialize the IO System
* Initialize the IOSystem, including specifying number of IO and
Expand Down Expand Up @@ -1426,6 +1431,11 @@ PIOc_init_async(MPI_Comm world, int num_io_procs, int *io_proc_list,
LOG((1, "PIOc_init_async num_io_procs = %d component_count = %d", num_io_procs,
component_count));

#ifdef USE_MPE
if ((ret = MPE_Log_event(event_num[START][INIT], 0, "PIOc_init_async")))
return pio_err(NULL, NULL, PIO_EIO, __FILE__, __LINE__);
#endif /* USE_MPE */

/* Determine which tasks to use for IO. */
for (int p = 0; p < num_io_procs; p++)
my_io_proc_list[p] = io_proc_list ? io_proc_list[p] : p;
Expand Down Expand Up @@ -1699,12 +1709,20 @@ PIOc_init_async(MPI_Comm world, int num_io_procs, int *io_proc_list,
} /* next computational component */

/* Now call the function from which the IO tasks will not return
* until the PIO_MSG_EXIT message is sent. This will handle all
* components. */
* until the PIO_MSG_EXIT message is sent. This will handle
* messages from all computation components. */
if (in_io)
{
LOG((2, "Starting message handler io_rank = %d component_count = %d",
io_rank, component_count));
#ifdef USE_MPE
if ((ret = MPE_Log_event(event_num[END][INIT], 0,
"about to start processing messages")))
return pio_err(NULL, NULL, PIO_EIO, __FILE__, __LINE__);
#endif /* USE_MPE */

/* Start the message handler loop. This will not return until
* an exit message is sent, or an error occurs. */
if ((ret = pio_msg_handler2(io_rank, component_count, iosys, io_comm)))
return pio_err(NULL, NULL, ret, __FILE__, __LINE__);
LOG((2, "Returned from pio_msg_handler2() ret = %d", ret));
Expand Down Expand Up @@ -1736,6 +1754,12 @@ PIOc_init_async(MPI_Comm world, int num_io_procs, int *io_proc_list,
if ((ret = MPI_Group_free(&world_group)))
return check_mpi(NULL, NULL, ret, __FILE__, __LINE__);

#ifdef USE_MPE
if (!in_io)
if ((ret = MPE_Log_event(event_num[END][INIT], 0, "end of PIOc_init_async")))
return pio_err(NULL, NULL, PIO_EIO, __FILE__, __LINE__);
#endif /* USE_MPE */

LOG((2, "successfully done with PIOc_init_async"));
return PIO_NOERR;
}
Expand Down
21 changes: 16 additions & 5 deletions src/clib/pioc_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ int event_num[2][NUM_EVENTS];
int
init_mpe(int my_rank)
{
int ret;

/* Get a bunch of event numbers. */
event_num[START][INIT] = MPE_Log_get_event_number();
event_num[END][INIT] = MPE_Log_get_event_number();
Expand Down Expand Up @@ -222,14 +220,27 @@ init_mpe(int my_rank)
int
pio_init_logging(void)
{
int mpierr;
int ret = PIO_NOERR;

#if PIO_ENABLE_LOGGING
char log_filename[PIO_MAX_NAME];
#ifdef USE_MPE
{
int mpe_rank;
int mpierr;

if ((mpierr = MPI_Comm_rank(MPI_COMM_WORLD, &mpe_rank)))
return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__);

if ((ret = init_mpe(mpe_rank)))
return pio_err(NULL, NULL, ret, __FILE__, __LINE__);
}
#endif /* USE_MPE */

#if PIO_ENABLE_LOGGING
if (!LOG_FILE)
{
char log_filename[PIO_MAX_NAME];
int mpierr;

/* Create a filename with the rank in it. */
if ((mpierr = MPI_Comm_rank(MPI_COMM_WORLD, &my_rank)))
return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__);
Expand Down

0 comments on commit 0e0643b

Please sign in to comment.