...
  View open merge request
Commits (19)
[submodule "modules/autoperf"]
path = modules/autoperf
url = git@xgitlab.cels.anl.gov:AutoPerf/autoperf.git
branch = master
......@@ -119,6 +119,9 @@ struct darshan_base_record
#include "darshan-stdio-log-format.h"
/* DXT */
#include "darshan-dxt-log-format.h"
#ifdef DARSHAN_USE_APXC
#include "darshan-apxc-log-format.h"
#endif
/* X-macro for keeping module ordering consistent */
/* NOTE: first val used to define module enum values,
......@@ -130,6 +133,18 @@ struct darshan_base_record
* component -- NULL can be passed if there are no
* logutil definitions)
*/
/* NOTE: if APXC support is not enabled, we still want to hold it's spot
* in the module id space
*/
#ifdef DARSHAN_USE_APXC
#define __DARSHAN_APXC_VER DARSHAN_APXC_VER
#define __apxc_logutils &apxc_logutils
#else
#define __DARSHAN_APXC_VER 0
#define __apxc_logutils NULL
#endif
#define DARSHAN_MODULE_IDS \
X(DARSHAN_NULL_MOD, "NULL", DARSHAN_NULL_VER, NULL) \
X(DARSHAN_POSIX_MOD, "POSIX", DARSHAN_POSIX_VER, &posix_logutils) \
......@@ -139,9 +154,9 @@ struct darshan_base_record
X(DARSHAN_BGQ_MOD, "BG/Q", DARSHAN_BGQ_VER, &bgq_logutils) \
X(DARSHAN_LUSTRE_MOD, "LUSTRE", DARSHAN_LUSTRE_VER, &lustre_logutils) \
X(DARSHAN_STDIO_MOD, "STDIO", DARSHAN_STDIO_VER, &stdio_logutils) \
/* DXT */ \
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_APXC_MOD, "DARSHAN_APXC", __DARSHAN_APXC_VER, __apxc_logutils)
/* unique identifiers to distinguish between available darshan modules */
/* NOTES: - valid ids range from [0...DARSHAN_MAX_MODS-1]
......
......@@ -20,6 +20,7 @@ DISABLE_LDPRELOAD = @DISABLE_LDPRELOAD@
ENABLE_MMAP_LOGS = @ENABLE_MMAP_LOGS@
DARSHAN_USE_BGQ = @DARSHAN_USE_BGQ@
DARSHAN_USE_LUSTRE = @DARSHAN_USE_LUSTRE@
DARSHAN_USE_APXC = @DARSHAN_USE_APXC@
DARSHAN_LOG_FORMAT = $(srcdir)/../darshan-log-format.h
DARSHAN_VERSION = @DARSHAN_VERSION@
......@@ -59,6 +60,10 @@ CFLAGS += -DDARSHAN_LUSTRE
CFLAGS_SHARED += -DDARSHAN_LUSTRE
endif
ifdef DARSHAN_USE_APXC
include $(srcdir)/../modules/autoperf/crayxc/Makefile.darshan
endif
lib::
@mkdir -p $@
......
......@@ -621,8 +621,10 @@ ac_includes_default="\
ac_subst_vars='LTLIBOBJS
LIBOBJS
with_papi
DARSHAN_HDF5_LD_OPTS
BUILD_HDF5_MODULE
DARSHAN_USE_APXC
DARSHAN_USE_LUSTRE
DARSHAN_USE_BGQ
MPICH_LIB_OLD
......@@ -694,6 +696,7 @@ enable_cuserid
enable_group_readable_logs
enable_bgq_mod
enable_lustre_mod
enable_autoperf_crayxc
enable_mmap_logs
with_mem_align
with_log_path_by_env
......@@ -1339,6 +1342,7 @@ Optional Features:
Set log files to be group readable
--disable-bgq-mod Disables compilation and use of BG/Q module (for BG/Q systems)
--disable-lustre-mod Disables compilation and use of the Lustre module
--enable-autoperf-crayxc Enables compilation and use of the AutoPerf Cray XC module
--enable-mmap-logs Enables ability to mmap I/O data to log file
--enable-HDF5-post-1.10
Enable HDF5 module for HDF5 version 1.10 or later
......@@ -3607,6 +3611,12 @@ else
fi
# Check whether --enable-autoperf-crayxc was given.
if test "${enable_autoperf_crayxc+set}" = set; then :
enableval=$enable_autoperf_crayxc; enable_autoperf_crayxc=yes
fi
# Check whether --enable-mmap-logs was given.
if test "${enable_mmap_logs+set}" = set; then :
enableval=$enable_mmap_logs; if test "x$enableval" = "xyes" ; then
......@@ -3773,6 +3783,19 @@ fi
fi
if test x$enable_autoperf_crayxc = xyes; then
ac_fn_c_check_header_mongrel "$LINENO" "papi.h" "ac_cv_header_papi_h" "$ac_includes_default"
if test "x$ac_cv_header_papi_h" = xyes; then :
with_papi=-lpapi
else
as_fn_error $? "Cannot find required header for papi" "$LINENO" 5
fi
DARSHAN_USE_APXC=1
fi
if test x$GOT_ALIGNMENT != x1; then
as_fn_error $? "must provide --with-mem-align=<num> argument to configure." "$LINENO" 5
fi
......@@ -4413,6 +4436,8 @@ DARSHAN_VERSION="3.1.5"
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
......
......@@ -60,6 +60,13 @@ AC_ARG_ENABLE(
[enable_lustre_mod=check]
)
AC_ARG_ENABLE(
[autoperf-crayxc],
[ --enable-autoperf-crayxc Enables compilation and use of the AutoPerf Cray XC module],
[enable_autoperf_crayxc=yes],
[]
)
AC_ARG_ENABLE(mmap-logs,
[ --enable-mmap-logs Enables ability to mmap I/O data to log file],
[if test "x$enableval" = "xyes" ; then
......@@ -162,6 +169,18 @@ if test x$enable_lustre_mod != xno; then
[]))
fi
if test x$enable_autoperf_crayxc = xyes; then
abssrcdir=$(readlink -f ${srcdir})
AC_CHECK_HEADER([papi.h],
with_papi=-lpapi,
[AC_MSG_ERROR([Cannot find required header for papi])],
[])
AC_CHECK_HEADER([${abssrcdir}/../modules/autoperf/crayxc/darshan-apxc-log-format.h],
DARSHAN_USE_APXC=1,
[AC_MSG_ERROR([The autoperf module is not present])],
[-]) # this last part tells it to only check for presence
fi
if test x$GOT_ALIGNMENT != x1; then
AC_MSG_ERROR(must provide --with-mem-align=<num> argument to configure.)
fi
......@@ -380,8 +399,10 @@ AC_SUBST(DARSHAN_VERSION)
AC_SUBST(MPICH_LIB_OLD)
AC_SUBST(DARSHAN_USE_BGQ)
AC_SUBST(DARSHAN_USE_LUSTRE)
AC_SUBST(DARSHAN_USE_APXC)
AC_SUBST(BUILD_HDF5_MODULE)
AC_SUBST(DARSHAN_HDF5_LD_OPTS)
AC_SUBST(with_papi)
AC_OUTPUT(Makefile
darshan-mk-log-dirs.pl
darshan-gen-cc.pl
......
......@@ -79,6 +79,10 @@ char** user_darshan_path_exclusions = NULL;
extern void bgq_runtime_initialize();
#endif
#ifdef DARSHAN_USE_APXC
extern void apxc_runtime_initialize();
#endif
/* array of init functions for modules which need to be statically
* initialized by darshan at startup time
*/
......@@ -86,6 +90,9 @@ void (*mod_static_init_fns[])(void) =
{
#ifdef DARSHAN_BGQ
&bgq_runtime_initialize,
#endif
#ifdef DARSHAN_USE_APXC
&apxc_runtime_initialize,
#endif
NULL
};
......
......@@ -16,4 +16,4 @@ darshan_linkopts="-Wl,@${darshan_share}/ld-opts/darshan-base-ld-opts"
Cflags:
Libs:
Libs.private: ${darshan_linkopts} ${darshan_libdir} -lfmpich -lmpichcxx -Wl,--start-group -ldarshan -ldarshan-stubs -Wl,--end-group
Libs.private: ${darshan_linkopts} ${darshan_libdir} -lfmpich -lmpichcxx -Wl,--start-group -ldarshan -ldarshan-stubs -Wl,--end-group @with_papi@
......@@ -12,6 +12,8 @@ bindir = $(DESTDIR)@bindir@
libdir = $(DESTDIR)@libdir@
pkgconfigdir = $(DESTDIR)$(libdir)/pkgconfig
DARSHAN_USE_APXC = @DARSHAN_USE_APXC@
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_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
......@@ -40,6 +42,10 @@ AR=@AR@
LIBS = -lz @LIBBZ2@
ifdef DARSHAN_USE_APXC
include $(srcdir)/../modules/autoperf/crayxc/util/Makefile.darshan
endif
mktestdir::
mkdir -p test
......
......@@ -621,6 +621,7 @@ ac_includes_default="\
ac_subst_vars='LTLIBOBJS
LIBOBJS
DARSHAN_USE_APXC
DARSHAN_UTIL_VERSION
DARSHAN_ENABLE_SHARED
__DARSHAN_PDFLATEX_HALT_ON_ERROR
......@@ -687,6 +688,7 @@ enable_option_checking
with_zlib
with_bzlib
enable_shared
enable_autoperf_crayxc
'
ac_precious_vars='build_alias
host_alias
......@@ -1318,6 +1320,7 @@ Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-shared enables building of shared darshan-util library
--enable-autoperf-crayxc Enables compilation and use of the AutoPerf Cray XC module
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
......@@ -4105,6 +4108,25 @@ fi
fi
# Check whether --enable-autoperf-crayxc was given.
if test "${enable_autoperf_crayxc+set}" = set; then :
enableval=$enable_autoperf_crayxc; enable_autoperf_crayxc=yes
fi
if test x$enable_autoperf_crayxc = xyes; then
ac_fn_c_check_header_mongrel "$LINENO" "papi.h" "ac_cv_header_papi_h" "$ac_includes_default"
if test "x$ac_cv_header_papi_h" = xyes; then :
with_papi=-lpapi
else
as_fn_error $? "Cannot find required header for papi" "$LINENO" 5
fi
DARSHAN_USE_APXC=1
fi
for ac_func in strndup
do :
ac_fn_c_check_func "$LINENO" "strndup" "ac_cv_func_strndup"
......@@ -4124,6 +4146,7 @@ DARSHAN_UTIL_VERSION="3.1.5"
ac_config_files="$ac_config_files Makefile darshan-job-summary/bin/darshan-job-summary.pl maint/darshan-util.pc"
cat >confcache <<\_ACEOF
......
......@@ -78,6 +78,21 @@ AC_ARG_ENABLE(shared,
fi]
,)
AC_ARG_ENABLE(
[autoperf-crayxc],
[ --enable-autoperf-crayxc Enables compilation and use of the AutoPerf Cray XC module],
[enable_autoperf_crayxc=yes],
[]
)
if test x$enable_autoperf_crayxc = xyes; then
abssrcdir=$(readlink -f ${srcdir})
AC_CHECK_HEADER([${abssrcdir}/../modules/autoperf/crayxc/darshan-apxc-log-format.h],
DARSHAN_USE_APXC=1,
[AC_MSG_ERROR([The autoperf module is not present])],
[-]) # this last part tells it to only check for presence
fi
AC_CHECK_FUNCS([strndup])
DARSHAN_UTIL_VERSION="AC_PACKAGE_VERSION"
......@@ -87,6 +102,7 @@ AC_SUBST(__DARSHAN_ZLIB_INCLUDE_FLAGS)
AC_SUBST(__DARSHAN_PDFLATEX_HALT_ON_ERROR)
AC_SUBST(DARSHAN_ENABLE_SHARED)
AC_SUBST(DARSHAN_UTIL_VERSION)
AC_SUBST(DARSHAN_USE_APXC)
AC_OUTPUT(Makefile
darshan-job-summary/bin/darshan-job-summary.pl
maint/darshan-util.pc
......
......@@ -50,7 +50,13 @@ struct darshan_mod_logutil_funcs bgq_logutils =
.log_print_record = &darshan_log_print_bgq_rec,
.log_print_description = &darshan_log_print_bgq_description,
.log_print_diff = &darshan_log_print_bgq_rec_diff,
.log_agg_records = &darshan_log_agg_bgq_recs
.log_agg_records = &darshan_log_agg_bgq_recs,
.log_accum_file = NULL,
.log_accum_perf = NULL,
.log_calc_file = NULL,
.log_print_total_file = NULL,
.log_file_list = NULL,
.log_calc_perf = NULL
};
static int darshan_log_get_bgq_rec(darshan_fd fd, void** bgq_buf_p)
......
......@@ -41,6 +41,12 @@ struct darshan_mod_logutil_funcs dxt_posix_logutils =
.log_print_description = NULL,
.log_print_diff = NULL,
.log_agg_records = NULL,
.log_accum_file = NULL,
.log_accum_perf = NULL,
.log_calc_file = NULL,
.log_print_total_file = NULL,
.log_file_list = NULL,
.log_calc_perf = NULL
};
struct darshan_mod_logutil_funcs dxt_mpiio_logutils =
......
......@@ -46,7 +46,13 @@ struct darshan_mod_logutil_funcs hdf5_logutils =
.log_print_record = &darshan_log_print_hdf5_file,
.log_print_description = &darshan_log_print_hdf5_description,
.log_print_diff = &darshan_log_print_hdf5_file_diff,
.log_agg_records = &darshan_log_agg_hdf5_files
.log_agg_records = &darshan_log_agg_hdf5_files,
.log_accum_file = NULL,
.log_accum_perf = NULL,
.log_calc_file = NULL,
.log_print_total_file = NULL,
.log_file_list = NULL,
.log_calc_perf = NULL
};
static int darshan_log_get_hdf5_file(darshan_fd fd, void** hdf5_buf_p)
......
......@@ -1837,6 +1837,181 @@ int darshan_log_get_namerecs_3_00(void *name_rec_buf, int buf_len,
return(buf_processed);
}
void darshan_calc_perf(perf_data_t *pdata, int64_t nprocs)
{
int64_t i;
pdata->shared_time_by_cumul =
pdata->shared_time_by_cumul / (double)nprocs;
pdata->shared_meta_time = pdata->shared_meta_time / (double)nprocs;
for (i=0; i<nprocs; i++)
{
if (pdata->rank_cumul_io_time[i] > pdata->slowest_rank_time)
{
pdata->slowest_rank_time = pdata->rank_cumul_io_time[i];
pdata->slowest_rank_meta_time = pdata->rank_cumul_md_time[i];
pdata->slowest_rank_rank = i;
}
}
if (pdata->slowest_rank_time + pdata->shared_time_by_cumul)
pdata->agg_perf_by_cumul = ((double)pdata->total_bytes / 1048576.0) /
(pdata->slowest_rank_time +
pdata->shared_time_by_cumul);
if (pdata->slowest_rank_time + pdata->shared_time_by_open)
pdata->agg_perf_by_open = ((double)pdata->total_bytes / 1048576.0) /
(pdata->slowest_rank_time +
pdata->shared_time_by_open);
if (pdata->slowest_rank_time + pdata->shared_time_by_open_lastio)
pdata->agg_perf_by_open_lastio = ((double)pdata->total_bytes / 1048576.0) /
(pdata->slowest_rank_time +
pdata->shared_time_by_open_lastio);
if (pdata->slowest_rank_time + pdata->shared_time_by_slowest)
pdata->agg_perf_by_slowest = ((double)pdata->total_bytes / 1048576.0) /
(pdata->slowest_rank_time +
pdata->shared_time_by_slowest);
return;
}
/*
* Support functions for use with other language bindings
*/
/*
* darshan_log_get_modules
*
* Gets list of modules present in logs and returns the info
*/
void darshan_log_get_modules (darshan_fd fd,
struct darshan_mod_info **mods,
int* count)
{
int i;
int j;
*mods = malloc(sizeof(**mods) * DARSHAN_MAX_MODS);
assert(*mods);
for (i = 0, j = 0; i < DARSHAN_MAX_MODS; i++)
{
if (fd->mod_map[i].len)
{
(*mods)[j].name = darshan_module_names[i];
(*mods)[j].len = fd->mod_map[i].len;
(*mods)[j].ver = fd->mod_ver[i];
(*mods)[j].idx = i;
j += 1;
}
}
*count = j;
return;
}
/*
* darshan_log_get_record
*
* Wrapper to hide the mod_logutils callback functions.
*/
int darshan_log_get_record (darshan_fd fd,
int mod_idx,
void **buf)
{
int r;
r = mod_logutils[mod_idx]->log_get_record(fd, buf);
return r;
}
/*
* darshan_log_stats
*
* Loops over the POSIX, MPIIO and STDIO module records to generate
* derived stats. This is the same as the parser '--perf' and '--total'
* options.
*/
int darshan_log_stats (darshan_fd fd)
{
int mod_list[] = { DARSHAN_POSIX_MOD,
DARSHAN_MPIIO_MOD,
DARSHAN_STDIO_MOD };
int i;
int idx;
int ret;
char *buf;
struct darshan_base_record *base_rec;
hash_entry_t *file_hash = NULL;
hash_entry_t total;
file_data_t fdata;
perf_data_t pdata;
memset(&total, 0, sizeof(total));
memset(&fdata, 0, sizeof(fdata));
memset(&pdata, 0, sizeof(pdata));
assert(0); // not ready for primetime yet
buf = malloc(DEF_MOD_BUF_SIZE);
if (!buf)
{
return(-1);
}
for (i = 0; i < sizeof(mod_list)/sizeof(int); i++)
{
idx = mod_list[i];
if (fd->mod_map[idx].len == 0)
{
continue;
}
memset(buf, 0, DEF_MOD_BUF_SIZE);
while(1)
{
int r;
hash_entry_t *hfile = NULL;
r = mod_logutils[i]->log_get_record(fd, (void**)&buf);
if (r < 1)
{
break;
}
base_rec = (struct darshan_base_record *) buf;
HASH_FIND(hlink, file_hash, &(base_rec->id), sizeof(darshan_record_id), hfile);
if (!hfile)
{
hfile = malloc(sizeof(*hfile));
if (!hfile)
{
ret = -1;
//goto cleanup;
}
memset(hfile, 0, sizeof(*hfile));
hfile->rec_id = base_rec->id;
hfile->type = 0;
hfile->procs = 0;
hfile->rec_dat = NULL;
hfile->cumul_time = 0.0;
hfile->slowest_time = 0.0;
HASH_ADD(hlink, file_hash, rec_id, sizeof(darshan_record_id), hfile);
}
}
}
return 0;
}
/*
* Local variables:
* c-indent-level: 4
......
......@@ -22,6 +22,12 @@
*/
#define DEF_MOD_BUF_SIZE 81920
#define FILETYPE_SHARED (1 << 0)
#define FILETYPE_UNIQUE (1 << 1)
#define FILETYPE_PARTSHARED (1 << 2)
#define max(a,b) (((a) > (b)) ? (a) : (b))
struct darshan_fd_int_state;
/* darshan file descriptor definition */
......@@ -62,12 +68,72 @@ struct lustre_record_ref
UT_hash_handle hlink;
};
typedef struct hash_entry_s
{
UT_hash_handle hlink;
darshan_record_id rec_id;
int64_t type;
int64_t procs;
void *rec_dat;
double cumul_time;
double slowest_time;
} hash_entry_t;
typedef struct file_data_s
{
int64_t total;
int64_t total_size;
int64_t total_max;
int64_t read_only;
int64_t read_only_size;
int64_t read_only_max;
int64_t write_only;
int64_t write_only_size;
int64_t write_only_max;
int64_t read_write;
int64_t read_write_size;
int64_t read_write_max;
int64_t unique;
int64_t unique_size;
int64_t unique_max;
int64_t shared;
int64_t shared_size;
int64_t shared_max;
} file_data_t;
typedef struct perf_data_s
{
int64_t total_bytes;
double slowest_rank_time;
double slowest_rank_meta_time;
int slowest_rank_rank;
double shared_time_by_cumul;
double shared_time_by_open;
double shared_time_by_open_lastio;
double shared_time_by_slowest;
double shared_meta_time;
double agg_perf_by_cumul;
double agg_perf_by_open;
double agg_perf_by_open_lastio;
double agg_perf_by_slowest;
double *rank_cumul_io_time;
double *rank_cumul_md_time;
} perf_data_t;
struct darshan_mnt_info
{
char mnt_type[DARSHAN_EXE_LEN];
char mnt_path[DARSHAN_EXE_LEN];
};
struct darshan_mod_info
{
char *name;
int len;
int ver;
int idx;
};
/* functions to be implemented by each module for integration with
* darshan log file utilities (e.g., parser & convert tools)
*/
......@@ -123,6 +189,38 @@ struct darshan_mod_logutil_funcs
void *agg_rec,
int init_flag
);
/* accumulate file statistics across processes */
void (*log_accum_file)(
void *rec,
hash_entry_t *hfile,
int64_t nprocs
);
/* accumulate data for performance estimate */
void (*log_accum_perf)(
void *rec,
perf_data_t *pdata
);
/* accumulate statistics about files and file counts */
void (*log_calc_file)(
hash_entry_t *hfile,
file_data_t *fdata
);
/* print out the aggregate file stats */
void (*log_print_total_file)(
void *rec,
int ver
);
/* print out statistics on a per file basis */
void (*log_file_list)(
hash_entry_t *hfile,
struct darshan_name_record_ref *name_hash,
int detail_flag
);
/* calculate performance estimate */
void (*log_calc_perf)(
perf_data_t *pdata,
int64_t nprocs
);
};
extern struct darshan_mod_logutil_funcs *mod_logutils[];
......@@ -138,6 +236,10 @@ extern struct darshan_mod_logutil_funcs *mod_logutils[];
/* DXT */
#include "darshan-dxt-logutils.h"
#ifdef DARSHAN_USE_APXC
#include "darshan-apxc-logutils.h"
#endif
darshan_fd darshan_log_open(const char *name);
darshan_fd darshan_log_create(const char *name, enum darshan_comp_type comp_type,
int partial_flag);
......@@ -157,6 +259,9 @@ int darshan_log_put_mod(darshan_fd fd, darshan_module_id mod_id,
void *mod_buf, int mod_buf_sz, int ver);
void darshan_log_close(darshan_fd file);
void darshan_log_print_version_warnings(const char *version_string);
void darshan_log_get_modules (darshan_fd fd, struct darshan_mod_info **mods, int* count);
int darshan_log_get_record (darshan_fd fd, int mod_idx, void **buf);
void darshan_calc_perf(perf_data_t *pdata, int64_t nprocs);
/* convenience macros for printing Darshan counters */
#define DARSHAN_PRINT_HEADER() \
......@@ -171,6 +276,22 @@ void darshan_log_print_version_warnings(const char *version_string);
__file_name, __mnt_pt, __fs_type); \
} while(0)
#define DARSHAN_I_COUNTER_PRINT(__mod_name, __rank, __file_id, \
__counter, __counter_val, __file_name, \
__mnt_pt, __fs_type) do { \
printf("%s\t%" PRId64 "\t%" PRIu64 "\t%s\t%d\t%s\t%s\t%s\n", \
__mod_name, __rank, __file_id, __counter, __counter_val, \
__file_name, __mnt_pt, __fs_type); \
} while(0)
#define DARSHAN_S_COUNTER_PRINT(__mod_name, __rank, __file_id, \
__counter, __counter_val, __file_name, \
__mnt_pt, __fs_type) do { \
printf("%s\t%" PRId64 "\t%" PRIu64 "\t%s\t%s\t%s\t%s\t%s\n", \
__mod_name, __rank, __file_id, __counter, __counter_val, \
__file_name, __mnt_pt, __fs_type); \
} while(0)
#define DARSHAN_F_COUNTER_PRINT(__mod_name, __rank, __file_id, \
__counter, __counter_val, __file_name, \
__mnt_pt, __fs_type) do { \
......
......@@ -40,7 +40,13 @@ struct darshan_mod_logutil_funcs lustre_logutils =
.log_print_record = &darshan_log_print_lustre_record,
.log_print_description = &darshan_log_print_lustre_description,
.log_print_diff = &darshan_log_print_lustre_record_diff,
.log_agg_records = &darshan_log_agg_lustre_records
.log_agg_records = &darshan_log_agg_lustre_records,
.log_accum_file = NULL,
.log_accum_perf = NULL,
.log_calc_file = NULL,
.log_print_total_file = NULL,
.log_file_list = NULL,
.log_calc_perf = NULL
};
static int darshan_log_get_lustre_record(darshan_fd fd, void** lustre_buf_p)
......
This diff is collapsed.
......@@ -52,7 +52,13 @@ struct darshan_mod_logutil_funcs null_logutils =
.log_print_record = &darshan_log_print_null_record,
.log_print_description = &darshan_log_print_null_description,
.log_print_diff = &darshan_log_print_null_record_diff,
.log_agg_records = &darshan_log_agg_null_records
.log_agg_records = &darshan_log_agg_null_records,
.log_accum_file = NULL,
.log_accum_perf = NULL,
.log_calc_file = NULL,
.log_print_total_file = NULL,
.log_file_list = NULL,
.log_calc_perf = NULL
};
/* retrieve a NULL record from log file descriptor 'fd', storing the
......
This diff is collapsed.
......@@ -46,7 +46,13 @@ struct darshan_mod_logutil_funcs pnetcdf_logutils =
.log_print_record = &darshan_log_print_pnetcdf_file,
.log_print_description = &darshan_log_print_pnetcdf_description,
.log_print_diff = &darshan_log_print_pnetcdf_file_diff,
.log_agg_records = &darshan_log_agg_pnetcdf_files
.log_agg_records = &darshan_log_agg_pnetcdf_files,
.log_accum_file = NULL,
.log_accum_perf = NULL,
.log_calc_file = NULL,
.log_print_total_file = NULL,
.log_file_list = NULL,
.log_calc_perf = NULL
};
static int darshan_log_get_pnetcdf_file(darshan_fd fd, void** pnetcdf_buf_p)
......
This diff is collapsed.
This diff is collapsed.
import cffi
import numpy
API_def_c = r"""
/* from darshan-logutils.h */
struct darshan_mnt_info
{
char mnt_type[3031];
char mnt_path[3031];
};
struct darshan_mod_info
{
char *name;
int len;
int ver;
int idx;
};
/* from darshan-log-format.h */
struct darshan_job
{
int64_t uid;
int64_t start_time;
int64_t end_time;
int64_t nprocs;
int64_t jobid;
char metadata[1024];
};
struct darshan_base_record
{
uint64_t id;
int64_t rank;
};
struct darshan_posix_file
{
struct darshan_base_record base_rec;
int64_t counters[64];
double fcounters[17];
};
struct darshan_stdio_file
{
struct darshan_base_record base_rec;
int64_t counters[13];
double fcounters[15];
};
struct darshan_mpiio_file
{
struct darshan_base_record base_rec;
int64_t counters[51];
double fcounters[15];
};
struct darshan_hdf5_file
{
struct darshan_base_record base_rec;
int64_t counters[1];
double fcounters[2];
};
struct darshan_pnetcdf_file
{
struct darshan_base_record base_rec;
int64_t counters[2];
double fcounters[2];
};
struct darshan_bgq_record
{
struct darshan_base_record base_rec;
int64_t counters[11];
double fcounters[1];
};
/* from darshan-apxc-log-format.h */
struct darshan_apxc_header_record
{
struct darshan_base_record base_rec;
int64_t magic;
int nblades;
int nchassis;
int ngroups;
int memory_mode;
int cluster_mode;
};
struct darshan_apxc_perf_record
{
struct darshan_base_record base_rec;
int64_t counters[396];
};
/* counter names */
char *apxc_counter_names[];
char *bgq_counter_names[];
char *bgq_f_counter_names[];
char *hdf5_counter_names[];
char *hdf5_f_counter_names[];
char *mpiio_counter_names[];
char *mpiio_f_counter_names[];
char *pnetcdf_counter_names[];
char *pnetcdf_f_counter_names[];
char *posix_counter_names[];
char *posix_f_counter_names[];
char *stdio_counter_names[];
char *stdio_f_counter_names[];
/* Supported Functions */
void* darshan_log_open(char *);
int darshan_log_get_job(void *, struct darshan_job *);
void darshan_log_close(void*);
int darshan_log_get_exe(void*, char *);
int darshan_log_get_mounts(void*, struct darshan_mnt_info **, int*);
void darshan_log_get_modules(void*, struct darshan_mod_info **, int*);
int darshan_log_get_record(void*, int, void **);
"""
ffi = cffi.FFI()
ffi.cdef(API_def_c)
libdutil = ffi.dlopen("/home/harms/working/darshan/cooley/install/lib/libdarshan-util.so")
modules = {}
def log_open(filename):
b_fname = filename.encode()
log = libdutil.darshan_log_open(b_fname)
if log:
mods = log_get_modules(log)
return log
def log_close(log):
libdutil.darshan_log_close(log)
modules = {}
return
def log_get_job(log):
job = {}
jobrec = ffi.new("struct darshan_job *")
libdutil.darshan_log_get_job(log, jobrec)
job['jobid'] = jobrec[0].jobid
job['uid'] = jobrec[0].uid
job['start_time'] = jobrec[0].start_time
job['end_time'] = jobrec[0].end_time
mstr = ffi.string(jobrec[0].metadata).decode("utf-8")
md = {}
for kv in mstr.split('\n')[:-1]:
k,v = kv.split('=', maxsplit=1)
md[k] = v
job['metadata'] = md
return job
def log_get_exe(log):
exestr = ffi.new("char[]", 4096)
libdutil.darshan_log_get_exe(log, exestr)
return ffi.string(exestr).decode("utf-8")
def log_get_mounts(log):
mntlst = []
mnts = ffi.new("struct darshan_mnt_info **")
cnt = ffi.new("int *")
libdutil.darshan_log_get_mounts(log, mnts, cnt)
for i in range(0, cnt[0]):
mntlst.append((ffi.string(mnts[0][i].mnt_path).decode("utf-8"),
ffi.string(mnts[0][i].mnt_type).decode("utf-8")))
return mntlst
def log_get_modules(log):
mods = ffi.new("struct darshan_mod_info **")
cnt = ffi.new("int *")
libdutil.darshan_log_get_modules(log, mods, cnt)
for i in range(0, cnt[0]):
modules[ffi.string(mods[0][i].name).decode("utf-8")] = \
{'len': mods[0][i].len, 'ver': mods[0][i].ver, 'idx': mods[0][i].idx}
return modules
def log_get_generic_record(log, mod_name, mod_type):
rec = {}
buf = ffi.new("void **")
r = libdutil.darshan_log_get_record(log, modules[mod_name]['idx'], buf)
if r < 1:
return None
rbuf = ffi.cast(mod_type, buf)
clst = []
for i in range(0, len(rbuf[0].counters)):
clst.append(rbuf[0].counters[i])
rec['counters'] = numpy.array(clst, dtype=numpy.uint64)
flst = []
for i in range(0, len(rbuf[0].fcounters)):
flst.append(rbuf[0].fcounters[i])
rec['fcounters'] = numpy.array(clst, dtype=numpy.float64)
return rec
def counter_names(mod_name, fcnts=False):
names = []
i = 0
if fcnts:
F = "f_"
else:
F = ""
end = "{0}_{1}NUM_INDICES".format(mod_name.upper(), F.upper())
var_name = "{0}_{1}counter_names".format(mod_name.lower(), F.lower())
while True:
try:
var = getattr(libdutil, var_name)
except:
var = None
if not var:
return None
name = ffi.string(var[i]).decode("utf-8")
if name == end:
break
names.append(name)
i += 1
return names
def fcounter_names(mod_name):
return counter_names(mod_name, fcnts=True)
def log_get_bgq_record(log):
return log_get_generic_record(log, "BG/Q", "struct darshan_bgq_record **")
def log_get_hdf5_record(log):
return log_get_generic_record(log, "HDF5", "struct darshan_hdf5_file **")
def log_get_mpiio_record(log):
return log_get_generic_record(log, "MPIIO", "struct darshan_mpiio_file **")
def log_get_pnetcdf_record(log):
return log_get_generic_record(log, "PNETCDF", "struct darshan_pnetcdf_file **")
def log_get_posix_record(log):
return log_get_generic_record(log, "POSIX", "struct darshan_posix_file **")
def log_get_stdio_record(log):
return log_get_generic_record(log, "STDIO", "struct darshan_stdio_file **")
def log_get_apxc_record(log):
rec = {}
memory_modes = ['unknown', 'flat', 'equal', 'split', 'cache']
cluster_modes = ['unknown', 'all2all', 'quad', 'hemi', 'snc4', 'snc2']
buf = ffi.new("void **")
r = libdutil.darshan_log_get_record(log, modules['DARSHAN_APXC']['idx'], buf)
if r < 1:
return None
prf = ffi.cast("struct darshan_apxc_perf_record **", buf)
hdr = ffi.cast("struct darshan_apxc_header_record **", buf)
if hdr[0].magic == 4707761685111591494:
mm = hdr[0].memory_mode & ~(1 << 31)
cm = hdr[0].cluster_mode & ~(1 << 31)
rec['nblades'] = hdr[0].nblades
rec['nchassis'] = hdr[0].nchassis
rec['ngroups'] = hdr[0].ngroups
rec['memory_mode'] = memory_modes[mm]
rec['cluster_mode'] = cluster_modes[cm]
else:
rec['group'] = prf[0].counters[0]
rec['chassis'] = prf[0].counters[1]
rec['blade'] = prf[0].counters[2]
rec['node'] = prf[0].counters[3]
clst = []
for i in range(0, len(prf[0].counters)):
clst.append(prf[0].counters[i])
rec['counters'] = numpy.array(clst, dtype=numpy.uint64)
return rec
Subproject commit f638b7b366991a78727b07969a4aef650c3ef95c