From 807e11d34a6efa32c90e661f61bab91c6d980115 Mon Sep 17 00:00:00 2001 From: Artem Polyakov Date: Thu, 27 Jun 2019 14:59:37 -0700 Subject: [PATCH 1/5] Fixes in the configury logic * Rename configure.in to configure.ac as autoreconf suggests * Switch from the custom-modified configure/mpiPconfig.h.in to the auto-generated by autoreconf * Modify few config vars to prepare to get rid of mpiPi.h.in Signed-off-by: Artem Polyakov --- configure | 137 ++++++++++++++------- configure.in => configure.ac | 90 +++++++------- mpiPconfig.h.in | 230 +++++++++++++++-------------------- mpiPi.h.in | 3 +- 4 files changed, 242 insertions(+), 218 deletions(-) rename configure.in => configure.ac (85%) diff --git a/configure b/configure index 523f60f..2ecc882 100755 --- a/configure +++ b/configure @@ -661,7 +661,6 @@ DO_DEMANGLE USE_GETARG PC_LOOKUP_FILE USE_LIBDWARF -STACKDEPTH ENABLE_FORTRAN_WEAK_SYMS ENABLE_FORTRAN_XLATE ENABLE_MPI_NONBLOCKINGCOLLECTIVES @@ -704,6 +703,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -812,6 +812,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1064,6 +1065,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1201,7 +1211,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1354,6 +1364,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -2662,7 +2673,8 @@ TIMER_OPTION=no # Check whether --with-gettimeofday was given. if test "${with_gettimeofday+set}" = set; then : - withval=$with_gettimeofday; $as_echo "#define USE_GETTIMEOFDAY 1" >>confdefs.h + withval=$with_gettimeofday; +$as_echo "#define USE_GETTIMEOFDAY /**/" >>confdefs.h USE_GETTIMEOFDAY=true TIMER_OPTION=yes @@ -2673,7 +2685,8 @@ fi # Check whether --with-wtime was given. if test "${with_wtime+set}" = set; then : - withval=$with_wtime; $as_echo "#define USE_WTIME 1" >>confdefs.h + withval=$with_wtime; +$as_echo "#define USE_WTIME /**/" >>confdefs.h TIMER_OPTION=yes @@ -2683,7 +2696,8 @@ fi # Check whether --with-clock_gettime was given. if test "${with_clock_gettime+set}" = set; then : - withval=$with_clock_gettime; $as_echo "#define USE_CLOCK_GETTIME 1" >>confdefs.h + withval=$with_clock_gettime; +$as_echo "#define USE_CLOCK_GETTIME /**/" >>confdefs.h USE_CLOCK_GETTIME=yes TIMER_OPTION=yes @@ -2694,7 +2708,8 @@ fi # Check whether --with-rts_get_timebase was given. if test "${with_rts_get_timebase+set}" = set; then : - withval=$with_rts_get_timebase; $as_echo "#define USE_RTS_GET_TIMEBASE 1" >>confdefs.h + withval=$with_rts_get_timebase; +$as_echo "#define USE_RTS_GET_TIMEBASE /**/" >>confdefs.h USE_RTS_GET_TIMEBASE=yes TIMER_OPTION=yes @@ -2708,7 +2723,8 @@ fi # Check whether --with-read_real_time was given. if test "${with_read_real_time+set}" = set; then : - withval=$with_read_real_time; $as_echo "#define USE_READ_REAL_TIME 1" >>confdefs.h + withval=$with_read_real_time; +$as_echo "#define USE_READ_REAL_TIME /**/" >>confdefs.h USE_READ_REAL_TIME=yes TIMER_OPTION=yes @@ -2722,7 +2738,8 @@ fi # Check whether --with-rtc was given. if test "${with_rtc+set}" = set; then : - withval=$with_rtc; $as_echo "#define USE_RTC 1" >>confdefs.h + withval=$with_rtc; +$as_echo "#define USE_RTC /**/" >>confdefs.h USE_RTC=yes TIMER_OPTION=yes @@ -2736,7 +2753,8 @@ fi # Check whether --with-dclock was given. if test "${with_dclock+set}" = set; then : - withval=$with_dclock; $as_echo "#define USE_DCLOCK 1" >>confdefs.h + withval=$with_dclock; +$as_echo "#define USE_DCLOCK /**/" >>confdefs.h USE_DCLOCK=yes TIMER_OPTION=yes @@ -2759,7 +2777,8 @@ if test "${enable_api_only+set}" = set; then : enableval=$enable_api_only; if test x"$enableval" = xyes ; then ENABLE_API_ONLY=yes echo Configuring for API library only. - $as_echo "#define ENABLE_API_ONLY 1" >>confdefs.h + +$as_echo "#define ENABLE_API_ONLY /**/" >>confdefs.h DEFAULT_TARGS="API test" fi @@ -2848,7 +2867,8 @@ USE_SETJMP=no if test "${enable_setjmp+set}" = set; then : enableval=$enable_setjmp; if test x"$enableval" = xyes ; then USE_SETJMP=yes - $as_echo "#define USE_SETJMP 1" >>confdefs.h + +$as_echo "#define USE_SETJMP /**/" >>confdefs.h echo Setjmp will be used to generate stack traces. fi @@ -2881,7 +2901,8 @@ if test "${enable_fortranweak+set}" = set; then : echo Generation of additional weak FORTRAN symbol names has been disabled. else ENABLE_FORTRAN_WEAK_SYMS=yes - $as_echo "#define ENABLE_FORTRAN_WEAK_SYMS 1" >>confdefs.h + +$as_echo "#define ENABLE_FORTRAN_WEAK_SYMS /**/" >>confdefs.h echo Generation of additional weak FORTRAN symbol names has been enabled. fi @@ -2893,17 +2914,22 @@ fi + + # Check whether --enable-stackdepth was given. if test "${enable_stackdepth+set}" = set; then : - enableval=$enable_stackdepth; STACKDEPTH=$enableval - echo Maximum stacktrace depth is $STACKDEPTH - + enableval=$enable_stackdepth; STACKDEPTH=$enableval; + echo "Maximum stacktrace depth is $STACKDEPTH" else STACKDEPTH=8 - fi +cat >>confdefs.h <<_ACEOF +#define MPIP_CALLSITE_STACK_DEPTH_MAX $STACKDEPTH +_ACEOF + +#AC_SUBST(MPIP_CALLSITE_STACK_DEPTH_MAX) PC_LOOKUP_FILE=pc_lookup.c # Check whether --enable-dwarf was given. @@ -2927,7 +2953,8 @@ USE_GETARG=false # Check whether --enable-getarg was given. if test "${enable_getarg+set}" = set; then : enableval=$enable_getarg; if test x"$enableval" = xyes ; then - $as_echo "#define USE_GETARG 1" >>confdefs.h + +$as_echo "#define USE_GETARG /**/" >>confdefs.h echo Use of getarg has been enabled USE_GETARG=true @@ -2952,7 +2979,8 @@ fi # Check whether --enable-check-time was given. if test "${enable_check_time+set}" = set; then : enableval=$enable_check_time; if test x"$enableval" = xyes ; then - $as_echo "#define MPIP_CHECK_TIME 1" >>confdefs.h + +$as_echo "#define MPIP_CHECK_TIME /**/" >>confdefs.h echo AIX negative time value checking has been enabled fi @@ -2963,7 +2991,8 @@ fi # Check whether --enable-collective-report-default was given. if test "${enable_collective_report_default+set}" = set; then : enableval=$enable_collective_report_default; if test "x$enableval" = xyes ; then - $as_echo "#define COLLECTIVE_REPORT_DEFAULT 1" >>confdefs.h + +$as_echo "#define COLLECTIVE_REPORT_DEFAULT /**/" >>confdefs.h echo "Using collective report as default." fi @@ -2971,12 +3000,14 @@ if test "${enable_collective_report_default+set}" = set; then : fi + $as_echo "#define DEFAULT_REPORT_FORMAT mpiPi_style_verbose" >>confdefs.h # Check whether --enable-concise-report-default was given. if test "${enable_concise_report_default+set}" = set; then : enableval=$enable_concise_report_default; if test "x$enableval" = xyes ; then - $as_echo "#define DEFAULT_REPORT_FORMAT mpiPi_style_concise" >>confdefs.h + +$as_echo "#define DEFAULT_REPORT_FORMAT mpiPi_style_concise" >>confdefs.h echo "Using concise report as default." fi @@ -4953,7 +4984,8 @@ fi ac_fn_c_check_decl "$LINENO" "bfd_get_section_size" "ac_cv_have_decl_bfd_get_section_size" "#include \"bfd.h\" " if test "x$ac_cv_have_decl_bfd_get_section_size" = xyes; then : - $as_echo "#define HAVE_BFD_GET_SECTION_SIZE 1" >>confdefs.h + +$as_echo "#define HAVE_BFD_GET_SECTION_SIZE /**/" >>confdefs.h fi @@ -4969,20 +5001,23 @@ fi if test "x$ac_cv_type_bfd_boolean" = xyes; then : else - $as_echo "#define HAVE_BFD_BOOLEAN 1" >>confdefs.h + +$as_echo "#define HAVE_BFD_BOOLEAN /**/" >>confdefs.h fi if test "x$ENABLE_BFD" = "xyes" ; then ac_fn_c_check_header_mongrel "$LINENO" "demangle.h" "ac_cv_header_demangle_h" "$ac_includes_default" if test "x$ac_cv_header_demangle_h" = xyes; then : - $as_echo "#define HAVE_DEMANGLE_H 1" >>confdefs.h + +$as_echo "#define HAVE_DEMANGLE_H /**/" >>confdefs.h if test "x$DO_DEMANGLE" = xfalse ; then DO_DEMANGLE=GNU ; fi fi LIBS="$LIBS $BFD_AUX_LIBS" - $as_echo "#define ENABLE_BFD 1" >>confdefs.h + +$as_echo "#define ENABLE_BFD /**/" >>confdefs.h SOURCE_LOOKUP=bfd fi @@ -5078,7 +5113,8 @@ fi echo $ECHO_N "checking for libelf/libdwarf..." $ECHO_C if test x$LIBELF_FOUND = xyes -a x$LIBDWARF_FOUND = xyes ; then LIBS="${LIBS} -ldwarf -lelf" - $as_echo "#define USE_LIBDWARF 1" >>confdefs.h + +$as_echo "#define USE_LIBDWARF /**/" >>confdefs.h echo " found libelf/libdwarf" SOURCE_LOOKUP=libelf/libdwarf @@ -5127,7 +5163,8 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpi_MPIR_ToPointer" >&5 $as_echo "$ac_cv_lib_mpi_MPIR_ToPointer" >&6; } if test "x$ac_cv_lib_mpi_MPIR_ToPointer" = xyes; then : - $as_echo "#define HAVE_MPIR_TOPOINTER 1" >>confdefs.h + +$as_echo "#define HAVE_MPIR_TOPOINTER /**/" >>confdefs.h fi @@ -5168,7 +5205,8 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpich_MPIR_ToPointer" >&5 $as_echo "$ac_cv_lib_mpich_MPIR_ToPointer" >&6; } if test "x$ac_cv_lib_mpich_MPIR_ToPointer" = xyes; then : - $as_echo "#define HAVE_MPIR_TOPOINTER 1" >>confdefs.h + +$as_echo "#define HAVE_MPIR_TOPOINTER /**/" >>confdefs.h fi @@ -5191,7 +5229,8 @@ main () _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - $as_echo "#define USE_MPI3_CONSTS 1" >>confdefs.h + +$as_echo "#define USE_MPI3_CONSTS /**/" >>confdefs.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext @@ -5209,7 +5248,8 @@ if test x$TIMER_FOUND = xno && \ (test x$TIMER_OPTION = xno || test x$USE_RTS_GET_TIMEBASE = xyes); then ac_fn_c_check_func "$LINENO" "rts_get_timebase" "ac_cv_func_rts_get_timebase" if test "x$ac_cv_func_rts_get_timebase" = xyes; then : - $as_echo "#define USE_RTS_GET_TIMEBASE 1" >>confdefs.h + +$as_echo "#define USE_RTS_GET_TIMEBASE /**/" >>confdefs.h USE_RTS_GET_TIMEBASE=yes ; TIMER_FOUND=yes ; TIMER_NAME="rts_get_timebase (assuming 700MHz)" ; @@ -5223,7 +5263,8 @@ if test x$TIMER_FOUND = xno && \ ac_fn_c_check_decl "$LINENO" "_rtc" "ac_cv_have_decl__rtc" "#include " if test "x$ac_cv_have_decl__rtc" = xyes; then : - $as_echo "#define USE_RTC 1" >>confdefs.h + +$as_echo "#define USE_RTC /**/" >>confdefs.h USE_RTC=yes ; TIMER_FOUND=yes ; TIMER_NAME=_rtc ; @@ -5246,7 +5287,8 @@ fi if test "x$ac_cv_have_decl_mread_real_time" = xyes; then : else - $as_echo "#define NEED_MREAD_REAL_TIME_DECL 1" >>confdefs.h + +$as_echo "#define NEED_MREAD_REAL_TIME_DECL /**/" >>confdefs.h fi @@ -5301,7 +5343,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5 $as_echo "$ac_cv_lib_rt_clock_gettime" >&6; } if test "x$ac_cv_lib_rt_clock_gettime" = xyes; then : - $as_echo "#define USE_CLOCK_GETTIME 1" >>confdefs.h + $as_echo "#define USE_CLOCK_GETTIME Use clock_gettime for timing" >>confdefs.h USE_CLOCK_GETTIME=true TIMER_FOUND=yes TIMER_NAME=clock_gettime LIBS="$LIBS -lrt" fi @@ -5310,7 +5352,8 @@ fi # If specified, use dclock if test x$TIMER_FOUND = xno && test "x$USE_DCLOCK" = "xyes" ; then - $as_echo "#define USE_DCLOCK 1" >>confdefs.h + +$as_echo "#define USE_DCLOCK /**/" >>confdefs.h TIMER_FOUND=yes TIMER_NAME=dclock fi @@ -5318,11 +5361,13 @@ fi if test x$TIMER_FOUND = xno ; then ac_fn_c_check_func "$LINENO" "MPI_Wtime" "ac_cv_func_MPI_Wtime" if test "x$ac_cv_func_MPI_Wtime" = xyes; then : - $as_echo "#define USE_WTIME 1" >>confdefs.h + +$as_echo "#define USE_WTIME /**/" >>confdefs.h TIMER_NAME=MPI_Wtime else - echo Failed to find MPI_Wtime. Trying to use gettimeofday.; $as_echo "#define USE_GETTIMEOFDAY 1" >>confdefs.h + echo Failed to find MPI_Wtime. Trying to use gettimeofday.; +$as_echo "#define USE_GETTIMEOFDAY /**/" >>confdefs.h USE_GETTIMEOFDAY=true fi @@ -5337,7 +5382,8 @@ HAVE_LIBUNWIND=no if test "x$DISABLE_LIBUNWIND" = "xno" ; then ac_fn_c_check_header_mongrel "$LINENO" "libunwind.h" "ac_cv_header_libunwind_h" "$ac_includes_default" if test "x$ac_cv_header_libunwind_h" = xyes; then : - $as_echo "#define HAVE_LIBUNWIND 1" >>confdefs.h + +$as_echo "#define HAVE_LIBUNWIND /**/" >>confdefs.h LIBS="$LIBS -lunwind" HAVE_LIBUNWIND=yes UNWIND_WITH=libunwind else if test x$build_cpu = xx86_64 ; then @@ -5357,7 +5403,8 @@ fi if test x"$HAVE_LIBUNWIND" = xno && test x"$USE_SETJMP" = xno ; then ac_fn_c_check_func "$LINENO" "backtrace" "ac_cv_func_backtrace" if test "x$ac_cv_func_backtrace" = xyes; then : - $as_echo "#define USE_BACKTRACE 1" >>confdefs.h + +$as_echo "#define USE_BACKTRACE /**/" >>confdefs.h UNWIND_WITH=glibc-backtrace else USE_SETJMP=yes @@ -5368,7 +5415,8 @@ fi if test "$ENABLE_API_ONLY" = no && test "$ENABLE_MPI_IO" = yes ; then ac_fn_c_check_func "$LINENO" "MPI_File_open" "ac_cv_func_MPI_File_open" if test "x$ac_cv_func_MPI_File_open" = xyes; then : - $as_echo "#define HAVE_MPI_IO 1" >>confdefs.h + +$as_echo "#define HAVE_MPI_IO /**/" >>confdefs.h HAVE_MPI_IO=mpi.io.protos.txt else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPI_File_open in -lmpio" >&5 @@ -5408,7 +5456,8 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpio_MPI_File_open" >&5 $as_echo "$ac_cv_lib_mpio_MPI_File_open" >&6; } if test "x$ac_cv_lib_mpio_MPI_File_open" = xyes; then : - $as_echo "#define HAVE_MPI_IO 1" >>confdefs.h + +$as_echo "#define HAVE_MPI_IO /**/" >>confdefs.h HAVE_MPI_IO=mpi.io.protos.txt LIBS="${LIBS} -lmpio" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: MPI I/O symbols not found. MPI I/O reporting deactivated." >&5 @@ -5427,7 +5476,8 @@ fi if test "x$ENABLE_API_ONLY" = xno && test "x$ENABLE_MPI_RMA" = xyes ; then ac_fn_c_check_func "$LINENO" "MPI_Win_allocate" "ac_cv_func_MPI_Win_allocate" if test "x$ac_cv_func_MPI_Win_allocate" = xyes; then : - $as_echo "#define HAVE_MPI_RMA 1" >>confdefs.h + +$as_echo "#define HAVE_MPI_RMA /**/" >>confdefs.h HAVE_MPI_RMA=mpi.rma.protos.txt else { $as_echo "$as_me:${as_lineno-$LINENO}: result: MPI RMA symbols not found. MPI RMA reporting deactivated." >&5 @@ -5444,7 +5494,8 @@ fi if test "x$ENABLE_API_ONLY" = xno && test "x$ENABLE_MPI_NONBLOCKINGCOLLECTIVES" = xyes ; then ac_fn_c_check_func "$LINENO" "MPI_Ibarrier" "ac_cv_func_MPI_Ibarrier" if test "x$ac_cv_func_MPI_Ibarrier" = xyes; then : - $as_echo "#define HAVE_MPI_NONBLOCKINGCOLLECTIVES 1" >>confdefs.h + +$as_echo "#define HAVE_MPI_NONBLOCKINGCOLLECTIVES /**/" >>confdefs.h HAVE_MPI_NONBLOCKINGCOLLECTIVES=mpi.nbc.protos.txt else { $as_echo "$as_me:${as_lineno-$LINENO}: result: MPI NONBLOCKINGCOLLECTIVES symbols not found. MPI NONBLOCKINGCOLLECTIVES reporting deactivated." >&5 @@ -5476,7 +5527,8 @@ $as_echo "no" >&6; } if test "x$SO_LOOKUP" = xyes ; then ac_fn_c_check_func "$LINENO" "getline" "ac_cv_func_getline" if test "x$ac_cv_func_getline" = xyes; then : - $as_echo "#define SO_LOOKUP 1" >>confdefs.h + +$as_echo "#define SO_LOOKUP /**/" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: getline not found so SO lookup is disabled." >&5 @@ -5841,6 +5893,7 @@ else $as_echo "guessing lowercase with underscore" >&6; } fi + cat >>confdefs.h <<_ACEOF #define F77_SYMBOLS $F77_SYMBOLS _ACEOF diff --git a/configure.in b/configure.ac similarity index 85% rename from configure.in rename to configure.ac index f1522bd..bcc7a9d 100644 --- a/configure.in +++ b/configure.ac @@ -99,7 +99,7 @@ AC_SUBST(BIN_TYPE_FLAG) TIMER_OPTION=no AC_ARG_WITH(gettimeofday, AS_HELP_STRING(--with-gettimeofday,Use gettimeofday for timing.), - AC_DEFINE(USE_GETTIMEOFDAY) + AC_DEFINE([USE_GETTIMEOFDAY],[],[Use gettimeofday for the timer]) USE_GETTIMEOFDAY=true TIMER_OPTION=yes , @@ -107,14 +107,14 @@ AC_ARG_WITH(gettimeofday, AC_ARG_WITH(wtime, AS_HELP_STRING(--with-wtime,Use MPI_Wtime for timing.), - AC_DEFINE(USE_WTIME) + AC_DEFINE([USE_WTIME],[],[Use MPI_Wtime for timer]) TIMER_OPTION=yes , ) AC_ARG_WITH(clock_gettime, AS_HELP_STRING(--with-clock_gettime,Use clock_gettime for timing.), - AC_DEFINE(USE_CLOCK_GETTIME) + AC_DEFINE([USE_CLOCK_GETTIME], [], [Use clock_gettime for timing]) USE_CLOCK_GETTIME=yes TIMER_OPTION=yes , @@ -122,7 +122,7 @@ AC_ARG_WITH(clock_gettime, AC_ARG_WITH(rts_get_timebase, AS_HELP_STRING(--with-rts_get_timebase,Use rts_get_timebase for timing on BG/L systems (default for BG/L).), - AC_DEFINE(USE_RTS_GET_TIMEBASE) + AC_DEFINE([USE_RTS_GET_TIMEBASE],[],[Use RTS get timebase]) USE_RTS_GET_TIMEBASE=yes TIMER_OPTION=yes , @@ -131,7 +131,7 @@ AC_ARG_WITH(rts_get_timebase, AC_ARG_WITH(read_real_time, AS_HELP_STRING(--with-read_real_time,Use read_real_time for timing on AIX systems (default for AIX).), - AC_DEFINE(USE_READ_REAL_TIME) + AC_DEFINE([USE_READ_REAL_TIME], [], [Use read real time]) USE_READ_REAL_TIME=yes TIMER_OPTION=yes , @@ -140,7 +140,7 @@ AC_ARG_WITH(read_real_time, AC_ARG_WITH(rtc, AS_HELP_STRING(--with-rtc,Use _rtc for timing on CRAY X1 systems (default for X1).), - AC_DEFINE(USE_RTC) + AC_DEFINE([USE_RTC], [], [Use RTC]) USE_RTC=yes TIMER_OPTION=yes , @@ -149,7 +149,7 @@ AC_ARG_WITH(rtc, AC_ARG_WITH(dclock, AS_HELP_STRING(--with-dclock,Use Catamount dclock for timing.), - AC_DEFINE(USE_DCLOCK) + AC_DEFINE([USE_DCLOCK], [], [Use dlock]) USE_DCLOCK=yes TIMER_OPTION=yes , @@ -168,7 +168,7 @@ AC_ARG_ENABLE(api-only, if test x"$enableval" = xyes ; then ENABLE_API_ONLY=yes echo Configuring for API library only. - AC_DEFINE(ENABLE_API_ONLY) + AC_DEFINE([ENABLE_API_ONLY], [], ["Only build API"]) DEFAULT_TARGS="API test" fi , @@ -249,7 +249,7 @@ AC_ARG_ENABLE(setjmp, AS_HELP_STRING(--enable-setjmp,Use setjmp instead of glic backtrace() to generate stack traces.), if test x"$enableval" = xyes ; then USE_SETJMP=yes - AC_DEFINE(USE_SETJMP) + AC_DEFINE([USE_SETJMP], [], [Use setjmp]) echo Setjmp will be used to generate stack traces. fi , @@ -277,7 +277,7 @@ AC_ARG_ENABLE(fortranweak, echo Generation of additional weak FORTRAN symbol names has been disabled. else ENABLE_FORTRAN_WEAK_SYMS=yes - AC_DEFINE(ENABLE_FORTRAN_WEAK_SYMS) + AC_DEFINE([ENABLE_FORTRAN_WEAK_SYMS], [], [Enable weak symbols for FORTRAN]) echo Generation of additional weak FORTRAN symbol names has been enabled. fi , @@ -285,14 +285,16 @@ AC_ARG_ENABLE(fortranweak, ) AC_SUBST(ENABLE_FORTRAN_WEAK_SYMS) + + AC_ARG_ENABLE(stackdepth, - AS_HELP_STRING(--enable-stackdepth,Specify maximum stacktrace depth (default is 8).), - STACKDEPTH=$enableval - echo Maximum stacktrace depth is $STACKDEPTH - , - STACKDEPTH=8 + AS_HELP_STRING([--enable-stackdepth], [Specify maximum stacktrace depth (default is 8).]), + STACKDEPTH=$enableval; + echo "Maximum stacktrace depth is $STACKDEPTH", + STACKDEPTH=8, ) -AC_SUBST(STACKDEPTH) +AC_DEFINE_UNQUOTED([MPIP_CALLSITE_STACK_DEPTH_MAX], [$STACKDEPTH], [Depth of the callsite]) +#AC_SUBST(MPIP_CALLSITE_STACK_DEPTH_MAX) PC_LOOKUP_FILE=pc_lookup.c AC_ARG_ENABLE(dwarf, @@ -313,7 +315,7 @@ USE_GETARG=false AC_ARG_ENABLE(getarg, AS_HELP_STRING(--enable-getarg,Use getarg to get fortran command line args.), if test x"$enableval" = xyes ; then - AC_DEFINE(USE_GETARG) + AC_DEFINE([USE_GETARG], [], [Use getarg]) echo Use of getarg has been enabled USE_GETARG=true fi @@ -333,7 +335,7 @@ AC_SUBST(DO_DEMANGLE) AC_ARG_ENABLE(check-time, AS_HELP_STRING(--enable-check-time,Enable AIX check for negative time values.), if test x"$enableval" = xyes ; then - AC_DEFINE(MPIP_CHECK_TIME) + AC_DEFINE([MPIP_CHECK_TIME], [], [MPI check time]) echo AIX negative time value checking has been enabled fi , @@ -342,17 +344,17 @@ AC_ARG_ENABLE(check-time, AC_ARG_ENABLE(collective-report-default, AS_HELP_STRING(--enable-collective-report-default,Have mpiP default to low-memory-use collective report generation as opposed to collecting all data at a single task (see runtime flags -l and -s).), if test "x$enableval" = xyes ; then - AC_DEFINE(COLLECTIVE_REPORT_DEFAULT) + AC_DEFINE([COLLECTIVE_REPORT_DEFAULT],[], ["Use collective reporting by default"]) echo "Using collective report as default." fi , ) -AC_DEFINE([DEFAULT_REPORT_FORMAT], [mpiPi_style_verbose]) +AC_DEFINE([DEFAULT_REPORT_FORMAT], [mpiPi_style_verbose], [Default report style]) AC_ARG_ENABLE(concise-report-default, AS_HELP_STRING(--enable-concise-report-default,Have mpiP default to a concise summary report format. (see runtime flags -c and -v).), if test "x$enableval" = xyes ; then - AC_DEFINE([DEFAULT_REPORT_FORMAT], [mpiPi_style_concise]) + AC_DEFINE([DEFAULT_REPORT_FORMAT], [mpiPi_style_concise],[The default format of the report]) echo "Using concise report as default." fi , @@ -395,14 +397,14 @@ if test "x$ENABLE_BFD" = "xyes" ; then AC_CHECK_LIB(iberty,objalloc_create, BFD_AUX_LIBS="$BFD_AUX_LIBS -liberty") AC_CHECK_HEADER(bfd.h, AC_CHECK_LIB(bfd,bfd_openr, LIBS="$LIBS -lbfd", ENABLE_BFD=no, $BFD_AUX_LIBS) - AC_CHECK_DECL(bfd_get_section_size, AC_DEFINE(HAVE_BFD_GET_SECTION_SIZE), ,[#include "bfd.h"]) + AC_CHECK_DECL(bfd_get_section_size, AC_DEFINE([HAVE_BFD_GET_SECTION_SIZE], [], [BFD get section size]), ,[#include "bfd.h"]) , ENABLE_BFD=no SO_LOOKUP=no ) - AC_CHECK_TYPE(bfd_boolean, ,AC_DEFINE(HAVE_BFD_BOOLEAN), [#include "bfd.h"]) + AC_CHECK_TYPE(bfd_boolean, ,AC_DEFINE([HAVE_BFD_BOOLEAN], [], [BFD booleans]), [#include "bfd.h"]) if test "x$ENABLE_BFD" = "xyes" ; then - AC_CHECK_HEADER(demangle.h, [AC_DEFINE(HAVE_DEMANGLE_H) if test "x$DO_DEMANGLE" = xfalse ; then DO_DEMANGLE=GNU ; fi]) + AC_CHECK_HEADER(demangle.h, [AC_DEFINE([HAVE_DEMANGLE_H], [], [Have demangling]) if test "x$DO_DEMANGLE" = xfalse ; then DO_DEMANGLE=GNU ; fi]) LIBS="$LIBS $BFD_AUX_LIBS" - AC_DEFINE(ENABLE_BFD) + AC_DEFINE([ENABLE_BFD], [], [Enable BFD library for the PC to source lookups]) SOURCE_LOOKUP=bfd fi @@ -419,7 +421,7 @@ else echo $ECHO_N "checking for libelf/libdwarf..." $ECHO_C if test x$LIBELF_FOUND = xyes -a x$LIBDWARF_FOUND = xyes ; then LIBS="${LIBS} -ldwarf -lelf" - AC_DEFINE(USE_LIBDWARF) + AC_DEFINE([USE_LIBDWARF], [], [Use libdwarf]) echo " found libelf/libdwarf" SOURCE_LOOKUP=libelf/libdwarf SO_LOOKUP=no @@ -430,8 +432,8 @@ else fi if test "$ENABLE_API_ONLY" = no ; then - AC_CHECK_LIB(mpi,MPIR_ToPointer,AC_DEFINE(HAVE_MPIR_TOPOINTER),) - AC_CHECK_LIB(mpich,MPIR_ToPointer,AC_DEFINE(HAVE_MPIR_TOPOINTER),) + AC_CHECK_LIB(mpi,MPIR_ToPointer,AC_DEFINE([HAVE_MPIR_TOPOINTER], [], [Have MPIR to pointer]),) + AC_CHECK_LIB(mpich,MPIR_ToPointer,AC_DEFINE([HAVE_MPIR_TOPOINTER],[], [Have MPIR to pointer]),) fi # Check for MPI3 @@ -442,7 +444,7 @@ AC_COMPILE_IFELSE( #endif ]) ], - AC_DEFINE(USE_MPI3_CONSTS)) + AC_DEFINE([USE_MPI3_CONSTS],[],[Use MPI v3 constructions])) # @@ -455,7 +457,7 @@ TIMER_NAME=none # use rts_get_timebase (BG/L) by default if it exists if test x$TIMER_FOUND = xno && \ (test x$TIMER_OPTION = xno || test x$USE_RTS_GET_TIMEBASE = xyes); then -AC_CHECK_FUNC(rts_get_timebase, AC_DEFINE(USE_RTS_GET_TIMEBASE) +AC_CHECK_FUNC(rts_get_timebase, AC_DEFINE([USE_RTS_GET_TIMEBASE], [], [Use RTS get timebase]) USE_RTS_GET_TIMEBASE=yes ; TIMER_FOUND=yes ; TIMER_NAME="rts_get_timebase (assuming 700MHz)" ; AC_SUBST(USE_RTS_GET_TIMEBASE) ) fi @@ -463,7 +465,7 @@ fi # use _rtc (Cray X1) by default if it exists if test x$TIMER_FOUND = xno && \ (test x$TIMER_OPTION = xno || test x$USE_RTC = xyes); then -AC_CHECK_DECL(_rtc, AC_DEFINE(USE_RTC) +AC_CHECK_DECL(_rtc, AC_DEFINE([USE_RTC], [], [Use RTC]) USE_RTC=yes ; TIMER_FOUND=yes ; TIMER_NAME=_rtc ; AC_SUBST(USE_RTC) , , [#include ]) fi @@ -474,7 +476,7 @@ if test x$TIMER_FOUND = xno && test x$TIMER_OPTION = xno ; then AC_CHECK_FUNC(mread_real_time, READ_REAL_TIME=mread_real_time TIMER_FOUND=yes) if test x$TIMER_FOUND = xyes; then # In AIX 5.3, finding mread_real_time in libc, but not in header files. - AC_CHECK_DECL(mread_real_time, ,AC_DEFINE(NEED_MREAD_REAL_TIME_DECL),[#include ] [#include ]) + AC_CHECK_DECL(mread_real_time, ,AC_DEFINE([NEED_MREAD_REAL_TIME_DECL], [], [Need Real-time declaration]),[#include ] [#include ]) else AC_CHECK_FUNC(read_real_time, READ_REAL_TIME=read_real_time TIMER_FOUND=yes) fi @@ -485,19 +487,19 @@ fi # If specified, try to use clock_gettime if test x$TIMER_FOUND = xno && test "x$USE_CLOCK_GETTIME" = "xyes" ; then - AC_CHECK_LIB(rt,clock_gettime, AC_DEFINE(USE_CLOCK_GETTIME) USE_CLOCK_GETTIME=true TIMER_FOUND=yes TIMER_NAME=clock_gettime LIBS="$LIBS -lrt" + AC_CHECK_LIB(rt,clock_gettime, AC_DEFINE([USE_CLOCK_GETTIME],[] [Use clock_gettime for timing]) USE_CLOCK_GETTIME=true TIMER_FOUND=yes TIMER_NAME=clock_gettime LIBS="$LIBS -lrt" ) fi # If specified, use dclock if test x$TIMER_FOUND = xno && test "x$USE_DCLOCK" = "xyes" ; then - AC_DEFINE(USE_DCLOCK) TIMER_FOUND=yes TIMER_NAME=dclock + AC_DEFINE([USE_DCLOCK], [], [Use dlock]) TIMER_FOUND=yes TIMER_NAME=dclock fi # If no appropriate timers were found, default to MPI_Wtime if test x$TIMER_FOUND = xno ; then - AC_CHECK_FUNC(MPI_Wtime, AC_DEFINE(USE_WTIME) TIMER_NAME=MPI_Wtime - , echo Failed to find MPI_Wtime. Trying to use gettimeofday.; AC_DEFINE(USE_GETTIMEOFDAY) USE_GETTIMEOFDAY=true) + AC_CHECK_FUNC(MPI_Wtime, AC_DEFINE([USE_WTIME], [], [Use MPI_Wtime]) TIMER_NAME=MPI_Wtime + , echo Failed to find MPI_Wtime. Trying to use gettimeofday.; AC_DEFINE([USE_GETTIMEOFDAY],[],[Use gettimofday]) USE_GETTIMEOFDAY=true) fi @@ -507,7 +509,7 @@ UNWIND_WITH=internal # access platform-specific functions. HAVE_LIBUNWIND=no if test "x$DISABLE_LIBUNWIND" = "xno" ; then - AC_CHECK_HEADER(libunwind.h, AC_DEFINE(HAVE_LIBUNWIND) LIBS="$LIBS -lunwind" HAVE_LIBUNWIND=yes UNWIND_WITH=libunwind, + AC_CHECK_HEADER(libunwind.h, AC_DEFINE([HAVE_LIBUNWIND],[], [Have libunwind]) LIBS="$LIBS -lunwind" HAVE_LIBUNWIND=yes UNWIND_WITH=libunwind, [ if test x$build_cpu = xx86_64 ; then echo echo " mpiP on x86_64 platforms requires libunwind." @@ -520,14 +522,14 @@ if test "x$DISABLE_LIBUNWIND" = "xno" ; then fi if test x"$HAVE_LIBUNWIND" = xno && test x"$USE_SETJMP" = xno ; then - AC_CHECK_FUNC(backtrace, AC_DEFINE(USE_BACKTRACE) UNWIND_WITH=glibc-backtrace, USE_SETJMP=yes) + AC_CHECK_FUNC(backtrace, AC_DEFINE([USE_BACKTRACE], [], [Use backtrace]) UNWIND_WITH=glibc-backtrace, USE_SETJMP=yes) fi if test "$ENABLE_API_ONLY" = no && test "$ENABLE_MPI_IO" = yes ; then AC_CHECK_FUNC(MPI_File_open, - AC_DEFINE(HAVE_MPI_IO) HAVE_MPI_IO=mpi.io.protos.txt, + AC_DEFINE([HAVE_MPI_IO], [], [Have MPI-IO]) HAVE_MPI_IO=mpi.io.protos.txt, AC_CHECK_LIB(mpio,MPI_File_open, - AC_DEFINE(HAVE_MPI_IO) HAVE_MPI_IO=mpi.io.protos.txt LIBS="${LIBS} -lmpio", + AC_DEFINE([HAVE_MPI_IO],[],[Have MPI-IO]) HAVE_MPI_IO=mpi.io.protos.txt LIBS="${LIBS} -lmpio", AC_MSG_RESULT(MPI I/O symbols not found. MPI I/O reporting deactivated.) HAVE_MPI_IO=/dev/null ENABLE_MPI_IO=no ) @@ -538,7 +540,7 @@ fi if test "x$ENABLE_API_ONLY" = xno && test "x$ENABLE_MPI_RMA" = xyes ; then AC_CHECK_FUNC(MPI_Win_allocate, - AC_DEFINE(HAVE_MPI_RMA) HAVE_MPI_RMA=mpi.rma.protos.txt, + AC_DEFINE([HAVE_MPI_RMA], [], [Have MPI RMA]) HAVE_MPI_RMA=mpi.rma.protos.txt, AC_MSG_RESULT([MPI RMA symbols not found. MPI RMA reporting deactivated.]) HAVE_MPI_RMA=/dev/null ENABLE_MPI_RMA=no @@ -549,7 +551,7 @@ fi if test "x$ENABLE_API_ONLY" = xno && test "x$ENABLE_MPI_NONBLOCKINGCOLLECTIVES" = xyes ; then AC_CHECK_FUNC(MPI_Ibarrier, - AC_DEFINE(HAVE_MPI_NONBLOCKINGCOLLECTIVES) HAVE_MPI_NONBLOCKINGCOLLECTIVES=mpi.nbc.protos.txt, + AC_DEFINE([HAVE_MPI_NONBLOCKINGCOLLECTIVES],[],[Have MPI non-blocking collectives]) HAVE_MPI_NONBLOCKINGCOLLECTIVES=mpi.nbc.protos.txt, AC_MSG_RESULT([MPI NONBLOCKINGCOLLECTIVES symbols not found. MPI NONBLOCKINGCOLLECTIVES reporting deactivated.]) HAVE_MPI_NONBLOCKINGCOLLECTIVES=/dev/null ENABLE_MPI_NONBLOCKINGCOLLECTIVES=no @@ -571,7 +573,7 @@ if test "x$DISABLE_SO_LOOKUP" = "xno" && test "x$ENABLE_BFD" = xyes; then # SO lookup code uses getline, assumes ought to be available if we are using libbfd if test "x$SO_LOOKUP" = xyes ; then - AC_CHECK_FUNC(getline, AC_DEFINE(SO_LOOKUP), AC_MSG_RESULT([getline not found so SO lookup is disabled.])) + AC_CHECK_FUNC(getline, AC_DEFINE([SO_LOOKUP],[],[SO lookup]), AC_MSG_RESULT([getline not found so SO lookup is disabled.])) fi fi @@ -664,7 +666,7 @@ else AC_MSG_RESULT(guessing lowercase with underscore) fi AC_SUBST(F77_SYMBOLS) -AC_DEFINE_UNQUOTED(F77_SYMBOLS,$F77_SYMBOLS) +AC_DEFINE_UNQUOTED([F77_SYMBOLS],[$F77_SYMBOLS], [F77 symbols]) dnl ========== Identify F77 ========== diff --git a/mpiPconfig.h.in b/mpiPconfig.h.in index b9f615f..d37db3b 100644 --- a/mpiPconfig.h.in +++ b/mpiPconfig.h.in @@ -1,172 +1,142 @@ -/* -*- C -*- +/* mpiPconfig.h.in. Generated from configure.ac by autoheader. */ - mpiP MPI Profiler ( http://llnl.github.io/mpiP ) +/* "Use collective reporting by default" */ +#undef COLLECTIVE_REPORT_DEFAULT + +/* The default format of the report */ +#undef DEFAULT_REPORT_FORMAT - Please see COPYRIGHT AND LICENSE information at the end of this file. +/* "Only build API" */ +#undef ENABLE_API_ONLY - ----- +/* Enable BFD library for the PC to source lookups */ +#undef ENABLE_BFD - Autoconf configuration macros +/* Enable weak symbols for FORTRAN */ +#undef ENABLE_FORTRAN_WEAK_SYMS - $Id$ -*/ +/* F77 symbols */ +#undef F77_SYMBOLS +/* BFD booleans */ +#undef HAVE_BFD_BOOLEAN -#ifndef _MPIPCONFIG_H -#define _MPIPCONFIG_H +/* BFD get section size */ +#undef HAVE_BFD_GET_SECTION_SIZE -/* Define if demangle.h is present. */ +/* Have demangling */ #undef HAVE_DEMANGLE_H -/* Define if using libdwarf for source lookup */ -#undef USE_LIBDWARF +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H -/* Define if using binutils libbfd */ -#undef ENABLE_BFD +/* Define to 1 if you have the `m' library (-lm). */ +#undef HAVE_LIBM -/* Define if using libunwind */ +/* Have libunwind */ #undef HAVE_LIBUNWIND -/* Define if MPI I/O functions are present */ +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Have MPIR to pointer */ +#undef HAVE_MPIR_TOPOINTER + +/* Have MPI-IO */ #undef HAVE_MPI_IO -/* Define if MPI RMA functions are present */ +/* Have MPI non-blocking collectives */ +#undef HAVE_MPI_NONBLOCKINGCOLLECTIVES + +/* Have MPI RMA */ #undef HAVE_MPI_RMA -/* Define if MPI non-blocking collectives functions are present */ -#undef HAVE_MPI_NONBLOCKINGCOLLECTIVES +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H -/* Define if bfd_boolean not defined */ -#undef HAVE_BFD_BOOLEAN +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H -/* Define to activate check for negative time values */ -#undef MPIP_CHECK_TIME +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H -/* Define to force use of read_real_time for timing */ -#undef USE_READ_REAL_TIME +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H -/* Define to force use of gettimeofday for timing */ -#undef USE_GETTIMEOFDAY +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H -/* Define to use clock_gettime for timing */ -#undef USE_CLOCK_GETTIME +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H -/* Define to use dclock for timing */ -#undef USE_DCLOCK +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H -/* Define to use MPI_Wtime for timing */ -#undef USE_WTIME +/* Depth of the callsite */ +#undef MPIP_CALLSITE_STACK_DEPTH_MAX -/* Define to use rts_get_timebase on BG/L for timing */ -#undef USE_RTS_GET_TIMEBASE +/* MPI check time */ +#undef MPIP_CHECK_TIME -/* Define to use _rtc on Cray X1 */ -#undef USE_RTC +/* Need Real-time declaration */ +#undef NEED_MREAD_REAL_TIME_DECL -/* Distinguish available BFD calls between 2.15 and 2.15.96 */ -#undef HAVE_BFD_GET_SECTION_SIZE +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT -/* Address bug in Quadrics MPI Opaque Object translation */ -#undef HAVE_MPIR_TOPOINTER +/* Define to the full name of this package. */ +#undef PACKAGE_NAME -/* Do non-MPI configure for API library only */ -#undef ENABLE_API_ONLY +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING -/* Have collective report generation be default */ -#undef COLLECTIVE_REPORT_DEFAULT +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME -/* Determine whether to include weak symbol include files */ -#undef ENABLE_FORTRAN_WEAK_SYMS +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* SO lookup */ +#undef SO_LOOKUP + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS -/* Use glibc backtrace for stack trace */ +/* Use backtrace */ #undef USE_BACKTRACE -/* Use setjmp to get stack pointer for naive stack unwinding */ -#undef USE_SETJMP +/* Use clock_gettime for timing */ +#undef USE_CLOCK_GETTIME -/* Add mread_real_time declaration if needed. */ -#undef NEED_MREAD_REAL_TIME_DECL +/* Use dlock */ +#undef USE_DCLOCK -/* Use /proc/self/maps to get SO info for source lookup. */ -#undef SO_LOOKUP +/* Use getarg */ +#undef USE_GETARG -/* Set the default report format (concise or verbose). */ -#undef DEFAULT_REPORT_FORMAT +/* Use gettimofday */ +#undef USE_GETTIMEOFDAY + +/* Use libdwarf */ +#undef USE_LIBDWARF -/* Specify use of "const"s, as per the MPI-3 specification. */ +/* Use MPI v3 constructions */ #undef USE_MPI3_CONSTS -/* PACKAGE definitions */ -#undef PACKAGE_NAME -#undef PACKAGE_VERSION +/* Use read real time */ +#undef USE_READ_REAL_TIME -#endif /* _CONFIG_H */ - -/* - - - -Copyright (c) 2006, The Regents of the University of California. -Produced at the Lawrence Livermore National Laboratory -Written by Jeffery Vetter and Christopher Chambreau. -UCRL-CODE-223450. -All rights reserved. - -This file is part of mpiP. For details, see http://llnl.github.io/mpiP. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright -notice, this list of conditions and the disclaimer below. - -* Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the disclaimer (as noted below) in -the documentation and/or other materials provided with the -distribution. - -* Neither the name of the UC/LLNL nor the names of its contributors -may be used to endorse or promote products derived from this software -without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OF -THE UNIVERSITY OF CALIFORNIA, THE U.S. DEPARTMENT OF ENERGY OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -Additional BSD Notice - -1. This notice is required to be provided under our contract with the -U.S. Department of Energy (DOE). This work was produced at the -University of California, Lawrence Livermore National Laboratory under -Contract No. W-7405-ENG-48 with the DOE. - -2. Neither the United States Government nor the University of -California nor any of their employees, makes any warranty, express or -implied, or assumes any liability or responsibility for the accuracy, -completeness, or usefulness of any information, apparatus, product, or -process disclosed, or represents that its use would not infringe -privately-owned rights. - -3. Also, reference herein to any specific commercial products, -process, or services by trade name, trademark, manufacturer or -otherwise does not necessarily constitute or imply its endorsement, -recommendation, or favoring by the United States Government or the -University of California. The views and opinions of authors expressed -herein do not necessarily state or reflect those of the United States -Government or the University of California, and shall not be used for -advertising or product endorsement purposes. - - - -*/ +/* Use RTC */ +#undef USE_RTC + +/* Use RTS get timebase */ +#undef USE_RTS_GET_TIMEBASE + +/* Use setjmp */ +#undef USE_SETJMP + +/* Use MPI_Wtime */ +#undef USE_WTIME diff --git a/mpiPi.h.in b/mpiPi.h.in index 82f0789..88792d7 100644 --- a/mpiPi.h.in +++ b/mpiPi.h.in @@ -42,9 +42,8 @@ #include "mpip_timers.h" #define MPIPI_HOSTNAME_LEN_MAX 128 -#define MPIP_CALLSITE_STACK_DEPTH_MAX @STACKDEPTH@ -#define MPIP_HELP_LIST "@PACKAGE_BUGREPORT@" +#define MPIP_HELP_LIST PACKAGE_BUGREPORT #define MPIP_CALLSITE_STACK_DEPTH (mpiPi.stackDepth) #define MPIP_CALLSITE_STATS_COOKIE 518641 From 7776bcbd9a76d92f3ce132f682ed02f5744d1b10 Mon Sep 17 00:00:00 2001 From: Artem Polyakov Date: Thu, 27 Jun 2019 15:43:34 -0700 Subject: [PATCH 2/5] Get rid of mpiPi.h.in file as unneeded Signed-off-by: Artem Polyakov --- Makefile.in | 2 +- configure | 3 +-- configure.ac | 2 +- mpiPi.h.in => mpiPi.h | 0 4 files changed, 3 insertions(+), 4 deletions(-) rename mpiPi.h.in => mpiPi.h (100%) diff --git a/Makefile.in b/Makefile.in index ad7f51b..834170f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -298,7 +298,7 @@ lint: ${SRCS} distclean: clean make -C testing clean - rm -f Makefile Defs.mak Check.mak config.log config.status lookup.c mpiPconfig.h mpiPi_def.h symbols.h wrappers.c testing/Makefile libmpiP* mpi.protos.txt mpiPi.h get_fortran_arg.f mpip_timers/aix_local.h site.exp site.bak testing.sum + rm -f Makefile Defs.mak Check.mak config.log config.status lookup.c mpiPconfig.h mpiPi_def.h symbols.h wrappers.c testing/Makefile libmpiP* mpi.protos.txt get_fortran_arg.f mpip_timers/aix_local.h site.exp site.bak testing.sum include Check.mak diff --git a/configure b/configure index 2ecc882..ce21553 100755 --- a/configure +++ b/configure @@ -5991,7 +5991,7 @@ if test "x${slibdir}" = x ; then fi -ac_config_files="$ac_config_files Defs.mak Makefile testing/Makefile Check.mak mpiPi.h mpi.protos.txt get_fortran_arg.f mpip_timers/aix_local.h" +ac_config_files="$ac_config_files Defs.mak Makefile testing/Makefile Check.mak mpi.protos.txt get_fortran_arg.f mpip_timers/aix_local.h" @@ -6604,7 +6604,6 @@ do "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "testing/Makefile") CONFIG_FILES="$CONFIG_FILES testing/Makefile" ;; "Check.mak") CONFIG_FILES="$CONFIG_FILES Check.mak" ;; - "mpiPi.h") CONFIG_FILES="$CONFIG_FILES mpiPi.h" ;; "mpi.protos.txt") CONFIG_FILES="$CONFIG_FILES mpi.protos.txt" ;; "get_fortran_arg.f") CONFIG_FILES="$CONFIG_FILES get_fortran_arg.f" ;; "mpip_timers/aix_local.h") CONFIG_FILES="$CONFIG_FILES mpip_timers/aix_local.h" ;; diff --git a/configure.ac b/configure.ac index bcc7a9d..6a3ecb6 100644 --- a/configure.ac +++ b/configure.ac @@ -753,7 +753,7 @@ if test "x${slibdir}" = x ; then fi AC_SUBST(slibdir) -AC_CONFIG_FILES([Defs.mak Makefile testing/Makefile Check.mak mpiPi.h mpi.protos.txt get_fortran_arg.f mpip_timers/aix_local.h]) +AC_CONFIG_FILES([Defs.mak Makefile testing/Makefile Check.mak mpi.protos.txt get_fortran_arg.f mpip_timers/aix_local.h]) AC_OUTPUT # diff --git a/mpiPi.h.in b/mpiPi.h similarity index 100% rename from mpiPi.h.in rename to mpiPi.h From 8fa9722a8eb284ab6e43cc4957faac51f372c3ce Mon Sep 17 00:00:00 2001 From: Artem Polyakov Date: Thu, 27 Jun 2019 15:45:25 -0700 Subject: [PATCH 3/5] Configury change: introduce mpiP-state.[c|h] files Signed-off-by: Artem Polyakov --- Makefile.in | 2 ++ mpiP-stats.c | 0 mpiP-stats.h | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+) create mode 100644 mpiP-stats.c create mode 100644 mpiP-stats.h diff --git a/Makefile.in b/Makefile.in index 834170f..d798589 100644 --- a/Makefile.in +++ b/Makefile.in @@ -35,6 +35,7 @@ PC_LOOKUP_OBJ = $(PC_LOOKUP_FILE:.c=.o) SRCS = diag_msgs.c \ mpiP-hash.c \ + mpiP-stats.c \ glob.c \ wrappers.c \ wrappers_special.c \ @@ -49,6 +50,7 @@ SRCS = diag_msgs.c \ API_SRCS = diag_msgs_api.c \ mpiP-hash.c \ + mpiP-stats.c \ glob.c \ mpiPi.c \ util.c \ diff --git a/mpiP-stats.c b/mpiP-stats.c new file mode 100644 index 0000000..e69de29 diff --git a/mpiP-stats.h b/mpiP-stats.h new file mode 100644 index 0000000..8cc7993 --- /dev/null +++ b/mpiP-stats.h @@ -0,0 +1,95 @@ +/* -*- C -*- + + mpiP MPI Profiler ( http://llnl.github.io/mpiP ) + + Please see COPYRIGHT AND LICENSE information at the end of this file. + + ----- + + hash.h -- generic hash table + + $Id$ + +*/ + +#ifndef _MPIP_STATS_H +#define _MPIP_STATS_H + + +#endif + +/* + + + + Copyright (c) 2006, The Regents of the University of California. + Produced at the Lawrence Livermore National Laboratory + Written by Jeffery Vetter and Christopher Chambreau. + UCRL-CODE-223450. + All rights reserved. + + Copyright (c) 2019, Mellanox Technologies Inc. + Written by Artem Polyakov + All rights reserved. + + + This file is part of mpiP. For details, see http://llnl.github.io/mpiP. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the disclaimer below. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the disclaimer (as noted below) in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of the UC/LLNL nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OF + THE UNIVERSITY OF CALIFORNIA, THE U.S. DEPARTMENT OF ENERGY OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + Additional BSD Notice + + 1. This notice is required to be provided under our contract with the + U.S. Department of Energy (DOE). This work was produced at the + University of California, Lawrence Livermore National Laboratory under + Contract No. W-7405-ENG-48 with the DOE. + + 2. Neither the United States Government nor the University of + California nor any of their employees, makes any warranty, express or + implied, or assumes any liability or responsibility for the accuracy, + completeness, or usefulness of any information, apparatus, product, or + process disclosed, or represents that its use would not infringe + privately-owned rights. + + 3. Also, reference herein to any specific commercial products, + process, or services by trade name, trademark, manufacturer or + otherwise does not necessarily constitute or imply its endorsement, + recommendation, or favoring by the United States Government or the + University of California. The views and opinions of authors expressed + herein do not necessarily state or reflect those of the United States + Government or the University of California, and shall not be used for + advertising or product endorsement purposes. + + + +*/ + +/* EOF */ From c5e350f582d4b54595c8a06a9b14f03580a579ed Mon Sep 17 00:00:00 2001 From: Artem Polyakov Date: Wed, 12 Jun 2019 11:10:53 -0700 Subject: [PATCH 4/5] Preliminary step for adding multi-threaded support Extract the per-thread part from the global state. A per-thread portion includes the data collected at MPI_x invocation that can happen concurrently, i.e.: * Callsite information * Collectives statistics * Point-to-point statistics * Statistics collection on/off has also be per-thread Signed-off-by: Artem Polyakov --- make-wrappers.py | 12 +- mpiP-hash.c | 5 +- mpiP-stats.c | 384 +++++++++++++++++++++++++++++++++++++++++++++++ mpiP-stats.h | 105 +++++++++++++ mpiPi.c | 284 ++++++----------------------------- mpiPi.h | 52 +------ pcontrol.c | 29 +--- report.c | 251 ++++++------------------------- 8 files changed, 600 insertions(+), 522 deletions(-) diff --git a/make-wrappers.py b/make-wrappers.py index 8e22d87..da69307 100755 --- a/make-wrappers.py +++ b/make-wrappers.py @@ -1053,7 +1053,7 @@ def CreateWrapper(funct, olist): olist.append("\n{\n") olist.append( " int rc, enabledState;\n double dur;\n int tsize;\n double messSize = 0.;\n double ioSize = 0.;\n double rmaSize =0.;\n mpiPi_TIME start, end;\n void *call_stack[MPIP_CALLSITE_STACK_DEPTH_MAX] = { NULL };\n" ) - olist.append("\nif (mpiPi.enabled) {\n") + olist.append("\nif (mpiPi_stats_thr_is_on(&mpiPi.task_stats)) {\n") if fdict[funct].wrapperPreList: olist.extend(fdict[funct].wrapperPreList) @@ -1066,9 +1066,10 @@ def CreateWrapper(funct, olist): # end of enabled check olist.append("}\n\n") + # Mark that we have already entered Profiler to avoid nested invocations + olist.append("mpiPi_stats_thr_enter(&mpiPi.task_stats);\n") + # call PMPI - olist.append("enabledState = mpiPi.enabled;\n") - olist.append("mpiPi.enabled = 0;\n") olist.append("\nrc = P" + funct + "( " ) for i in fdict[funct].paramConciseList: @@ -1086,8 +1087,9 @@ def CreateWrapper(funct, olist): olist.append(", ") olist.append(");\n\n") - olist.append("mpiPi.enabled = enabledState;\n") - olist.append("if (mpiPi.enabled) {\n") + # Mark that we exited Profiler + olist.append("mpiPi_stats_thr_exit(&mpiPi.task_stats);\n") + olist.append("if (mpiPi_stats_thr_is_on(&mpiPi.task_stats)) {\n") olist.append("\n" + "mpiPi_GETTIME (&end);\n" + "dur = mpiPi_GETTIMEDIFF (&end, &start);\n") diff --git a/mpiP-hash.c b/mpiP-hash.c index 014b584..dd3db37 100644 --- a/mpiP-hash.c +++ b/mpiP-hash.c @@ -114,8 +114,11 @@ h_search (h_t * ht, void *key, void **ptr) { unsigned tableIndex; h_entry_t *het_index = NULL; - if (ht == NULL) + if (ht == NULL){ + int delay = 1; + while(delay) { sleep(1); } Abort ("hash table uninitialized"); + } if (key == NULL) Abort ("h_search: key == NULL"); if (ptr == NULL) diff --git a/mpiP-stats.c b/mpiP-stats.c index e69de29..c5fd38b 100644 --- a/mpiP-stats.c +++ b/mpiP-stats.c @@ -0,0 +1,384 @@ +#include +#include +#include "mpiP-stats.h" +#include "mpiPi.h" + +/* + * ============================================================================ + * + * Histogram code + * + * ============================================================================ + */ + +static int +get_histogram_bin (mpiPi_histogram_t * h, int val) +{ + int wv = val; + int bin; + + bin = 0; + + if (h->bin_intervals == NULL) + { + while (wv > h->first_bin_max && bin < h->hist_size) + { + wv >>= 1; + bin++; + } + } + else /* Add code for custom intervals later */ + { + } + + return bin; +} + + +void +init_histogram (mpiPi_histogram_t * h, int first_bin_max, int size, + int *intervals) +{ + h->first_bin_max = first_bin_max; + h->hist_size = size; + h->bin_intervals = intervals; +} + +void +get_histogram_bin_str (mpiPi_histogram_t * h, int v, char *s) +{ + int min = 0, max = 0; + + if (v == 0) + { + min = 0; + max = h->first_bin_max; + } + else + { + min = h->first_bin_max + 1; + min <<= (v - 1); + max = (min << 1) - 1; + } + + sprintf (s, "%8d - %8d", min, max); +} + +/* + * ============================================================================ + * + * Per-thread statistics + * + * ============================================================================ + */ + + +static int +_thrd_pc_hashkey (const void *p) +{ + int res = 0; + int i; + callsite_stats_t *csp = (callsite_stats_t *) p; + MPIP_CALLSITE_STATS_COOKIE_ASSERT (csp); + for (i = 0; i < MPIP_CALLSITE_STACK_DEPTH; i++) + { + res ^= (unsigned) (long) csp->pc[i]; + } + return 52271 ^ csp->op ^ res ^ csp->rank; +} + +static int +trd_pc_comparator (const void *p1, const void *p2) +{ + int i; + callsite_stats_t *csp_1 = (callsite_stats_t *) p1; + callsite_stats_t *csp_2 = (callsite_stats_t *) p2; + MPIP_CALLSITE_STATS_COOKIE_ASSERT (csp_1); + MPIP_CALLSITE_STATS_COOKIE_ASSERT (csp_2); + +#define express(f) {if ((csp_1->f) > (csp_2->f)) {return 1;} if ((csp_1->f) < (csp_2->f)) {return -1;}} + express (op); + express (rank); + + for (i = 0; i < MPIP_CALLSITE_STACK_DEPTH; i++) + { + express (pc[i]); + } +#undef express + + return 0; +} + +int mpiPi_stats_thr_init(mpiPi_thread_stat_t *stat) +{ + stat->task_callsite_stats = h_open (mpiPi.tableSize, _thrd_pc_hashkey, + trd_pc_comparator); + + if (mpiPi.do_collective_stats_report == 1) + { + init_histogram (&stat->coll.comm_hist, 7, MPIP_COMM_HISTCNT, NULL); + init_histogram (&stat->coll.size_hist, 7, MPIP_SIZE_HISTCNT, NULL); + } + + if (mpiPi.do_pt2pt_stats_report == 1) + { + init_histogram (&stat->pt2pt.comm_hist, 7, MPIP_COMM_HISTCNT, NULL); + init_histogram (&stat->pt2pt.size_hist, 7, MPIP_SIZE_HISTCNT, NULL); + } +} + +void mpiPi_stats_thr_fini(mpiPi_thread_stat_t *stat) +{ + h_close (stat->task_callsite_stats); +} + +int mpiPi_stats_thr_exit(mpiPi_thread_stat_t *stat) +{ + stat->disabled++; +} + +int mpiPi_stats_thr_enter(mpiPi_thread_stat_t *stat) +{ + stat->disabled--; +} + +int mpiPi_stats_thr_is_on(mpiPi_thread_stat_t *stat) +{ + return !(stat->disabled) && mpiPi.enabled; +} + +/* Callsite statistics */ +void +mpiPi_stats_thr_cs_upd (mpiPi_thread_stat_t *stat, + unsigned op, unsigned rank, void **pc, + double dur, double sendSize, double ioSize, + double rmaSize) +{ + int i; + callsite_stats_t *csp = NULL; + callsite_stats_t key; + + assert (dur >= 0); + + key.op = op; + key.rank = rank; + key.cookie = MPIP_CALLSITE_STATS_COOKIE; + for (i = 0; i < MPIP_CALLSITE_STACK_DEPTH; i++) + { + key.pc[i] = pc[i]; + } + + if (NULL == h_search (stat->task_callsite_stats, &key, (void **) &csp)) + { + /* create and insert */ + csp = (callsite_stats_t *) malloc (sizeof (callsite_stats_t)); + bzero (csp, sizeof (callsite_stats_t)); + csp->op = op; + csp->rank = rank; + for (i = 0; i < MPIP_CALLSITE_STACK_DEPTH; i++) + { + csp->pc[i] = pc[i]; + } + csp->cookie = MPIP_CALLSITE_STATS_COOKIE; + csp->cumulativeTime = 0; + csp->minDur = DBL_MAX; + csp->minDataSent = DBL_MAX; + csp->minIO = DBL_MAX; + csp->arbitraryMessageCount = 0; + h_insert (stat->task_callsite_stats, csp); + } + /* ASSUME: csp cannot be deleted from list */ + csp->count++; + csp->cumulativeTime += dur; + assert (csp->cumulativeTime >= 0); + csp->cumulativeTimeSquared += (dur * dur); + assert (csp->cumulativeTimeSquared >= 0); + csp->maxDur = max (csp->maxDur, dur); + csp->minDur = min (csp->minDur, dur); + csp->cumulativeDataSent += sendSize; + csp->cumulativeIO += ioSize; + csp->cumulativeRMA += rmaSize; + + csp->maxDataSent = max (csp->maxDataSent, sendSize); + csp->minDataSent = min (csp->minDataSent, sendSize); + + csp->maxIO = max (csp->maxIO, ioSize); + csp->minIO = min (csp->minIO, ioSize); + + csp->maxRMA = max (csp->maxRMA, rmaSize); + csp->minRMA = min (csp->minRMA, rmaSize); + + if (mpiPi.messageCountThreshold > -1 + && sendSize >= (double) mpiPi.messageCountThreshold) + csp->arbitraryMessageCount++; + +#if 0 + mpiPi_msg_debug ("mpiPi.messageCountThreshold is %d\n", + mpiPi.messageCountThreshold); + mpiPi_msg_debug ("sendSize is %f\n", sendSize); + mpiPi_msg_debug ("csp->arbitraryMessageCount is %lld\n", + csp->arbitraryMessageCount); +#endif + return; +} + +void mpiPi_stats_thr_cs_gather(mpiPi_thread_stat_t *stat, + int *ac, callsite_stats_t ***av ) +{ + h_gather_data (stat->task_callsite_stats, ac, (void ***)av); +} + +void mpiPi_stats_thr_cs_reset(mpiPi_thread_stat_t *stat) +{ + int ac, ndx; + callsite_stats_t **av; + callsite_stats_t *csp = NULL; + + /* gather local task data */ + mpiPi_stats_thr_cs_gather(stat, &ac, &av ); + + for (ndx = 0; ndx < ac; ndx++) + { + csp = av[ndx]; + + csp->maxDur = 0; + csp->minDur = DBL_MAX; + csp->maxIO = 0; + csp->minIO = DBL_MAX; + csp->maxDataSent = 0; + csp->minDataSent = DBL_MAX; + + csp->count = 0; + csp->cumulativeTime = 0; + csp->cumulativeTimeSquared = 0; + csp->cumulativeDataSent = 0; + csp->cumulativeIO = 0; + + csp->arbitraryMessageCount = 0; + } + free(av); + +} + +void mpiPi_stats_thr_cs_lookup(mpiPi_thread_stat_t *stat, + callsite_stats_t *task_stats, + callsite_stats_t **task_lookup, + callsite_stats_t *dummy_buf, + int initMax) +{ + callsite_stats_t *record = NULL; + if (NULL == h_search(stat->task_callsite_stats, + task_stats,(void **)&record)) + { + record = dummy_buf; + record->count = 0; + record->cumulativeTime = 0; + record->cumulativeTimeSquared = 0; + record->maxDur = 0; + if (initMax) { + record->minDur = DBL_MAX; + } else { + record->minDur = 0; + } + record->cumulativeDataSent = 0; + record->cumulativeIO = 0; + record->maxDataSent = 0; + if (initMax) { + record->minDataSent = DBL_MAX; + } else { + record->minDataSent = 0; + } + record->maxIO = 0; + if (initMax){ + record->minIO = DBL_MAX; + } else { + record->minIO = 0; + } + record->arbitraryMessageCount = 0; + record->rank = mpiPi.rank; + } + *task_lookup = record; +} + +/* Message size statistics */ +static void _gather_msize_stat(mpiPi_msg_stat_t *stat, + double **_outbuf) +{ + double *outbuf = malloc(sizeof(stat->time_stats)); + memcpy(outbuf, stat->time_stats, sizeof(stat->time_stats)); + *_outbuf = outbuf; +} + +static void _update_msize_stat (mpiPi_msg_stat_t *stat, + int op, double dur, double size, + MPI_Comm * comm, + char *dbg_prefix) +{ + int op_idx, comm_size, comm_bin, size_bin; + + PMPI_Comm_size (*comm, &comm_size); + + op_idx = op - mpiPi_BASE; + + comm_bin = get_histogram_bin (&stat->comm_hist, comm_size); + size_bin = get_histogram_bin (&stat->size_hist, size); + + mpiPi_msg_debug + ("Adding %.0f send size to entry %s[%d][%d][%d] value of %.0f\n", + size, dbg_prefix, + op_idx, comm_bin, size_bin, + stat->time_stats[op_idx][comm_bin][size_bin]); + + stat->time_stats[op_idx][comm_bin][size_bin] += size; +} + +static void _get_binstrings (mpiPi_msg_stat_t *stat, + int comm_idx, char *comm_buf, + int size_idx, char *size_buf) +{ + get_histogram_bin_str (&stat->comm_hist, comm_idx, comm_buf); + get_histogram_bin_str (&stat->size_hist, size_idx, size_buf); +} + + +/* Collectives msg size stat */ +void mpiPi_stats_thr_coll_upd (mpiPi_thread_stat_t *stat, + int op, double dur, double size, + MPI_Comm * comm) +{ + _update_msize_stat(&stat->coll, op, dur, size, comm, "collectives"); +} + +void mpiPi_stats_thr_coll_gather(mpiPi_thread_stat_t *stat, double **_outbuf) +{ + _gather_msize_stat(&stat->coll, _outbuf); +} + +void mpiPi_stats_thr_coll_binstrings(mpiPi_thread_stat_t *stat, + int comm_idx, char *comm_buf, + int size_idx, char *size_buf) +{ + _get_binstrings(&stat->coll, comm_idx, comm_buf, size_idx, size_buf); +} + + +/* Point-to-point statistics */ +void mpiPi_stats_thr_pt2pt_upd (mpiPi_thread_stat_t *stat, + int op, double dur, double size, + MPI_Comm * comm) +{ + _update_msize_stat(&stat->pt2pt, op, dur, size, comm, "point-to-point"); +} + +void mpiPi_stats_thr_pt2pt_gather(mpiPi_thread_stat_t *stat, double **_outbuf) +{ + _gather_msize_stat(&stat->pt2pt, _outbuf); +} + +void mpiPi_stats_thr_pt2pt_binstrings(mpiPi_thread_stat_t *stat, + int comm_idx, char *comm_buf, + int size_idx, char *size_buf) +{ + _get_binstrings(&stat->pt2pt, comm_idx, comm_buf, size_idx, size_buf); +} + diff --git a/mpiP-stats.h b/mpiP-stats.h index 8cc7993..1df14af 100644 --- a/mpiP-stats.h +++ b/mpiP-stats.h @@ -15,6 +15,111 @@ #ifndef _MPIP_STATS_H #define _MPIP_STATS_H +#include +#include +#include "mpiPconfig.h" +#include "mpiP-hash.h" +#include "mpiPi_def.h" + + +/* Histograms */ +typedef struct _mpiPi_histogram +{ + int first_bin_max; + int hist_size; + int *bin_intervals; +} mpiPi_histogram_t; + +/* Callsite statistics */ +typedef struct _callsite_stats +{ + unsigned op; + unsigned rank; + int csid; + long long count; + double cumulativeTime; + double cumulativeTimeSquared; + double maxDur; + double minDur; + double maxDataSent; + double minDataSent; + double maxIO; + double minIO; + double maxRMA; + double minRMA; + double cumulativeDataSent; + double cumulativeIO; + double cumulativeRMA; + long long arbitraryMessageCount; + double *siteData; + int siteDataIdx; + void *pc[MPIP_CALLSITE_STACK_DEPTH_MAX]; + char *filename[MPIP_CALLSITE_STACK_DEPTH_MAX]; + char *functname[MPIP_CALLSITE_STACK_DEPTH_MAX]; + int lineno[MPIP_CALLSITE_STACK_DEPTH_MAX]; + long cookie; +} callsite_stats_t; + +/* Message/Communicator statistics */ +#define MPIP_NFUNC (mpiPi_DEF_END - mpiPi_BASE) +#define MPIP_COMM_HISTCNT 32 +#define MPIP_SIZE_HISTCNT 32 +typedef struct { + /* Collectives statistics */ + mpiPi_histogram_t comm_hist; + mpiPi_histogram_t size_hist; + double time_stats[MPIP_NFUNC][MPIP_COMM_HISTCNT][MPIP_SIZE_HISTCNT]; +} mpiPi_msg_stat_t; + +/* Per-thread MPI status */ +typedef struct { + /* Avoid double-measurement when MPI functions are + * invoked internally e.g. in collectives + */ + int disabled; + + /* Callsite statistics */ + h_t *task_callsite_stats; + + mpiPi_msg_stat_t coll, pt2pt; +} mpiPi_thread_stat_t; + +int mpiPi_stats_thr_init(mpiPi_thread_stat_t *stat); +void mpiPi_stats_thr_fini(mpiPi_thread_stat_t *stat); +void mpiPi_stats_thr_cs_gather(mpiPi_thread_stat_t *stat, + int *ac, callsite_stats_t ***av ); +void mpiPi_stats_thr_cs_upd (mpiPi_thread_stat_t *stat, + unsigned op, unsigned rank, void **pc, + double dur, double sendSize, double ioSize, + double rmaSize); +#define MPIPI_CALLSITE_MIN2MAX 1 +#define MPIPI_CALLSITE_MIN2ZERO 0 +void mpiPi_stats_thr_cs_lookup(mpiPi_thread_stat_t *stat, + callsite_stats_t *task_stats, + callsite_stats_t **task_lookup, + callsite_stats_t *dummy_buf, + int initMax); + +void mpiPi_stats_thr_coll_upd (mpiPi_thread_stat_t *stat, + int op, double dur, double size, + MPI_Comm * comm); +void mpiPi_stats_thr_coll_gather(mpiPi_thread_stat_t *stat, double **_outbuf); +void mpiPi_stats_thr_cs_reset(mpiPi_thread_stat_t *stat); +void mpiPi_stats_thr_coll_binstrings(mpiPi_thread_stat_t *stat, + int comm_idx, char *comm_buf, + int size_idx, char *size_buf); + +void mpiPi_stats_thr_pt2pt_upd (mpiPi_thread_stat_t *stat, + int op, double dur, double size, + MPI_Comm * comm); +void mpiPi_stats_thr_pt2pt_gather(mpiPi_thread_stat_t *stat, double **_outbuf); +void mpiPi_stats_thr_pt2pt_binstrings(mpiPi_thread_stat_t *stat, + int comm_idx, char *comm_buf, + int size_idx, char *size_buf); + +int mpiPi_stats_thr_exit(mpiPi_thread_stat_t *stat); +int mpiPi_stats_thr_enter(mpiPi_thread_stat_t *stat); +int mpiPi_stats_thr_is_on(mpiPi_thread_stat_t *stat); #endif diff --git a/mpiPi.c b/mpiPi.c index 95509e9..41562e2 100644 --- a/mpiPi.c +++ b/mpiPi.c @@ -19,41 +19,7 @@ static char *svnid = "$Id$"; #include #include "mpiPi.h" -static int -mpiPi_callsite_stats_pc_hashkey (const void *p) -{ - int res = 0; - int i; - callsite_stats_t *csp = (callsite_stats_t *) p; - MPIP_CALLSITE_STATS_COOKIE_ASSERT (csp); - for (i = 0; i < MPIP_CALLSITE_STACK_DEPTH; i++) - { - res ^= (unsigned) (long) csp->pc[i]; - } - return 52271 ^ csp->op ^ res ^ csp->rank; -} - -static int -mpiPi_callsite_stats_pc_comparator (const void *p1, const void *p2) -{ - int i; - callsite_stats_t *csp_1 = (callsite_stats_t *) p1; - callsite_stats_t *csp_2 = (callsite_stats_t *) p2; - MPIP_CALLSITE_STATS_COOKIE_ASSERT (csp_1); - MPIP_CALLSITE_STATS_COOKIE_ASSERT (csp_2); - -#define express(f) {if ((csp_1->f) > (csp_2->f)) {return 1;} if ((csp_1->f) < (csp_2->f)) {return -1;}} - express (op); - express (rank); - - for (i = 0; i < MPIP_CALLSITE_STACK_DEPTH; i++) - { - express (pc[i]); - } -#undef express - return 0; -} static int mpiPi_callsite_stats_src_hashkey (const void *p) @@ -119,16 +85,6 @@ mpiPi_callsite_stats_src_id_comparator (const void *p1, const void *p2) - executed by each MPI task only once immediately after MPI_Init */ -void -init_histogram (mpiPi_histogram_t * h, int first_bin_max, int size, - int *intervals) -{ - h->first_bin_max = first_bin_max; - h->hist_size = size; - h->bin_intervals = intervals; -} - - void mpiPi_init (char *appName) { @@ -201,21 +157,7 @@ mpiPi_init (char *appName) #endif mpiPi_getenv (); - mpiPi.task_callsite_stats = - h_open (mpiPi.tableSize, mpiPi_callsite_stats_pc_hashkey, - mpiPi_callsite_stats_pc_comparator); - - if (mpiPi.do_collective_stats_report == 1) - { - init_histogram (&mpiPi.coll_comm_histogram, 7, 32, NULL); - init_histogram (&mpiPi.coll_size_histogram, 7, 32, NULL); - } - - if (mpiPi.do_pt2pt_stats_report == 1) - { - init_histogram (&mpiPi.pt2pt_comm_histogram, 7, 32, NULL); - init_histogram (&mpiPi.pt2pt_size_histogram, 7, 32, NULL); - } + mpiPi_stats_thr_init(&mpiPi.task_stats); /* -- welcome msg only collector */ if (mpiPi.collectorRank == mpiPi.rank) @@ -676,7 +618,7 @@ mpiPi_mergeResults () int retval = 1, sendval; /* gather local task data */ - h_gather_data (mpiPi.task_callsite_stats, &ac, (void ***) &av); + mpiPi_stats_thr_cs_gather(&mpiPi.task_stats, &ac, &av); /* determine size of space necessary on collector */ PMPI_Allreduce (&ac, &totalCount, 1, MPI_INT, MPI_SUM, mpiPi.comm); @@ -835,42 +777,34 @@ mpiPi_mergeResults () static int mpiPi_mergeCollectiveStats () { - int matrix_size; - int all_call_count; - double *coll_time_results, *coll_time_local; - int i, x, y, z; + double *coll_time_results = NULL, *coll_time_local = NULL; + size_t size; - if (mpiPi.do_collective_stats_report) + if (!mpiPi.do_collective_stats_report) { - all_call_count = mpiPi_DEF_END - mpiPi_BASE + 1; - matrix_size = - all_call_count * mpiPi.coll_comm_histogram.hist_size * - mpiPi.coll_size_histogram.hist_size; - mpiPi_msg_debug ("matrix_size is %d, histogram data is %d\n", - matrix_size, sizeof (mpiPi.coll_time_stats)); - coll_time_local = (double *) malloc (matrix_size * sizeof (double)); - coll_time_results = (double *) malloc (matrix_size * sizeof (double)); - - i = 0; - for (x = 0; x < mpiPi_DEF_END - mpiPi_BASE; x++) - for (y = 0; y < 32; y++) - for (z = 0; z < 32; z++) - coll_time_local[i++] = mpiPi.coll_time_stats[x][y][z]; + return 1; + } - /* Collect Collective statistic data were used */ - PMPI_Reduce (coll_time_local, coll_time_results, matrix_size, - MPI_DOUBLE, MPI_SUM, mpiPi.collectorRank, mpiPi.comm); + if (mpiPi.collectorRank == mpiPi.rank){ + coll_time_results = (double *) malloc (sizeof(mpiPi.coll_time_stats)); + } - i = 0; - for (x = 0; x < mpiPi_DEF_END - mpiPi_BASE; x++) - for (y = 0; y < 32; y++) - for (z = 0; z < 32; z++) - mpiPi.coll_time_stats[x][y][z] = coll_time_results[i++]; + mpiPi_stats_thr_coll_gather(&mpiPi.task_stats, &coll_time_local); + + /* Collect Collective statistic data were used */ + size = sizeof(mpiPi.pt2pt_send_stats) / sizeof(double); + PMPI_Reduce (coll_time_local, coll_time_results, + size, MPI_DOUBLE, MPI_SUM, mpiPi.collectorRank, mpiPi.comm); + free (coll_time_local); - free (coll_time_local); + if (mpiPi.collectorRank == mpiPi.rank){ + int i = 0, x, y, z; + for (x = 0; x < MPIP_NFUNC; x++) + for (y = 0; y < MPIP_COMM_HISTCNT; y++) + for (z = 0; z < MPIP_SIZE_HISTCNT; z++) + mpiPi.coll_time_stats[x][y][z] = coll_time_results[i++]; free (coll_time_results); } - return 1; } @@ -878,39 +812,34 @@ mpiPi_mergeCollectiveStats () static int mpiPi_mergept2ptStats () { - int matrix_size; - int all_call_count; - double *pt2pt_send_results, *pt2pt_send_local; - int i, x, y, z; + double *pt2pt_send_results = NULL, *pt2pt_send_local = NULL; + size_t size; + if (mpiPi.do_pt2pt_stats_report) { - all_call_count = mpiPi_DEF_END - mpiPi_BASE + 1; - matrix_size = - all_call_count * mpiPi.pt2pt_comm_histogram.hist_size * - mpiPi.pt2pt_size_histogram.hist_size; - mpiPi_msg_debug ("matrix_size is %d, histogram data is %d\n", - matrix_size, sizeof (mpiPi.pt2pt_send_stats)); - pt2pt_send_local = (double *) malloc (matrix_size * sizeof (double)); - pt2pt_send_results = (double *) malloc (matrix_size * sizeof (double)); - - i = 0; - for (x = 0; x < mpiPi_DEF_END - mpiPi_BASE; x++) - for (y = 0; y < 32; y++) - for (z = 0; z < 32; z++) - pt2pt_send_local[i++] = mpiPi.pt2pt_send_stats[x][y][z]; + return 1; + } - /* Collect Collective statistic data were used */ - PMPI_Reduce (pt2pt_send_local, pt2pt_send_results, matrix_size, - MPI_DOUBLE, MPI_SUM, mpiPi.collectorRank, mpiPi.comm); + if (mpiPi.collectorRank == mpiPi.rank){ + pt2pt_send_results = (double *) malloc (sizeof(mpiPi.pt2pt_send_stats)); + } + mpiPi_stats_thr_pt2pt_gather(&mpiPi.task_stats, &pt2pt_send_local); + + /* Collect Collective statistic data were used */ + size = sizeof(mpiPi.pt2pt_send_stats) / sizeof(double); + PMPI_Reduce (pt2pt_send_local, pt2pt_send_results, + size, MPI_DOUBLE, MPI_SUM, mpiPi.collectorRank, mpiPi.comm); + free(pt2pt_send_local); - i = 0; + if (mpiPi.collectorRank == mpiPi.rank) + { + int i = 0, x, y, z; for (x = 0; x < mpiPi_DEF_END - mpiPi_BASE; x++) for (y = 0; y < 32; y++) for (z = 0; z < 32; z++) mpiPi.pt2pt_send_stats[x][y][z] = pt2pt_send_results[i++]; - free (pt2pt_send_local); free (pt2pt_send_results); } @@ -1117,8 +1046,7 @@ mpiPi_finalize () if (mpiPi.disable_finalize_report == 0) mpiPi_generateReport (mpiPi.report_style); - /* clean up data structures, etc */ - h_close (mpiPi.task_callsite_stats); + mpiPi_stats_thr_fini(&mpiPi.task_stats); if (mpiPi.global_task_app_time != NULL) free (mpiPi.global_task_app_time); @@ -1153,144 +1081,26 @@ mpiPi_update_callsite_stats (unsigned op, unsigned rank, void **pc, callsite_stats_t *csp = NULL; callsite_stats_t key; - if (!mpiPi.enabled) + if (!mpiPi_stats_thr_is_on(&mpiPi.task_stats)) return; - assert (mpiPi.task_callsite_stats != NULL); - assert (dur >= 0); - - - key.op = op; - key.rank = rank; - key.cookie = MPIP_CALLSITE_STATS_COOKIE; - for (i = 0; i < MPIP_CALLSITE_STACK_DEPTH; i++) - { - key.pc[i] = pc[i]; - } - - if (NULL == h_search (mpiPi.task_callsite_stats, &key, (void **) &csp)) - { - /* create and insert */ - csp = (callsite_stats_t *) malloc (sizeof (callsite_stats_t)); - bzero (csp, sizeof (callsite_stats_t)); - csp->op = op; - csp->rank = rank; - for (i = 0; i < MPIP_CALLSITE_STACK_DEPTH; i++) - { - csp->pc[i] = pc[i]; - } - csp->cookie = MPIP_CALLSITE_STATS_COOKIE; - csp->cumulativeTime = 0; - csp->minDur = DBL_MAX; - csp->minDataSent = DBL_MAX; - csp->minIO = DBL_MAX; - csp->arbitraryMessageCount = 0; - h_insert (mpiPi.task_callsite_stats, csp); - } - /* ASSUME: csp cannot be deleted from list */ - csp->count++; - csp->cumulativeTime += dur; - assert (csp->cumulativeTime >= 0); - csp->cumulativeTimeSquared += (dur * dur); - assert (csp->cumulativeTimeSquared >= 0); - csp->maxDur = max (csp->maxDur, dur); - csp->minDur = min (csp->minDur, dur); - csp->cumulativeDataSent += sendSize; - csp->cumulativeIO += ioSize; - csp->cumulativeRMA += rmaSize; - - csp->maxDataSent = max (csp->maxDataSent, sendSize); - csp->minDataSent = min (csp->minDataSent, sendSize); - - csp->maxIO = max (csp->maxIO, ioSize); - csp->minIO = min (csp->minIO, ioSize); - - csp->maxRMA = max (csp->maxRMA, rmaSize); - csp->minRMA = min (csp->minRMA, rmaSize); - - if (mpiPi.messageCountThreshold > -1 - && sendSize >= (double) mpiPi.messageCountThreshold) - csp->arbitraryMessageCount++; - -#if 0 - mpiPi_msg_debug ("mpiPi.messageCountThreshold is %d\n", - mpiPi.messageCountThreshold); - mpiPi_msg_debug ("sendSize is %f\n", sendSize); - mpiPi_msg_debug ("csp->arbitraryMessageCount is %lld\n", - csp->arbitraryMessageCount); -#endif - - return; -} - - -static int -get_histogram_bin (mpiPi_histogram_t * h, int val) -{ - int wv = val; - int bin; - - bin = 0; - - if (h->bin_intervals == NULL) - { - while (wv > h->first_bin_max && bin < h->hist_size) - { - wv >>= 1; - bin++; - } - } - else /* Add code for custom intervals later */ - { - } - - return bin; + mpiPi_stats_thr_cs_upd(&mpiPi.task_stats, op, rank, pc, dur, + sendSize, ioSize, rmaSize); } - void mpiPi_update_collective_stats (int op, double dur, double size, MPI_Comm * comm) { - int op_idx, comm_size, comm_bin, size_bin; - - PMPI_Comm_size (*comm, &comm_size); - - op_idx = op - mpiPi_BASE; - - comm_bin = get_histogram_bin (&mpiPi.coll_comm_histogram, comm_size); - size_bin = get_histogram_bin (&mpiPi.coll_size_histogram, size); - - mpiPi_msg_debug - ("Adding %.0f time to entry mpiPi.collective_stats[%d][%d][%d] value of %.0f\n", - dur, op_idx, comm_bin, size_bin, - mpiPi.coll_time_stats[op_idx][comm_bin][size_bin]); - - mpiPi.coll_time_stats[op_idx][comm_bin][size_bin] += dur; + mpiPi_stats_thr_coll_upd(&mpiPi.task_stats, op, dur, size, comm); } - void mpiPi_update_pt2pt_stats (int op, double dur, double size, MPI_Comm * comm) { - int op_idx, comm_size, comm_bin, size_bin; - - PMPI_Comm_size (*comm, &comm_size); - - op_idx = op - mpiPi_BASE; - - comm_bin = get_histogram_bin (&mpiPi.pt2pt_comm_histogram, comm_size); - size_bin = get_histogram_bin (&mpiPi.pt2pt_size_histogram, size); - - mpiPi_msg_debug - ("Adding %.0f send size to entry mpiPi.pt2pt_stats[%d][%d][%d] value of %.0f\n", - size, op_idx, comm_bin, size_bin, - mpiPi.pt2pt_send_stats[op_idx][comm_bin][size_bin]); - - mpiPi.pt2pt_send_stats[op_idx][comm_bin][size_bin] += size; + mpiPi_stats_thr_pt2pt_upd(&mpiPi.task_stats, op, dur, size, comm); } - #endif /* } ifndef ENABLE_API_ONLY */ diff --git a/mpiPi.h b/mpiPi.h index 88792d7..7677f57 100644 --- a/mpiPi.h +++ b/mpiPi.h @@ -38,6 +38,7 @@ #endif #include "mpiP-hash.h" +#include "mpiP-stats.h" #include "mpip_timers.h" @@ -62,36 +63,6 @@ typedef char mpip_const_char_t; typedef char mpiPi_hostname_t[MPIPI_HOSTNAME_LEN_MAX]; -typedef struct _callsite_stats -{ - unsigned op; - unsigned rank; - int csid; - long long count; - double cumulativeTime; - double cumulativeTimeSquared; - double maxDur; - double minDur; - double maxDataSent; - double minDataSent; - double maxIO; - double minIO; - double maxRMA; - double minRMA; - double cumulativeDataSent; - double cumulativeIO; - double cumulativeRMA; - long long arbitraryMessageCount; - double *siteData; - int siteDataIdx; - void *pc[MPIP_CALLSITE_STACK_DEPTH_MAX]; - char *filename[MPIP_CALLSITE_STACK_DEPTH_MAX]; - char *functname[MPIP_CALLSITE_STACK_DEPTH_MAX]; - int lineno[MPIP_CALLSITE_STACK_DEPTH_MAX]; - long cookie; -} -callsite_stats_t; - typedef struct callsite_src_id_cache_entry_t { int id; /* unique id for this src code/stack location */ @@ -149,14 +120,6 @@ typedef struct SO_INFO } so_info_t; #endif -typedef struct _mpiPi_histogram -{ - int first_bin_max; - int hist_size; - int *bin_intervals; -} mpiPi_histogram_t; - - typedef struct _mpiPi_t { int ac; @@ -204,12 +167,13 @@ typedef struct _mpiPi_t long long global_time_callsite_count; int tableSize; - h_t *task_callsite_stats; callsite_stats_t *rawCallsiteData; h_t *global_callsite_stats; h_t *global_callsite_stats_agg; h_t *global_MPI_stats_agg; + mpiPi_thread_stat_t task_stats; + mpiPi_lookup_t *lookup; int stackDepth; @@ -234,15 +198,9 @@ typedef struct _mpiPi_t int disable_finalize_report; int do_collective_stats_report; - mpiPi_histogram_t coll_comm_histogram; - mpiPi_histogram_t coll_size_histogram; - double coll_time_stats[(mpiPi_DEF_END - mpiPi_BASE)][32][32]; - + double coll_time_stats[MPIP_NFUNC][MPIP_COMM_HISTCNT][MPIP_SIZE_HISTCNT]; int do_pt2pt_stats_report; - mpiPi_histogram_t pt2pt_comm_histogram; - mpiPi_histogram_t pt2pt_size_histogram; - double pt2pt_send_stats[(mpiPi_DEF_END - mpiPi_BASE)][32][32]; - + double pt2pt_send_stats[MPIP_NFUNC][MPIP_COMM_HISTCNT][MPIP_SIZE_HISTCNT]; } mpiPi_t; diff --git a/pcontrol.c b/pcontrol.c index 17c41e9..4fba789 100644 --- a/pcontrol.c +++ b/pcontrol.c @@ -24,32 +24,7 @@ static char *svnid = "$Id$"; void mpiPi_reset_callsite_data () { - int ac, ndx; - callsite_stats_t **av; - callsite_stats_t *csp = NULL; - - /* gather local task data */ - h_gather_data (mpiPi.task_callsite_stats, &ac, (void ***) &av); - - for (ndx = 0; ndx < ac; ndx++) - { - csp = av[ndx]; - - csp->maxDur = 0; - csp->minDur = DBL_MAX; - csp->maxIO = 0; - csp->minIO = DBL_MAX; - csp->maxDataSent = 0; - csp->minDataSent = DBL_MAX; - - csp->count = 0; - csp->cumulativeTime = 0; - csp->cumulativeTimeSquared = 0; - csp->cumulativeDataSent = 0; - csp->cumulativeIO = 0; - - csp->arbitraryMessageCount = 0; - } + mpiPi_stats_thr_cs_reset(&mpiPi.task_stats); if (time (&mpiPi.start_timeofday) == (time_t) - 1) { @@ -67,8 +42,6 @@ mpiPi_reset_callsite_data () mpiPi.global_mpi_msize_threshold_count = 0; mpiPi.global_mpi_sent_count = 0; mpiPi.global_time_callsite_count = 0; - - free (av); } diff --git a/report.c b/report.c index 045f100..ed5c244 100644 --- a/report.c +++ b/report.c @@ -749,50 +749,26 @@ mpiPi_print_top_sent_sites (FILE * fp) } } -void -get_histogram_bin_str (mpiPi_histogram_t * h, int v, char *s) -{ - int min = 0, max = 0; - - if (v == 0) - { - min = 0; - max = h->first_bin_max; - } - else - { - min = h->first_bin_max + 1; - min <<= (v - 1); - max = (min << 1) - 1; - } - - sprintf (s, "%8d - %8d", min, max); -} - - static void mpiPi_print_top_collective_sent_sites (FILE * fp) { int result_count, j, i; double **result_ptrs; int x, y, z; - int all_call_count, matrix_size; + int matrix_size; char commbinbuf[32]; char databinbuf[32]; mpiPi_msg_debug ("In mpiPi_print_top_collective_sent_sites\n"); - all_call_count = mpiPi_DEF_END - mpiPi_BASE; - matrix_size = - all_call_count * mpiPi.coll_comm_histogram.hist_size * - mpiPi.coll_size_histogram.hist_size; + matrix_size = MPIP_NFUNC * MPIP_COMM_HISTCNT * MPIP_SIZE_HISTCNT; result_ptrs = (double **) malloc (sizeof (double *) * matrix_size); result_count = 0; - for (x = 0; x < all_call_count; x++) - for (y = 0; y < mpiPi.coll_comm_histogram.hist_size; y++) - for (z = 0; z < mpiPi.coll_size_histogram.hist_size; z++) + for (x = 0; x < MPIP_NFUNC; x++) + for (y = 0; y < MPIP_COMM_HISTCNT; y++) + for (z = 0; z < MPIP_SIZE_HISTCNT; z++) { if (mpiPi.coll_time_stats[x][y][z] > 0) { @@ -825,9 +801,9 @@ mpiPi_print_top_collective_sent_sites (FILE * fp) for (i = 0; (i < 20) && (i < result_count); i++) { /* Find location in matrix */ - for (x = 0; x < all_call_count; x++) - for (y = 0; y < mpiPi.coll_comm_histogram.hist_size; y++) - for (z = 0; z < mpiPi.coll_size_histogram.hist_size; z++) + for (x = 0; x < MPIP_NFUNC; x++) + for (y = 0; y < MPIP_COMM_HISTCNT; y++) + for (z = 0; z < MPIP_COMM_HISTCNT; z++) { if (&mpiPi.coll_time_stats[x][y][z] == result_ptrs[j]) { @@ -840,8 +816,8 @@ mpiPi_print_top_collective_sent_sites (FILE * fp) if (mpiPi.coll_time_stats[x][y][z] == 0) goto done; - get_histogram_bin_str (&mpiPi.coll_comm_histogram, y, commbinbuf); - get_histogram_bin_str (&mpiPi.coll_size_histogram, z, databinbuf); + mpiPi_stats_thr_coll_binstrings(&mpiPi.task_stats, y, commbinbuf, + z, databinbuf); fprintf (fp, mpiP_Report_Formats[MPIP_HISTOGRAM_FMT] @@ -864,23 +840,19 @@ mpiPi_print_top_pt2pt_sent_sites (FILE * fp) int result_count, j, i; double **result_ptrs; int x, y, z; - int all_call_count, matrix_size; + int matrix_size; char commbinbuf[32]; char databinbuf[32]; mpiPi_msg_debug ("In mpiPi_print_top_pt2pt_sent_sites\n"); - all_call_count = mpiPi_DEF_END - mpiPi_BASE; - matrix_size = - all_call_count * mpiPi.pt2pt_comm_histogram.hist_size * - mpiPi.pt2pt_size_histogram.hist_size; - + matrix_size = MPIP_NFUNC * MPIP_COMM_HISTCNT * MPIP_SIZE_HISTCNT; result_ptrs = (double **) malloc (sizeof (double *) * matrix_size); result_count = 0; - for (x = 0; x < all_call_count; x++) - for (y = 0; y < mpiPi.pt2pt_comm_histogram.hist_size; y++) - for (z = 0; z < mpiPi.pt2pt_size_histogram.hist_size; z++) + for (x = 0; x < MPIP_NFUNC; x++) + for (y = 0; y < MPIP_COMM_HISTCNT; y++) + for (z = 0; z < MPIP_SIZE_HISTCNT; z++) { if (mpiPi.pt2pt_send_stats[x][y][z] > 0) { @@ -913,9 +885,9 @@ mpiPi_print_top_pt2pt_sent_sites (FILE * fp) for (i = 0; (i < 20) && (i < result_count); i++) { /* Find location in matrix */ - for (x = 0; x < all_call_count; x++) - for (y = 0; y < mpiPi.pt2pt_comm_histogram.hist_size; y++) - for (z = 0; z < mpiPi.pt2pt_size_histogram.hist_size; z++) + for (x = 0; x < MPIP_NFUNC; x++) + for (y = 0; y < MPIP_COMM_HISTCNT; y++) + for (z = 0; z < MPIP_SIZE_HISTCNT; z++) { if (&mpiPi.pt2pt_send_stats[x][y][z] == result_ptrs[j]) { @@ -928,8 +900,9 @@ mpiPi_print_top_pt2pt_sent_sites (FILE * fp) if (mpiPi.pt2pt_send_stats[x][y][z] == 0) goto done; - get_histogram_bin_str (&mpiPi.pt2pt_comm_histogram, y, commbinbuf); - get_histogram_bin_str (&mpiPi.pt2pt_size_histogram, z, databinbuf); + mpiPi_stats_thr_pt2pt_binstrings(&mpiPi.task_stats, + y, commbinbuf, + z, databinbuf); fprintf (fp, mpiP_Report_Formats[MPIP_HISTOGRAM_FMT] @@ -1962,25 +1935,9 @@ mpiPi_coll_print_all_callsite_time_info (FILE * fp) task_stats->rank = mpiPi.rank; - if (h_search - (mpiPi.task_callsite_stats, task_stats, - (void **) &task_lookup) == NULL) - { - task_lookup = &cs_buf; - task_lookup->count = 0; - task_lookup->cumulativeTime = 0; - task_lookup->cumulativeTimeSquared = 0; - task_lookup->maxDur = 0; - task_lookup->minDur = 0; - task_lookup->cumulativeDataSent = 0; - task_lookup->cumulativeIO = 0; - task_lookup->maxDataSent = 0; - task_lookup->minDataSent = 0; - task_lookup->maxIO = 0; - task_lookup->minIO = 0; - task_lookup->arbitraryMessageCount = 0; - task_lookup->rank = mpiPi.rank; - } + mpiPi_stats_thr_cs_lookup(&mpiPi.task_stats, + task_stats, &task_lookup, &cs_buf, + MPIPI_CALLSITE_MIN2ZERO); PMPI_Gather (task_lookup, sizeof (callsite_stats_t), MPI_CHAR, task_data, @@ -2100,25 +2057,9 @@ mpiPi_coll_print_concise_callsite_time_info (FILE * fp) /* Search for task local entry for the current call site */ task_stats->rank = mpiPi.rank; - if (h_search - (mpiPi.task_callsite_stats, task_stats, - (void **) &task_lookup) == NULL) - { - task_lookup = &cs_buf; - task_lookup->count = 0; - task_lookup->cumulativeTime = 0; - task_lookup->cumulativeTimeSquared = 0; - task_lookup->maxDur = 0; - task_lookup->minDur = DBL_MAX; - task_lookup->cumulativeDataSent = 0; - task_lookup->cumulativeIO = 0; - task_lookup->maxDataSent = 0; - task_lookup->minDataSent = DBL_MAX; - task_lookup->maxIO = 0; - task_lookup->minIO = DBL_MAX; - task_lookup->arbitraryMessageCount = 0; - task_lookup->rank = mpiPi.rank; - } + mpiPi_stats_thr_cs_lookup(&mpiPi.task_stats, + task_stats, &task_lookup, &cs_buf, + MPIPI_CALLSITE_MIN2MAX); tot_tasks = 0; task_flag = task_lookup->count > 0 ? 1 : 0; @@ -2229,27 +2170,11 @@ mpiPi_coll_print_concise_callsite_sent_info (FILE * fp) MPI_CHAR, mpiPi.collectorRank, mpiPi.comm); - /* Search for task local entry for the current call site */ task_stats->rank = mpiPi.rank; - if (h_search - (mpiPi.task_callsite_stats, task_stats, - (void **) &task_lookup) == NULL) - { - task_lookup = &cs_buf; - task_lookup->count = 0; - task_lookup->cumulativeTime = 0; - task_lookup->cumulativeTimeSquared = 0; - task_lookup->maxDur = 0; - task_lookup->minDur = DBL_MAX; - task_lookup->cumulativeDataSent = 0; - task_lookup->cumulativeIO = 0; - task_lookup->maxDataSent = 0; - task_lookup->minDataSent = DBL_MAX; - task_lookup->maxIO = 0; - task_lookup->minIO = DBL_MAX; - task_lookup->arbitraryMessageCount = 0; - task_lookup->rank = mpiPi.rank; - } + /* Search for task local entry for the current call site */ + mpiPi_stats_thr_cs_lookup(&mpiPi.task_stats, + task_stats, &task_lookup, &cs_buf, + MPIPI_CALLSITE_MIN2MAX); tot_tasks = 0; task_flag = task_lookup->cumulativeDataSent > 0 ? 1 : 0; @@ -2367,25 +2292,9 @@ mpiPi_coll_print_concise_callsite_io_info (FILE * fp) /* Search for task local entry for the current call site */ task_stats->rank = mpiPi.rank; - if (h_search - (mpiPi.task_callsite_stats, task_stats, - (void **) &task_lookup) == NULL) - { - task_lookup = &cs_buf; - task_lookup->count = 0; - task_lookup->cumulativeTime = 0; - task_lookup->cumulativeTimeSquared = 0; - task_lookup->maxDur = 0; - task_lookup->minDur = DBL_MAX; - task_lookup->cumulativeDataSent = 0; - task_lookup->cumulativeIO = 0; - task_lookup->maxDataSent = 0; - task_lookup->minDataSent = DBL_MAX; - task_lookup->maxIO = 0; - task_lookup->minIO = DBL_MAX; - task_lookup->arbitraryMessageCount = 0; - task_lookup->rank = mpiPi.rank; - } + mpiPi_stats_thr_cs_lookup(&mpiPi.task_stats, + task_stats, &task_lookup, &cs_buf, + MPIPI_CALLSITE_MIN2MAX); tot_tasks = 0; task_flag = task_lookup->cumulativeIO > 0 ? 1 : 0; @@ -2497,26 +2406,10 @@ mpiPi_coll_print_concise_callsite_rma_info (FILE * fp) /* Search for task local entry for the current call site */ task_stats->rank = mpiPi.rank; - if (h_search - (mpiPi.task_callsite_stats, task_stats, - (void **) &task_lookup) == NULL) - { - task_lookup = &cs_buf; - task_lookup->count = 0; - task_lookup->cumulativeTime = 0; - task_lookup->cumulativeTimeSquared = 0; - task_lookup->maxDur = 0; - task_lookup->minDur = DBL_MAX; - task_lookup->cumulativeDataSent = 0; - task_lookup->cumulativeIO = 0; - task_lookup->cumulativeRMA = 0; - task_lookup->maxDataSent = 0; - task_lookup->minDataSent = DBL_MAX; - task_lookup->maxIO = 0; - task_lookup->minIO = DBL_MAX; - task_lookup->arbitraryMessageCount = 0; - task_lookup->rank = mpiPi.rank; - } + mpiPi_stats_thr_cs_lookup(&mpiPi.task_stats, + task_stats, &task_lookup, &cs_buf, + MPIPI_CALLSITE_MIN2MAX); + tot_tasks = 0; task_flag = task_lookup->cumulativeRMA > 0 ? 1 : 0; @@ -2638,26 +2531,9 @@ mpiPi_coll_print_all_callsite_sent_info (FILE * fp) MPI_CHAR, mpiPi.collectorRank, mpiPi.comm); task_stats->rank = mpiPi.rank; - - if (h_search - (mpiPi.task_callsite_stats, task_stats, - (void **) &task_lookup) == NULL) - { - task_lookup = &cs_buf; - task_lookup->count = 0; - task_lookup->cumulativeTime = 0; - task_lookup->cumulativeTimeSquared = 0; - task_lookup->maxDur = 0; - task_lookup->minDur = 0; - task_lookup->cumulativeDataSent = 0; - task_lookup->cumulativeIO = 0; - task_lookup->maxDataSent = 0; - task_lookup->minDataSent = 0; - task_lookup->maxIO = 0; - task_lookup->minIO = 0; - task_lookup->arbitraryMessageCount = 0; - task_lookup->op = 0; - } + mpiPi_stats_thr_cs_lookup(&mpiPi.task_stats, + task_stats, &task_lookup, &cs_buf, + MPIPI_CALLSITE_MIN2ZERO); PMPI_Gather (task_lookup, sizeof (callsite_stats_t), MPI_CHAR, task_data, @@ -2794,25 +2670,9 @@ mpiPi_coll_print_all_callsite_io_info (FILE * fp) MPI_CHAR, mpiPi.collectorRank, mpiPi.comm); task_stats->rank = mpiPi.rank; - - if (h_search - (mpiPi.task_callsite_stats, task_stats, - (void **) &task_lookup) == NULL) - { - task_lookup = &cs_buf; - task_lookup->count = 0; - task_lookup->cumulativeTime = 0; - task_lookup->cumulativeTimeSquared = 0; - task_lookup->maxDur = 0; - task_lookup->minDur = 0; - task_lookup->cumulativeDataSent = 0; - task_lookup->cumulativeIO = 0; - task_lookup->maxDataSent = 0; - task_lookup->minDataSent = 0; - task_lookup->maxIO = 0; - task_lookup->minIO = 0; - task_lookup->arbitraryMessageCount = 0; - } + mpiPi_stats_thr_cs_lookup(&mpiPi.task_stats, + task_stats, &task_lookup, &cs_buf, + MPIPI_CALLSITE_MIN2ZERO); PMPI_Gather (task_lookup, sizeof (callsite_stats_t), MPI_CHAR, task_data, @@ -2945,26 +2805,9 @@ mpiPi_coll_print_all_callsite_rma_info (FILE * fp) MPI_CHAR, mpiPi.collectorRank, mpiPi.comm); task_stats->rank = mpiPi.rank; - - if (h_search - (mpiPi.task_callsite_stats, task_stats, - (void **) &task_lookup) == NULL) - { - task_lookup = &cs_buf; - task_lookup->count = 0; - task_lookup->cumulativeTime = 0; - task_lookup->cumulativeTimeSquared = 0; - task_lookup->maxDur = 0; - task_lookup->minDur = 0; - task_lookup->cumulativeDataSent = 0; - task_lookup->cumulativeIO = 0; - task_lookup->cumulativeRMA = 0; - task_lookup->maxDataSent = 0; - task_lookup->minDataSent = 0; - task_lookup->maxIO = 0; - task_lookup->minIO = 0; - task_lookup->arbitraryMessageCount = 0; - } + mpiPi_stats_thr_cs_lookup(&mpiPi.task_stats, + task_stats, &task_lookup, &cs_buf, + MPIPI_CALLSITE_MIN2ZERO); PMPI_Gather (task_lookup, sizeof (callsite_stats_t), MPI_CHAR, task_data, From 720702cbc03ff2972ea59bd69a1a5f8b32ae32d1 Mon Sep 17 00:00:00 2001 From: Artem Polyakov Date: Wed, 12 Jun 2019 17:18:57 -0700 Subject: [PATCH 5/5] Refactor global state: remove unneeded component Signed-off-by: Artem Polyakov --- mpiPi.c | 46 +++++++++++++++++++++++++--------------------- mpiPi.h | 1 - 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/mpiPi.c b/mpiPi.c index 41562e2..3d1356c 100644 --- a/mpiPi.c +++ b/mpiPi.c @@ -616,6 +616,7 @@ mpiPi_mergeResults () int totalCount = 0; int maxCount = 0; int retval = 1, sendval; + callsite_stats_t *rawCallsiteData = NULL; /* gather local task data */ mpiPi_stats_thr_cs_gather(&mpiPi.task_stats, &ac, &av); @@ -624,6 +625,9 @@ mpiPi_mergeResults () PMPI_Allreduce (&ac, &totalCount, 1, MPI_INT, MPI_SUM, mpiPi.comm); PMPI_Reduce (&ac, &maxCount, 1, MPI_INT, MPI_MAX, mpiPi.collectorRank, mpiPi.comm); + if (mpiPi.collectorRank != mpiPi.rank) { + maxCount = ac; + } if (totalCount < 1) { @@ -634,6 +638,16 @@ mpiPi_mergeResults () return 0; } + /* Try to allocate space for max count of callsite info from all tasks */ + rawCallsiteData = + (callsite_stats_t *) calloc (maxCount, sizeof (callsite_stats_t)); + if (rawCallsiteData == NULL) + { + mpiPi_msg_warn + ("Failed to allocate memory to collect callsite info"); + retval = 0; + } + /* gather global data at collector */ if (mpiPi.rank == mpiPi.collectorRank) { @@ -681,15 +695,6 @@ mpiPi_mergeResults () callsite_src_id_cache_hashkey, callsite_src_id_cache_comparator); } - /* Try to allocate space for max count of callsite info from all tasks */ - mpiPi.rawCallsiteData = - (callsite_stats_t *) calloc (maxCount, sizeof (callsite_stats_t)); - if (mpiPi.rawCallsiteData == NULL) - { - mpiPi_msg_warn - ("Failed to allocate memory to collect callsite info"); - retval = 0; - } /* Clear global_mpi_time and global_mpi_size before accumulation in mpiPi_insert_callsite_records */ mpiPi.global_mpi_time = 0.0; @@ -697,48 +702,47 @@ mpiPi_mergeResults () if (retval == 1) { - /* Insert collector callsite data into global and task-specific hash tables */ + /* Insert local callsite information */ for (ndx = 0; ndx < ac; ndx++) { mpiPi_insert_callsite_records (av[ndx]); } - ndx = 0; + + /* Collect remote pc data */ for (i = 1; i < mpiPi.size; i++) /* n-1 */ { MPI_Status status; int count; - int j; /* okay in any order */ PMPI_Probe (MPI_ANY_SOURCE, mpiPi.tag, mpiPi.comm, &status); PMPI_Get_count (&status, MPI_CHAR, &count); - PMPI_Recv (&(mpiPi.rawCallsiteData[ndx]), count, MPI_CHAR, + PMPI_Recv (rawCallsiteData, count, MPI_CHAR, status.MPI_SOURCE, mpiPi.tag, mpiPi.comm, &status); count /= sizeof (callsite_stats_t); - - for (j = 0; j < count; j++) + for (ndx = 0; ndx < count; ndx++) { - mpiPi_insert_callsite_records (&(mpiPi.rawCallsiteData[j])); + mpiPi_insert_callsite_records (&rawCallsiteData[ndx]); } } - free (mpiPi.rawCallsiteData); } } else { int ndx; - char *sbuf = (char *) malloc (ac * sizeof (callsite_stats_t)); for (ndx = 0; ndx < ac; ndx++) { bcopy (av[ndx], - &(sbuf[ndx * sizeof (callsite_stats_t)]), + &(rawCallsiteData[ndx]), sizeof (callsite_stats_t)); } - PMPI_Send (sbuf, ac * sizeof (callsite_stats_t), + PMPI_Send (rawCallsiteData, ac * sizeof (callsite_stats_t), MPI_CHAR, mpiPi.collectorRank, mpiPi.tag, mpiPi.comm); - free (sbuf); } + + free (rawCallsiteData); + if (mpiPi.rank == mpiPi.collectorRank && retval == 1) { if (mpiPi.collective_report == 0) diff --git a/mpiPi.h b/mpiPi.h index 7677f57..14aad9f 100644 --- a/mpiPi.h +++ b/mpiPi.h @@ -167,7 +167,6 @@ typedef struct _mpiPi_t long long global_time_callsite_count; int tableSize; - callsite_stats_t *rawCallsiteData; h_t *global_callsite_stats; h_t *global_callsite_stats_agg; h_t *global_MPI_stats_agg;