Commit 1a362ac0 authored by Shane Snyder's avatar Shane Snyder
Browse files

Merge branch 'hxhim-module' into 'master'

Hxhim module

See merge request !23
parents 2c40940f e8b628a9
...@@ -119,6 +119,7 @@ struct darshan_base_record ...@@ -119,6 +119,7 @@ struct darshan_base_record
#include "darshan-stdio-log-format.h" #include "darshan-stdio-log-format.h"
/* DXT */ /* DXT */
#include "darshan-dxt-log-format.h" #include "darshan-dxt-log-format.h"
#include "darshan-mdhim-log-format.h"
/* X-macro for keeping module ordering consistent */ /* X-macro for keeping module ordering consistent */
/* NOTE: first val used to define module enum values, /* NOTE: first val used to define module enum values,
...@@ -141,7 +142,9 @@ struct darshan_base_record ...@@ -141,7 +142,9 @@ struct darshan_base_record
X(DARSHAN_STDIO_MOD, "STDIO", DARSHAN_STDIO_VER, &stdio_logutils) \ X(DARSHAN_STDIO_MOD, "STDIO", DARSHAN_STDIO_VER, &stdio_logutils) \
/* DXT */ \ /* DXT */ \
X(DXT_POSIX_MOD, "DXT_POSIX", DXT_POSIX_VER, &dxt_posix_logutils) \ X(DXT_POSIX_MOD, "DXT_POSIX", DXT_POSIX_VER, &dxt_posix_logutils) \
X(DXT_MPIIO_MOD, "DXT_MPIIO", DXT_MPIIO_VER, &dxt_mpiio_logutils) X(DXT_MPIIO_MOD, "DXT_MPIIO", DXT_MPIIO_VER, &dxt_mpiio_logutils) \
X(DARSHAN_MDHIM_MOD, "MDHIM", DARSHAN_MDHIM_VER, &mdhim_logutils)
/* unique identifiers to distinguish between available darshan modules */ /* unique identifiers to distinguish between available darshan modules */
/* NOTES: - valid ids range from [0...DARSHAN_MAX_MODS-1] /* NOTES: - valid ids range from [0...DARSHAN_MAX_MODS-1]
......
/*
* Copyright (C) 2015 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*
*/
#ifndef __DARSHAN_MDHIM_LOG_FORMAT_H
#define __DARSHAN_MDHIM_LOG_FORMAT_H
/* current log format version, to support backwards compatibility */
#define DARSHAN_MDHIM_VER 1
#define MDHIM_COUNTERS \
/* number of 'put' function calls */\
X(MDHIM_PUTS) \
/* larget payload for a 'put' */ \
X(MDHIM_GETS) \
/* largest get */ \
X(MDHIM_PUT_MAX_SIZE)\
/* number of 'get' function calls */\
X(MDHIM_GET_MAX_SIZE) \
/* how many servers? */ \
X(MDHIM_SERVERS) \
/* end of counters */ \
X(MDHIM_NUM_INDICES)
#define MDHIM_F_COUNTERS \
/* timestamp of the first call to a 'put' function */\
X(MDHIM_F_PUT_TIMESTAMP) \
X(MDHIM_F_GET_TIMESTAMP) \
/* timer indicating longest (slowest) call to put/get */\
X(MDHIM_F_PUT_MAX_DURATION) \
X(MDHIM_F_GET_MAX_DURATION) \
/* end of counters */\
X(MDHIM_F_NUM_INDICES)
#define X(a) a,
/* integer counters for the "NULL" example module */
enum darshan_mdhim_indices
{
MDHIM_COUNTERS
};
/* floating point counters for the "NULL" example module */
enum darshan_mdhim_f_indices
{
MDHIM_F_COUNTERS
};
#undef X
/* the darshan_mdhim_record structure encompasses the high-level data/counters
* which would actually be logged to file by Darshan for the "MDHIM"
* module. This implementation logs the following data for each
* record:
* - a darshan_base_record structure, which contains the record id & rank
* - integer I/O counters (operation counts, I/O sizes, etc.)
* - floating point I/O counters (timestamps, cumulative timers, etc.)
*/
struct darshan_mdhim_record
{
struct darshan_base_record base_rec;
int64_t counters[MDHIM_NUM_INDICES];
double fcounters[MDHIM_F_NUM_INDICES];
/* when we allocate this struct, we'll do so with enough extra memory to
* hold N servers. Compare to approach taken with darshan_lustre_record */
/* be mindful of struct alignment here: If one reads "sizeof(struct
* darshan_mdhim_record)", one might end up reading more than expected.
* Second read will then end up reading less than needed */
int64_t server_histogram[1];
};
/* '-1' because d_m_r already allocated with space for one */
#define MDHIM_RECORD_SIZE(servers) (sizeof(struct darshan_mdhim_record) + sizeof(int64_t) * ((servers) - 1) )
#endif /* __DARSHAN_MDHIM_LOG_FORMAT_H */
...@@ -36,6 +36,7 @@ CFLAGS_SHARED = -DDARSHAN_CONFIG_H=\"darshan-runtime-config.h\" -I . -I$(srcdir) ...@@ -36,6 +36,7 @@ CFLAGS_SHARED = -DDARSHAN_CONFIG_H=\"darshan-runtime-config.h\" -I . -I$(srcdir)
LIBS = -lz @LIBBZ2@ LIBS = -lz @LIBBZ2@
BUILD_HDF5_MODULE = @BUILD_HDF5_MODULE@ BUILD_HDF5_MODULE = @BUILD_HDF5_MODULE@
BUILD_MDHIM_MODULE = @BUILD_MDHIM_MODULE@
DARSHAN_STATIC_MOD_OBJS = lib/darshan-posix.o lib/darshan-mpiio.o lib/darshan-pnetcdf.o lib/darshan-stdio.o lib/darshan-dxt.o DARSHAN_STATIC_MOD_OBJS = lib/darshan-posix.o lib/darshan-mpiio.o lib/darshan-pnetcdf.o lib/darshan-stdio.o lib/darshan-dxt.o
DARSHAN_DYNAMIC_MOD_OBJS = lib/darshan-posix.po lib/darshan-mpiio.po lib/darshan-pnetcdf.po lib/darshan-stdio.po lib/darshan-dxt.po DARSHAN_DYNAMIC_MOD_OBJS = lib/darshan-posix.po lib/darshan-mpiio.po lib/darshan-pnetcdf.po lib/darshan-stdio.po lib/darshan-dxt.po
...@@ -59,6 +60,13 @@ CFLAGS += -DDARSHAN_LUSTRE ...@@ -59,6 +60,13 @@ CFLAGS += -DDARSHAN_LUSTRE
CFLAGS_SHARED += -DDARSHAN_LUSTRE CFLAGS_SHARED += -DDARSHAN_LUSTRE
endif endif
ifdef BUILD_MDHIM_MODULE
DARSHAN_STATIC_MOD_OBJS += lib/darshan-mdhim.o
DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-mdhim.po
CFLAGS += -DDARSHAN_MDHIM
CFLAGS_SHARED += -DDARSHAN_MDHIM
endif
lib:: lib::
@mkdir -p $@ @mkdir -p $@
...@@ -140,6 +148,13 @@ lib/darshan-dxt.o: lib/darshan-dxt.c darshan.h darshan-common.h $(DARSHAN_LOG_FO ...@@ -140,6 +148,13 @@ lib/darshan-dxt.o: lib/darshan-dxt.c darshan.h darshan-common.h $(DARSHAN_LOG_FO
lib/darshan-dxt.po: lib/darshan-dxt.c darshan.h darshan-dynamic.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-dxt-log-format.h | lib lib/darshan-dxt.po: lib/darshan-dxt.c darshan.h darshan-dynamic.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-dxt-log-format.h | lib
$(CC) $(CFLAGS_SHARED) -c $< -o $@ $(CC) $(CFLAGS_SHARED) -c $< -o $@
lib/darshan-mdhim.o: lib/darshan-mdhim.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-mdhim-log-format.h | lib
$(CC) $(CFLAGS) -c $< -o $@
lib/darshan-mdhim.po: lib/darshan-mdhim.c darshan.h darshan-dynamic.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-mdhim-log-format.h | lib
$(CC) $(CFLAGS_SHARED) -c $< -o $@
lib/lookup3.o: lib/lookup3.c lib/lookup3.o: lib/lookup3.c
$(CC) $(CFLAGS) -c $< -o $@ $(CC) $(CFLAGS) -c $< -o $@
...@@ -196,6 +211,9 @@ endif ...@@ -196,6 +211,9 @@ endif
install -m 644 $(srcdir)/share/ld-opts/darshan-posix-ld-opts $(datarootdir)/ld-opts/darshan-posix-ld-opts install -m 644 $(srcdir)/share/ld-opts/darshan-posix-ld-opts $(datarootdir)/ld-opts/darshan-posix-ld-opts
ifdef BUILD_HDF5_MODULE ifdef BUILD_HDF5_MODULE
install -m 644 $(srcdir)/share/ld-opts/darshan-hdf5-ld-opts $(datarootdir)/ld-opts/darshan-hdf5-ld-opts install -m 644 $(srcdir)/share/ld-opts/darshan-hdf5-ld-opts $(datarootdir)/ld-opts/darshan-hdf5-ld-opts
endif
ifdef BUILD_MDHIM_MODULE
install -m 644 $(srcdir)/share/ld-opts/darshan-mdhim-ld-opts $(datarootdir)/ld-opts/darshan-mdhim-ld-opts
endif endif
install -m 644 $(srcdir)/share/ld-opts/darshan-pnetcdf-ld-opts $(datarootdir)/ld-opts/darshan-pnetcdf-ld-opts install -m 644 $(srcdir)/share/ld-opts/darshan-pnetcdf-ld-opts $(datarootdir)/ld-opts/darshan-pnetcdf-ld-opts
install -m 644 $(srcdir)/share/ld-opts/darshan-stdio-ld-opts $(datarootdir)/ld-opts/darshan-stdio-ld-opts install -m 644 $(srcdir)/share/ld-opts/darshan-stdio-ld-opts $(datarootdir)/ld-opts/darshan-stdio-ld-opts
......
...@@ -621,6 +621,8 @@ ac_includes_default="\ ...@@ -621,6 +621,8 @@ ac_includes_default="\
ac_subst_vars='LTLIBOBJS ac_subst_vars='LTLIBOBJS
LIBOBJS LIBOBJS
DARSHAN_MDHIM_LD_OPTS
BUILD_MDHIM_MODULE
DARSHAN_HDF5_LD_OPTS DARSHAN_HDF5_LD_OPTS
BUILD_HDF5_MODULE BUILD_HDF5_MODULE
DARSHAN_USE_LUSTRE DARSHAN_USE_LUSTRE
...@@ -702,6 +704,7 @@ with_jobid_env ...@@ -702,6 +704,7 @@ with_jobid_env
with_mod_mem with_mod_mem
enable_HDF5_post_1_10 enable_HDF5_post_1_10
enable_HDF5_pre_1_10 enable_HDF5_pre_1_10
enable_mdhim
' '
ac_precious_vars='build_alias ac_precious_vars='build_alias
host_alias host_alias
...@@ -1332,6 +1335,7 @@ Optional Features: ...@@ -1332,6 +1335,7 @@ Optional Features:
Enable HDF5 module for HDF5 version 1.10 or later Enable HDF5 module for HDF5 version 1.10 or later
--enable-HDF5-pre-1.10 --enable-HDF5-pre-1.10
Enable HDF5 module for HDF5 versions earlier than 1.10 Enable HDF5 module for HDF5 versions earlier than 1.10
--enable-mdhim Enable mdhim module
Optional Packages: Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
...@@ -3761,6 +3765,7 @@ fi ...@@ -3761,6 +3765,7 @@ fi
fi fi
if test x$GOT_ALIGNMENT != x1; then if test x$GOT_ALIGNMENT != x1; then
as_fn_error $? "must provide --with-mem-align=<num> argument to configure." "$LINENO" 5 as_fn_error $? "must provide --with-mem-align=<num> argument to configure." "$LINENO" 5
fi fi
...@@ -4223,6 +4228,33 @@ fi ...@@ -4223,6 +4228,33 @@ fi
fi fi
BUILD_MDHIM_MODULE=
DARSHAN_MDHIM_LD_OPTS=
# Check whether --enable-mdhim was given.
if test "${enable_mdhim+set}" = set; then :
enableval=$enable_mdhim;
fi
if test "x$enable_mdhim" = "xyes"; then :
BUILD_MDHIM_MODULE=1
DARSHAN_MDHIM_LD_OPTS="@${darshan_share_path}/ld-opts/darshan-mdhim-ld-opts"
for ac_header in mdhim.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "mdhim.h" "ac_cv_header_mdhim_h" "$ac_includes_default"
if test "x$ac_cv_header_mdhim_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_MDHIM_H 1
_ACEOF
else
as_fn_error $? "mdhim requested but headers cannot be found" "$LINENO" 5
fi
done
fi
# determine if the MPI library includes MPI-IO functions or not # determine if the MPI library includes MPI-IO functions or not
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPI-IO support in MPI" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPI-IO support in MPI" >&5
$as_echo_n "checking for MPI-IO support in MPI... " >&6; } $as_echo_n "checking for MPI-IO support in MPI... " >&6; }
...@@ -4401,6 +4433,8 @@ DARSHAN_VERSION="3.1.6" ...@@ -4401,6 +4433,8 @@ DARSHAN_VERSION="3.1.6"
ac_config_files="$ac_config_files Makefile darshan-mk-log-dirs.pl darshan-gen-cc.pl darshan-gen-cxx.pl darshan-gen-fortran.pl darshan-config share/craype-1.x/darshan-module share/craype-2.x/darshan-module lib/pkgconfig/darshan-runtime.pc share/mpi-profile/darshan-cc.conf share/mpi-profile/darshan-cxx.conf share/mpi-profile/darshan-f.conf share/mpi-profile/darshan-bg-cc.conf share/mpi-profile/darshan-bg-cxx.conf share/mpi-profile/darshan-bg-f.conf share/ld-opts/darshan-base-ld-opts" ac_config_files="$ac_config_files Makefile darshan-mk-log-dirs.pl darshan-gen-cc.pl darshan-gen-cxx.pl darshan-gen-fortran.pl darshan-config share/craype-1.x/darshan-module share/craype-2.x/darshan-module lib/pkgconfig/darshan-runtime.pc share/mpi-profile/darshan-cc.conf share/mpi-profile/darshan-cxx.conf share/mpi-profile/darshan-f.conf share/mpi-profile/darshan-bg-cc.conf share/mpi-profile/darshan-bg-cxx.conf share/mpi-profile/darshan-bg-f.conf share/ld-opts/darshan-base-ld-opts"
cat >confcache <<\_ACEOF cat >confcache <<\_ACEOF
......
...@@ -162,6 +162,7 @@ if test x$enable_lustre_mod != xno; then ...@@ -162,6 +162,7 @@ if test x$enable_lustre_mod != xno; then
[])) []))
fi fi
if test x$GOT_ALIGNMENT != x1; then if test x$GOT_ALIGNMENT != x1; then
AC_MSG_ERROR(must provide --with-mem-align=<num> argument to configure.) AC_MSG_ERROR(must provide --with-mem-align=<num> argument to configure.)
fi fi
...@@ -283,6 +284,22 @@ AC_ARG_ENABLE(HDF5-pre-1.10, ...@@ -283,6 +284,22 @@ AC_ARG_ENABLE(HDF5-pre-1.10,
fi] fi]
,) ,)
BUILD_MDHIM_MODULE=
DARSHAN_MDHIM_LD_OPTS=
AC_ARG_ENABLE([mdhim],
AS_HELP_STRING([--enable-mdhim], [Enable mdhim module]),
[],[] )
AS_IF([test "x$enable_mdhim" = "xyes"],
BUILD_MDHIM_MODULE=1
DARSHAN_MDHIM_LD_OPTS="@${darshan_share_path}/ld-opts/darshan-mdhim-ld-opts"
AC_CHECK_HEADERS([mdhim.h],
[],
AC_MSG_ERROR([mdhim requested but headers cannot be found]) ),
[]
)
# determine if the MPI library includes MPI-IO functions or not # determine if the MPI library includes MPI-IO functions or not
AC_MSG_CHECKING(for MPI-IO support in MPI) AC_MSG_CHECKING(for MPI-IO support in MPI)
AC_TRY_LINK([#include <mpi.h>], [ AC_TRY_LINK([#include <mpi.h>], [
...@@ -382,6 +399,8 @@ AC_SUBST(DARSHAN_USE_BGQ) ...@@ -382,6 +399,8 @@ AC_SUBST(DARSHAN_USE_BGQ)
AC_SUBST(DARSHAN_USE_LUSTRE) AC_SUBST(DARSHAN_USE_LUSTRE)
AC_SUBST(BUILD_HDF5_MODULE) AC_SUBST(BUILD_HDF5_MODULE)
AC_SUBST(DARSHAN_HDF5_LD_OPTS) AC_SUBST(DARSHAN_HDF5_LD_OPTS)
AC_SUBST(BUILD_MDHIM_MODULE)
AC_SUBST(DARSHAN_MDHIM_LD_OPTS)
AC_OUTPUT(Makefile AC_OUTPUT(Makefile
darshan-mk-log-dirs.pl darshan-mk-log-dirs.pl
darshan-gen-cc.pl darshan-gen-cc.pl
......
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
/* Define to 1 if you have the `z' library (-lz). */ /* Define to 1 if you have the `z' library (-lz). */
#undef HAVE_LIBZ #undef HAVE_LIBZ
/* Define to 1 if you have the <mdhim.h> header file. */
#undef HAVE_MDHIM_H
/* Define to 1 if you have the <memory.h> header file. */ /* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H #undef HAVE_MEMORY_H
......
This diff is collapsed.
...@@ -12,3 +12,4 @@ ...@@ -12,3 +12,4 @@
@@darshan_share_path@/ld-opts/darshan-stdio-ld-opts @@darshan_share_path@/ld-opts/darshan-stdio-ld-opts
@@darshan_share_path@/ld-opts/darshan-mpiio-ld-opts @@darshan_share_path@/ld-opts/darshan-mpiio-ld-opts
@DARSHAN_HDF5_LD_OPTS@ @DARSHAN_HDF5_LD_OPTS@
@DARSHAN_MDHIM_LD_OPTS@
...@@ -13,10 +13,45 @@ libdir = $(DESTDIR)@libdir@ ...@@ -13,10 +13,45 @@ libdir = $(DESTDIR)@libdir@
pkgconfigdir = $(DESTDIR)$(libdir)/pkgconfig pkgconfigdir = $(DESTDIR)$(libdir)/pkgconfig
DARSHAN_LOG_FORMAT = $(srcdir)/../darshan-log-format.h DARSHAN_LOG_FORMAT = $(srcdir)/../darshan-log-format.h
DARSHAN_MOD_LOG_FORMATS = $(srcdir)/../darshan-posix-log-format.h $(srcdir)/../darshan-mpiio-log-format.h $(srcdir)/../darshan-hdf5-log-format.h $(srcdir)/../darshan-pnetcdf-log-format.h $(srcdir)/../darshan-bgq-log-format.h $(srcdir)/../darshan-lustre-log-format.h $(srcdir)/../darshan-stdio-log-format.h $(srcdir)/../darshan-dxt-log-format.h DARSHAN_MOD_LOG_FORMATS = $(srcdir)/../darshan-posix-log-format.h \
DARSHAN_MOD_LOGUTIL_HEADERS = darshan-posix-logutils.h darshan-mpiio-logutils.h darshan-hdf5-logutils.h darshan-pnetcdf-logutils.h darshan-bgq-logutils.h darshan-lustre-logutils.h darshan-stdio-logutils.h darshan-dxt-logutils.h $(srcdir)/../darshan-mpiio-log-format.h \
DARSHAN_STATIC_MOD_OBJS = darshan-posix-logutils.o darshan-mpiio-logutils.o darshan-hdf5-logutils.o darshan-pnetcdf-logutils.o darshan-bgq-logutils.o darshan-lustre-logutils.o darshan-stdio-logutils.o darshan-dxt-logutils.o $(srcdir)/../darshan-hdf5-log-format.h \
DARSHAN_DYNAMIC_MOD_OBJS = darshan-posix-logutils.po darshan-mpiio-logutils.po darshan-hdf5-logutils.po darshan-pnetcdf-logutils.po darshan-bgq-logutils.po darshan-lustre-logutils.po darshan-stdio-logutils.po darshan-dxt-logutils.po $(srcdir)/../darshan-pnetcdf-log-format.h \
$(srcdir)/../darshan-bgq-log-format.h \
$(srcdir)/../darshan-lustre-log-format.h \
$(srcdir)/../darshan-stdio-log-format.h \
$(srcdir)/../darshan-dxt-log-format.h \
$(srcdir)/../darshan-mdhim-log-format.h
DARSHAN_MOD_LOGUTIL_HEADERS = darshan-posix-logutils.h \
darshan-mpiio-logutils.h \
darshan-hdf5-logutils.h \
darshan-pnetcdf-logutils.h \
darshan-bgq-logutils.h \
darshan-lustre-logutils.h \
darshan-stdio-logutils.h \
darshan-dxt-logutils.h \
darshan-mdhim-logutils.h
DARSHAN_STATIC_MOD_OBJS = darshan-posix-logutils.o \
darshan-mpiio-logutils.o \
darshan-hdf5-logutils.o \
darshan-pnetcdf-logutils.o \
darshan-bgq-logutils.o \
darshan-lustre-logutils.o \
darshan-stdio-logutils.o \
darshan-dxt-logutils.o \
darshan-mdhim-logutils.o
DARSHAN_DYNAMIC_MOD_OBJS = darshan-posix-logutils.po \
darshan-mpiio-logutils.po \
darshan-hdf5-logutils.po \
darshan-pnetcdf-logutils.po \
darshan-bgq-logutils.po \
darshan-lustre-logutils.po \
darshan-stdio-logutils.po \
darshan-dxt-logutils.po \
darshan-mdhim-logutils.po
DARSHAN_ENABLE_SHARED=@DARSHAN_ENABLE_SHARED@ DARSHAN_ENABLE_SHARED=@DARSHAN_ENABLE_SHARED@
...@@ -96,6 +131,12 @@ darshan-dxt-logutils.o: darshan-dxt-logutils.c darshan-logutils.h darshan-dxt-lo ...@@ -96,6 +131,12 @@ darshan-dxt-logutils.o: darshan-dxt-logutils.c darshan-logutils.h darshan-dxt-lo
darshan-dxt-logutils.po: darshan-dxt-logutils.c darshan-logutils.h darshan-dxt-logutils.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-dxt-log-format.h | uthash-1.9.2 darshan-dxt-logutils.po: darshan-dxt-logutils.c darshan-logutils.h darshan-dxt-logutils.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-dxt-log-format.h | uthash-1.9.2
$(CC) $(CFLAGS_SHARED) -c $< -o $@ $(CC) $(CFLAGS_SHARED) -c $< -o $@
darshan-mdhim-logutils.o: darshan-mdhim-logutils.c darshan-logutils.h darshan-mdhim-logutils.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-mdhim-log-format.h | uthash-1.9.2
$(CC) $(CFLAGS) -c $< -o $@
darshan-mdhim-logutils.po: darshan-mdhim-logutils.c darshan-logutils.h darshan-mdhim-logutils.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-mdhim-log-format.h | uthash-1.9.2
$(CC) $(CFLAGS_SHARED) -c $< -o $@
libdarshan-util.a: darshan-logutils.o $(DARSHAN_STATIC_MOD_OBJS) libdarshan-util.a: darshan-logutils.o $(DARSHAN_STATIC_MOD_OBJS)
ar rcs libdarshan-util.a $^ ar rcs libdarshan-util.a $^
...@@ -159,6 +200,7 @@ endif ...@@ -159,6 +200,7 @@ endif
install -m 644 $(srcdir)/darshan-lustre-logutils.h $(includedir) install -m 644 $(srcdir)/darshan-lustre-logutils.h $(includedir)
install -m 644 $(srcdir)/darshan-stdio-logutils.h $(includedir) install -m 644 $(srcdir)/darshan-stdio-logutils.h $(includedir)
install -m 644 $(srcdir)/darshan-dxt-logutils.h $(includedir) install -m 644 $(srcdir)/darshan-dxt-logutils.h $(includedir)
install -m 644 $(srcdir)/darshan-mdhim-logutils.h $(includedir)
install -m 644 $(srcdir)/../darshan-null-log-format.h $(includedir) install -m 644 $(srcdir)/../darshan-null-log-format.h $(includedir)
install -m 644 $(srcdir)/../darshan-posix-log-format.h $(includedir) install -m 644 $(srcdir)/../darshan-posix-log-format.h $(includedir)
install -m 644 $(srcdir)/../darshan-mpiio-log-format.h $(includedir) install -m 644 $(srcdir)/../darshan-mpiio-log-format.h $(includedir)
...@@ -168,6 +210,7 @@ endif ...@@ -168,6 +210,7 @@ endif
install -m 644 $(srcdir)/../darshan-lustre-log-format.h $(includedir) install -m 644 $(srcdir)/../darshan-lustre-log-format.h $(includedir)
install -m 644 $(srcdir)/../darshan-stdio-log-format.h $(includedir) install -m 644 $(srcdir)/../darshan-stdio-log-format.h $(includedir)
install -m 644 $(srcdir)/../darshan-dxt-log-format.h $(includedir) install -m 644 $(srcdir)/../darshan-dxt-log-format.h $(includedir)
install -m 644 $(srcdir)/../darshan-mdhim-log-format.h $(includedir)
install -d $(includedir)/uthash-1.9.2 install -d $(includedir)/uthash-1.9.2
install -d $(includedir)/uthash-1.9.2/src install -d $(includedir)/uthash-1.9.2/src
install -m 644 uthash-1.9.2/src/uthash.h $(includedir)/uthash-1.9.2/src/ install -m 644 uthash-1.9.2/src/uthash.h $(includedir)/uthash-1.9.2/src/
......
...@@ -137,6 +137,7 @@ extern struct darshan_mod_logutil_funcs *mod_logutils[]; ...@@ -137,6 +137,7 @@ extern struct darshan_mod_logutil_funcs *mod_logutils[];
/* DXT */ /* DXT */
#include "darshan-dxt-logutils.h" #include "darshan-dxt-logutils.h"
#include "darshan-mdhim-logutils.h"
darshan_fd darshan_log_open(const char *name); darshan_fd darshan_log_open(const char *name);
darshan_fd darshan_log_create(const char *name, enum darshan_comp_type comp_type, darshan_fd darshan_log_create(const char *name, enum darshan_comp_type comp_type,
......
/*
* Copyright (C) 2015 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*
*/
#define _GNU_SOURCE
#include "darshan-util-config.h"
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <stdlib.h>
#include <unistd.h>
#include <inttypes.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include "darshan-logutils.h"
/* integer counter name strings for the MDHIM module */
#define X(a) #a,
char *mdhim_counter_names[] = {
MDHIM_COUNTERS
};
/* floating point counter name strings for the MDHIM module */
char *mdhim_f_counter_names[] = {
MDHIM_F_COUNTERS
};
#undef X
/* prototypes for each of the MDHIM module's logutil functions */
static int darshan_log_get_mdhim_record(darshan_fd fd, void** mdhim_buf_p);
static int darshan_log_put_mdhim_record(darshan_fd fd, void* mdhim_buf);
static void darshan_log_print_mdhim_record(void *file_rec,
char *file_name, char *mnt_pt, char *fs_type);
static void darshan_log_print_mdhim_description(int ver);
static void darshan_log_print_mdhim_record_diff(void *file_rec1, char *file_name1,
void *file_rec2, char *file_name2);
static void darshan_log_agg_mdhim_records(void *rec, void *agg_rec, int init_flag);
/* structure storing each function needed for implementing the darshan
* logutil interface. these functions are used for reading, writing, and
* printing module data in a consistent manner.
*/
struct darshan_mod_logutil_funcs mdhim_logutils =
{
.log_get_record = &darshan_log_get_mdhim_record,
.log_put_record = &darshan_log_put_mdhim_record,
.log_print_record = &darshan_log_print_mdhim_record,
.log_print_description = &darshan_log_print_mdhim_description,
.log_print_diff = &darshan_log_print_mdhim_record_diff,
.log_agg_records = &darshan_log_agg_mdhim_records
};
/* retrieve a MDHIM record from log file descriptor 'fd', storing the
* data in the buffer address pointed to by 'mdhim_buf_p'. Return 1 on
* successful record read, 0 on no more data, and -1 on error.
*/
static int darshan_log_get_mdhim_record(darshan_fd fd, void** mdhim_buf_p)
{
struct darshan_mdhim_record *rec =
*((struct darshan_mdhim_record **)mdhim_buf_p);
struct darshan_mdhim_record tmp_rec;
int i;
int ret;
if(fd->mod_map[DARSHAN_MDHIM_MOD].len == 0)
return(0);
/* read the fixed-sized portion of the MDHIM module record from the
* darshan log file */
ret = darshan_log_get_mod(fd, DARSHAN_MDHIM_MOD, &tmp_rec,
sizeof(struct darshan_mdhim_record));
if (ret < 0)
return (-1);
else if (ret < sizeof(struct darshan_mdhim_record))
return (0);
/* swap bytes if necessary */
if (fd->swap_flag)
{
/* reader-makes-right: don't look at a field until it has
* been swapped */
DARSHAN_BSWAP64(&tmp_rec.base_rec.id);
DARSHAN_BSWAP64(&tmp_rec.base_rec.rank);
for (i=0; i< MDHIM_NUM_INDICES; i++)
DARSHAN_BSWAP64(&tmp_rec.counters[i]);
for (i=0; i< MDHIM_F_NUM_INDICES; i++)
DARSHAN_BSWAP64(&tmp_rec.fcounters[i]);
DARSHAN_BSWAP64(&(tmp_rec.server_histogram[0]) );
}
if(*mdhim_buf_p == NULL)
{
rec = malloc(MDHIM_RECORD_SIZE(tmp_rec.counters[MDHIM_SERVERS]));
if (!rec)
return (-1);
}
memcpy(rec, &tmp_rec, sizeof(struct darshan_mdhim_record));
if (rec->counters[MDHIM_SERVERS] > 1) {
ret = darshan_log_get_mod(fd, DARSHAN_MDHIM_MOD,
&(rec->server_histogram[1]),
(rec->counters[MDHIM_SERVERS] - 1)*sizeof(int64_t));
if (ret < (rec->counters[MDHIM_SERVERS] -1)*sizeof(int64_t))
ret = -1;
else
{
ret = 1;
if (fd->swap_flag)
for(i=1; i< rec->counters[MDHIM_SERVERS]; i++)
DARSHAN_BSWAP64(&(rec->server_histogram[i]));
}
}
else
{
ret = 1;
}
if (*mdhim_buf_p == NULL)
{
if (ret == 1)
*mdhim_buf_p = rec;
else
free(rec);
}
return (ret);
}
/* write the MDHIM record stored in 'mdhim_buf' to log file descriptor 'fd'.
* Return 0 on success, -1 on failure
*/
static int darshan_log_put_mdhim_record(darshan_fd fd, void* mdhim_buf)
{
struct darshan_mdhim_record *rec = (struct darshan_mdhim_record *)mdhim_buf;
int ret;
/* append MDHIM record to darshan log file */
ret = darshan_log_put_mod(fd, DARSHAN_MDHIM_MOD, rec,
sizeof(struct darshan_mdhim_record), DARSHAN_MDHIM_VER);
if(ret < 0)
return(-1);
return(0);
}
/* print all I/O data record statistics for the given MDHIM record */
static void darshan_log_print_mdhim_record(void *file_rec, char *file_name,
char *mnt_pt, char *fs_type)
{
int i;
struct darshan_mdhim_record *mdhim_rec =
(struct darshan_mdhim_record *)file_rec;
/* print each of the integer and floating point counters for the MDHIM module */
for(i=0; i<MDHIM_NUM_INDICES; i++)
{
/* macro defined in darshan-logutils.h */
DARSHAN_COUNTER_PRINT(darshan_module_names[DARSHAN_MDHIM_MOD],
mdhim_rec->base_rec.rank, mdhim_rec->base_rec.id,
mdhim_counter_names[i], mdhim_rec->counters[i],