Skip to content

Commit

Permalink
fixed mpe logging problem
Browse files Browse the repository at this point in the history
  • Loading branch information
edhartnett committed Jun 19, 2019
1 parent c834641 commit 06b4172
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 18 deletions.
17 changes: 10 additions & 7 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ AC_SUBST([VERSION_PATCH], [4])
AC_CONFIG_MACRO_DIR([m4])

# Libtool initialisation.
LD=ld # Required for MPE to work.
LT_INIT

# Find and learn about the C compiler.
Expand Down Expand Up @@ -97,17 +98,19 @@ test "x$enable_mpe" = xyes || enable_mpe=no
AC_MSG_RESULT([$enable_mpe])
if test "x$enable_mpe" = xyes; then

AC_SEARCH_LIBS([pthread_setspecific], [pthread], [HAVE_PTHREAD=yes], [HAVE_PTHREAD=no], [])
AC_SEARCH_LIBS([MPE_Log_get_event_number], [mpe], [HAVE_LIBMPE=yes], [HAVE_LIBMPE=no], [-lpthread -lm])
AC_SEARCH_LIBS([MPE_Init_mpi_core], [lmpe], [HAVE_LIBLMPE=yes], [HAVE_LIBLMPE=no], [-lmpe -lpthread -lm])
AC_SEARCH_LIBS([pthread_setspecific], [pthread], [], [], [])
AC_SEARCH_LIBS([MPE_Log_get_event_number], [mpe], [HAVE_LIBMPE=yes], [HAVE_LIBMPE=no], [])
AC_SEARCH_LIBS([MPE_Init_mpi_core], [lmpe], [HAVE_LIBLMPE=yes], [HAVE_LIBLMPE=no], [])
AC_CHECK_HEADERS([mpe.h], [HAVE_MPE=yes], [HAVE_MPE=no])
if test "x$HAVE_LIBMPE" = xno -o "x$HAVE_MPE" = xno -o "x$HAVE_LIBLMPE" = xno; then
AC_MSG_ERROR([MPE not found but --enable-mpe used.])
if test "x$HAVE_LIBMPE" != xyes; then
AC_MSG_ERROR([-lmpe not found but --enable-mpe used.])
fi
if test "x$HAVE_LIBLMPE" != xyes; then
AC_MSG_ERROR([-llmpe not found but --enable-mpe used.])
fi
if test $enable_fortran = yes; then
AC_MSG_ERROR([MPE not implemented in Fortran tests and examples.])
AC_MSG_ERROR([MPE not implemented in Fortran tests and examples. Build without --enable-fortran])
fi
LD=ld # MPE needs this.
AC_DEFINE([USE_MPE], 1, [If true, use MPE timing library.])

fi
Expand Down
6 changes: 6 additions & 0 deletions examples/c/examplePio.c
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,12 @@ int main(int argc, char* argv[])
pioExInst->writeVar(pioExInst);
pioExInst->readVar(pioExInst);
pioExInst->closeFile(pioExInst);

#ifdef USE_MPE
if ((ret = MPE_Finish_log("examplePio")))
return ret;
#endif /* USE_MPE */

pioExInst->cleanUp(pioExInst);

#ifdef TIMING
Expand Down
2 changes: 1 addition & 1 deletion src/clib/pio_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ int PIOc_closefile(int ncid)
return pio_err(ios, file, ierr, __FILE__, __LINE__);

#ifdef USE_MPE
pio_stop_mpe_log(INIT, __func__);
pio_stop_mpe_log(CLOSE, __func__);
#endif /* USE_MPE */

return ierr;
Expand Down
4 changes: 2 additions & 2 deletions src/clib/pio_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ void pio_log(int severity, const char *fmt, ...);
#define CREATE 2
#define OPEN 3
#define DARRAY_WRITE 4
#define DARRAY_READ 5
#define CLOSE 6
#define DARRAY_READ 6
#define CLOSE 5
#endif /* USE_MPE */

#if defined(__cplusplus)
Expand Down
11 changes: 6 additions & 5 deletions src/clib/pioc_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,10 @@ init_mpe(int my_rank)
event_num[END][OPEN] = MPE_Log_get_event_number();
event_num[START][DARRAY_WRITE] = MPE_Log_get_event_number();
event_num[END][DARRAY_WRITE] = MPE_Log_get_event_number();
event_num[START][DARRAY_READ] = MPE_Log_get_event_number();
event_num[END][DARRAY_READ] = MPE_Log_get_event_number();
event_num[START][CLOSE] = MPE_Log_get_event_number();
event_num[END][CLOSE] = MPE_Log_get_event_number();
event_num[START][DARRAY_READ] = MPE_Log_get_event_number();
event_num[END][DARRAY_READ] = MPE_Log_get_event_number();

/* Available colors: "white", "black", "red", "yellow", "green",
"cyan", "blue", "magenta", "aquamarine", "forestgreen",
Expand All @@ -213,10 +213,11 @@ init_mpe(int my_rank)
event_num[END][DARRAY_WRITE], "PIO darray write",
"pink", "%s");
MPE_Describe_info_state(event_num[START][DARRAY_READ],
event_num[END][DARRAY_WRITE], "PIO darray read",
event_num[END][DARRAY_READ], "PIO darray read",
"magenta", "%s");
MPE_Describe_info_state(event_num[START][CLOSE], event_num[END][CLOSE],
"PIO close file", "purple", "%s");
MPE_Describe_info_state(event_num[START][CLOSE],
event_num[END][CLOSE], "PIO close",
"white", "%s");
}
return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions tests/cunit/test_darray.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,10 +421,10 @@ int main(int argc, char **argv)
} /* endif my_rank < TARGET_NTASKS */

/* Finalize the MPI library. */
if ((ret = pio_test_finalize(&test_comm)))
return ret;
/* if ((ret = pio_test_finalize2(&test_comm, TEST_NAME))) */
/* if ((ret = pio_test_finalize(&test_comm))) */
/* return ret; */
if ((ret = pio_test_finalize2(&test_comm, TEST_NAME)))
return ret;

printf("%d %s SUCCESS!!\n", my_rank, TEST_NAME);
return 0;
Expand Down

0 comments on commit 06b4172

Please sign in to comment.