Commit 45e55e90 authored by Cong Xu's avatar Cong Xu

Check in Darshan IOF module runtime code

1. Modify configure and Makefile to compile and build IOF module.
2. Develop code to initialize and finalize IOF module.
3. Waiting for IOF APIs to obtain IOF striping information.
Signed-off-by: default avatarCong Xu <congxu@localhost.localdomain>
parent 2d14002d
/*
* Copyright (C) 2015 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*
* Copyright (C) 2017 Intel Corporation
*/
#ifndef __DARSHAN_IOF_LOG_FORMAT_H
#define __DARSHAN_IOF_LOG_FORMAT_H
/* NOTE -- redefining the size of IONSS_ID will require changing the
* DARSHAN_BSWAP macro used in darshan-util/darshan-iof-logutils.c
* as well
*/
typedef int64_t IONSS_ID;
/* current IOF log format version */
#define DARSHAN_IOF_VER 1
#define IOF_COUNTERS \
/* number of IONSSs for file system */\
X(IOF_IONSS) \
/* number of MDTs for file system */\
X(IOF_MDTS) \
/* index of first IONSS for file */\
X(IOF_STRIPE_OFFSET) \
/* bytes per stripe for file */\
X(IOF_STRIPE_SIZE) \
/* number of stripes (IONSSs) for file */\
X(IOF_STRIPE_WIDTH) \
/* end of counters */\
X(IOF_NUM_INDICES)
#define X(a) a,
/* integer statistics for IOF file records */
enum darshan_iof_indices
{
IOF_COUNTERS
};
#undef X
/* record structure for the IOF module. a record is created and stored for
* every file opened that belongs to a IOF file system. This record includes:
* - a corresponding record identifier (created by hashing the file path)
* - the rank of the process which opened the file (-1 for shared files)
* - integer file I/O statistics (stripe size, width, # of IONSSs, etc.)
*/
struct darshan_iof_record
{
struct darshan_base_record base_rec;
int64_t counters[IOF_NUM_INDICES];
IONSS_ID ionss_ids[1];
};
/*
* helper function to calculate the size of a record
*/
#define IOF_RECORD_SIZE( ionss ) ( sizeof(struct darshan_iof_record) + sizeof(IONSS_ID) * (ionss - 1) )
#endif /* __DARSHAN_IOF_LOG_FORMAT_H */
......@@ -119,6 +119,8 @@ struct darshan_base_record
#include "darshan-stdio-log-format.h"
/* DXT */
#include "darshan-dxt-log-format.h"
/* IOF */
#include "darshan-iof-log-format.h"
/* X-macro for keeping module ordering consistent */
/* NOTE: first val used to define module enum values,
......@@ -141,7 +143,10 @@ struct darshan_base_record
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) \
/* IOF */ \
X(DARSHAN_IOF_MOD, "IOF", DARSHAN_IOF_VER, &iof_logutils)
/* unique identifiers to distinguish between available darshan modules */
/* NOTES: - valid ids range from [0...DARSHAN_MAX_MODS-1]
......
......@@ -19,6 +19,7 @@ LD = @LD@
DISABLE_LDPRELOAD = @DISABLE_LDPRELOAD@
ENABLE_MMAP_LOGS = @ENABLE_MMAP_LOGS@
DARSHAN_USE_BGQ = @DARSHAN_USE_BGQ@
DARSHAN_USE_IOF = @DARSHAN_USE_IOF@
DARSHAN_USE_LUSTRE = @DARSHAN_USE_LUSTRE@
DARSHAN_LOG_FORMAT = $(srcdir)/../darshan-log-format.h
DARSHAN_VERSION = @DARSHAN_VERSION@
......@@ -52,6 +53,13 @@ CFLAGS += -DDARSHAN_BGQ
CFLAGS_SHARED += -DDARSHAN_BGQ
endif
ifdef DARSHAN_USE_IOF
DARSHAN_STATIC_MOD_OBJS += lib/darshan-iof.o
DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-iof.po
CFLAGS += -DDARSHAN_IOF
CFLAGS_SHARED += -DDARSHAN_IOF
endif
ifdef DARSHAN_USE_LUSTRE
DARSHAN_STATIC_MOD_OBJS += lib/darshan-lustre.o
DARSHAN_DYNAMIC_MOD_OBJS += lib/darshan-lustre.po
......@@ -122,6 +130,12 @@ lib/darshan-pnetcdf.po: lib/darshan-pnetcdf.c darshan.h darshan-dynamic.h darsha
lib/darshan-pnetcdf-stubs.o: lib/darshan-pnetcdf-stubs.c darshan.h $(DARSHAN_LOG_FORMAT) | lib
$(CC) $(CFLAGS) -c $< -o $@
lib/darshan-iof.o: lib/darshan-iof.c darshan-iof.h darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-iof-log-format.h | lib
$(CC) $(CFLAGS) -c $< -o $@
lib/darshan-iof.po: lib/darshan-iof.c darshan-iof.h darshan.h darshan-dynamic.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-iof-log-format.h | lib
$(CC) $(CFLAGS_SHARED) -c $< -o $@
lib/darshan-lustre.o: lib/darshan-lustre.c darshan-lustre.h darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-lustre-log-format.h | lib
$(CC) $(CFLAGS) -c $< -o $@
......
......@@ -623,6 +623,7 @@ ac_subst_vars='LTLIBOBJS
LIBOBJS
DARSHAN_HDF5_LD_OPTS
BUILD_HDF5_MODULE
DARSHAN_USE_IOF
DARSHAN_USE_LUSTRE
DARSHAN_USE_BGQ
MPICH_LIB_OLD
......@@ -693,6 +694,7 @@ enable_ld_preload
enable_cuserid
enable_group_readable_logs
enable_bgq_mod
enable_iof_mod
enable_lustre_mod
enable_mmap_logs
with_mem_align
......@@ -1338,6 +1340,7 @@ Optional Features:
--enable-group-readable-logs
Set log files to be group readable
--disable-bgq-mod Disables compilation and use of BG/Q module (for BG/Q systems)
--disable-iof-mod Disables compilation and use of the IOF module
--disable-lustre-mod Disables compilation and use of the Lustre module
--enable-mmap-logs Enables ability to mmap I/O data to log file
--enable-HDF5-post-1.10
......@@ -3598,6 +3601,15 @@ else
fi
# Check whether --enable-iof-mod was given.
if test "${enable_iof_mod+set}" = set; then :
enableval=$enable_iof_mod;
else
enable_iof_mod=check
fi
# Check whether --enable-lustre-mod was given.
if test "${enable_lustre_mod+set}" = set; then :
enableval=$enable_lustre_mod;
......@@ -3759,6 +3771,12 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
# if IOF module not disabled,
if test x$enable_iof_mod != xno; then
DARSHAN_USE_IOF=1
fi
# if lustre module not disabled, check for needed Lustre module header
if test x$enable_lustre_mod != xno; then
ac_fn_c_check_header_mongrel "$LINENO" "lustre/lustre_user.h" "ac_cv_header_lustre_lustre_user_h" "$ac_includes_default"
......
......@@ -53,6 +53,13 @@ AC_ARG_ENABLE(
[enable_bgq_mod=check]
)
AC_ARG_ENABLE(
[iof-mod],
[ --disable-iof-mod Disables compilation and use of the IOF module],
[],
[enable_iof_mod=check]
)
AC_ARG_ENABLE(
[lustre-mod],
[ --disable-lustre-mod Disables compilation and use of the Lustre module],
......@@ -153,6 +160,11 @@ if test x$enable_bgq_mod != xno; then
[]))
fi
# if IOF module not disabled
if test x$enable_iof_mod != xno; then
DARSHAN_USE_IOF=1,
fi
# if lustre module not disabled, check for needed Lustre module header
if test x$enable_lustre_mod != xno; then
AC_CHECK_HEADER([lustre/lustre_user.h],
......@@ -379,6 +391,7 @@ AC_SUBST(ENABLE_MMAP_LOGS)
AC_SUBST(DARSHAN_VERSION)
AC_SUBST(MPICH_LIB_OLD)
AC_SUBST(DARSHAN_USE_BGQ)
AC_SUBST(DARSHAN_USE_IOF)
AC_SUBST(DARSHAN_USE_LUSTRE)
AC_SUBST(BUILD_HDF5_MODULE)
AC_SUBST(DARSHAN_HDF5_LD_OPTS)
......
struct iof_record_ref
{
struct darshan_iof_record *record;
size_t record_size;
};
struct iof_runtime
{
int record_count; /* number of records stored in record_id_hash */
void *record_id_hash;
int record_buffer_size; /* size of record_buffer in bytes */
void *record_buffer;
int record_ref_array_ndx; /* current index into record_ref_array */
struct iof_record_ref **record_ref_array;
};
......@@ -90,6 +90,13 @@ void (*mod_static_init_fns[])(void) =
NULL
};
#ifdef DARSHAN_IOF
/* XXX need to use extern to get IOF module's instrumentation function
* since modules have no way of providing this to darshan-core
*/
extern void darshan_instrument_iof_file(const char *filepath, int fd);
#endif
#ifdef DARSHAN_LUSTRE
/* XXX need to use extern to get Lustre module's instrumentation function
* since modules have no way of providing this to darshan-core
......@@ -1015,6 +1022,10 @@ static void add_entry(char* buf, int* space_left, struct mntent* entry)
}
#endif
#ifndef FUSE_SUPER_MAGIC
#define FUSE_SUPER_MAGIC 0x65735546
#endif
/* store mount information with the job-level metadata in darshan log */
ret = snprintf(tmp_mnt, 256, "\n%s\t%s",
entry->mnt_type, entry->mnt_dir);
......@@ -2117,6 +2128,16 @@ void darshan_instrument_fs_data(int fs_type, const char *path, int fd)
return;
}
#endif
#ifdef DARSHAN_IOF
/* allow iof to generate a record if we configured with iof support */
if(fs_type == FUSE_SUPER_MAGIC)
{
darshan_instrument_iof_file(path, fd);
return;
}
#endif
return;
}
......
This diff is collapsed.
/*
* Copyright (C) 2015 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*
* Copyright (C) 2017 Intel Corporation.
*/
#ifndef __DARSHAN_IOF_LOG_UTILS_H
#define __DARSHAN_IOF_LOG_UTILS_H
extern char *iof_counter_names[];
extern struct darshan_mod_logutil_funcs iof_logutils;
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment