From 5f4e06f67c6195738e7f098fc697461d07bd41ff Mon Sep 17 00:00:00 2001 From: Shane Snyder Date: Tue, 26 Jan 2016 13:01:12 -0600 Subject: [PATCH] autogenerate an example epilog script --- darshan-runtime/Makefile.in | 1 + darshan-runtime/configure | 3 +- darshan-runtime/configure.in | 1 + .../share/darshan-mmap-epilog.sh.in | 57 +++++++++++++++++++ 4 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 darshan-runtime/share/darshan-mmap-epilog.sh.in diff --git a/darshan-runtime/Makefile.in b/darshan-runtime/Makefile.in index 27dcd30..6aaab33 100644 --- a/darshan-runtime/Makefile.in +++ b/darshan-runtime/Makefile.in @@ -154,6 +154,7 @@ endif install -m 755 share/mpi-profile/darshan-bg-cc.conf $(datarootdir)/mpi-profile/darshan-bg-cc.conf install -m 755 share/mpi-profile/darshan-bg-cxx.conf $(datarootdir)/mpi-profile/darshan-bg-cxx.conf install -m 755 share/mpi-profile/darshan-bg-f.conf $(datarootdir)/mpi-profile/darshan-bg-f.conf + install -m 755 share/darshan-mmap-epilog.sh $(datarootdir)/darshan-mmap-epilog.sh install -m 644 darshan-base-ld-opts $(datarootdir)/darshan-base-ld-opts install -m 644 $(srcdir)/darshan-posix-ld-opts $(datarootdir)/darshan-posix-ld-opts install -m 644 $(srcdir)/darshan-hdf5-ld-opts $(datarootdir)/darshan-hdf5-ld-opts diff --git a/darshan-runtime/configure b/darshan-runtime/configure index 9c8e501..45abdbf 100755 --- a/darshan-runtime/configure +++ b/darshan-runtime/configure @@ -4322,7 +4322,7 @@ DARSHAN_VERSION="3.0.0-pre3" -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-base-ld-opts 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" +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-base-ld-opts 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/darshan-mmap-epilog.sh" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -5032,6 +5032,7 @@ do "share/mpi-profile/darshan-bg-cc.conf") CONFIG_FILES="$CONFIG_FILES share/mpi-profile/darshan-bg-cc.conf" ;; "share/mpi-profile/darshan-bg-cxx.conf") CONFIG_FILES="$CONFIG_FILES share/mpi-profile/darshan-bg-cxx.conf" ;; "share/mpi-profile/darshan-bg-f.conf") CONFIG_FILES="$CONFIG_FILES share/mpi-profile/darshan-bg-f.conf" ;; + "share/darshan-mmap-epilog.sh") CONFIG_FILES="$CONFIG_FILES share/darshan-mmap-epilog.sh" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac diff --git a/darshan-runtime/configure.in b/darshan-runtime/configure.in index d6d2186..4bc6a05 100644 --- a/darshan-runtime/configure.in +++ b/darshan-runtime/configure.in @@ -345,4 +345,5 @@ 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/darshan-mmap-epilog.sh ) diff --git a/darshan-runtime/share/darshan-mmap-epilog.sh.in b/darshan-runtime/share/darshan-mmap-epilog.sh.in new file mode 100644 index 0000000..bc31333 --- /dev/null +++ b/darshan-runtime/share/darshan-mmap-epilog.sh.in @@ -0,0 +1,57 @@ +#!/bin/bash + +# +# Copyright (C) 2015 University of Chicago. +# See COPYRIGHT notice in top-level directory. +# + +# grab the prefix of the darshan install directory +DARSHAN_INSTALL_DIR=@prefix@ + +# use the log dir specified at configure time +DARSHAN_LOG_DIR=@__DARSHAN_LOG_PATH@ + +NODE_NAME=$(uname -n) + +# use the default mmap log directory (/tmp), unless the +# env variable is set to something +if [ -z "$DARSHAN_MMAP_LOGPATH" ]; then + DARSHAN_MMAP_LOG_DIR=/tmp +else + DARSHAN_MMAP_LOG_DIR=$DARSHAN_MMAP_LOGPATH +fi + +DARSHAN_MMAP_LOG_GLOB=${DARSHAN_MMAP_LOG_DIR}/*id${SLURM_JOB_ID}*.darshan + +# if no mmap logs found for this job, we have nothing to do +DARSHAN_TEST_LOG=$(ls $DARSHAN_MMAP_LOG_GLOB 2>/dev/null | head -n 1) +if [ -z $DARSHAN_TEST_LOG ]; then + exit 0 +fi + +# get the job start time from the first log file +JOB_START_DATE=$(${DARSHAN_INSTALL_DIR}/bin/darshan-parser $DARSHAN_TEST_LOG | + grep "# start_time_asci" | cut -d':' -f 2- | cut -d' ' -f 2-) +OUTLOG_YEAR=$(date --date="$(printf "$JOB_START_DATE")" +"%Y") +OUTLOG_MON=$(date --date="$(printf "$JOB_START_DATE")" +"%-m") +OUTLOG_DAY=$(date --date="$(printf "$JOB_START_DATE")" +"%-d") +OUTLOG_SECS=$(( + ($(date --date="$(printf "$JOB_START_DATE")" +"%-H") * 60 * 60) + + ($(date --date="$(printf "$JOB_START_DATE")" +"%-M") * 60) + + ($(date --date="$(printf "$JOB_START_DATE")" +"%-S")) +)) + +MMAP_LOG_PRE=$(basename $DARSHAN_TEST_LOG | cut -d'_' -f 1-3) + +# construct full output log directory name +OUTLOG_DIR=${DARSHAN_LOG_DIR}/${OUTLOG_YEAR}/${OUTLOG_MON}/${OUTLOG_DAY}/ +OUTLOG_DIR=$OUTLOG_DIR/${MMAP_LOG_PRE}_${OUTLOG_MON}-${OUTLOG_DAY}-${OUTLOG_SECS} + +# create the output directory for this job +mkdir -p $OUTLOG_DIR + +# construct the per-node log files and store in the output directory +$DARSHAN_INSTALL_DIR/bin/darshan-merge --output ${OUTLOG_DIR}/${MMAP_LOG_PRE}_${NODE_NAME}.darshan \ + $DARSHAN_MMAP_LOG_GLOB + +exit 0 -- 2.26.2