darshan-summary-per-file.sh 1.4 KB
Newer Older
1
#!/bin/bash
2 3

#
Shane Snyder's avatar
Shane Snyder committed
4 5
# Copyright (C) 2015 University of Chicago.
# See COPYRIGHT notice in top-level directory.
6 7
#

8 9 10
# change behavior of shell error code following failure of a piped command
set -o pipefail

11
if [ $# -ne 2 ]; then
12
    echo "Usage: darshan-summary-per-file.sh <input_file.darshan> <output_directory>"
13 14 15
    exit 1
fi

16
# count number of files present in log
17
filecount=`darshan-parser --file-list $1| egrep -v '^(#|$)' | cut -f 1-2 | sort -n | uniq | wc -l`
18 19 20 21 22 23
rc=$?
if [ $rc -ne 0 ]; then
   exit $rc
fi

# create output file directory
24 25 26 27 28 29
mkdir $2
rc=$?
if [ $rc -ne 0 ]; then
   exit $rc
fi

30 31
# loop through all files in log
counter=0
32 33
darshan-parser --file-list $1| egrep -v '^(#|$)' | cut -f 1-2 | sort -n | uniq |
while read -r hash filepath stuff ; do
34
        counter=$((counter+1))
35 36 37
	file=$(basename $filepath)
	if [ -x $file.darshan ] ; then
		$file = $file.$hash.darshan
38
	fi
39 40
        echo Status: Generating summary for file $counter of $filecount: $file
        echo =======================================================
41
	darshan-convert --file $hash $1 $2/$file.darshan
42 43 44 45
        rc=$?
        if [ $rc -ne 0 ]; then
           exit $rc
        fi
46
	darshan-job-summary.pl $2/$file.darshan --output $2/$file.pdf
47 48 49 50
        rc=$?
        if [ $rc -ne 0 ]; then
           exit $rc
        fi
51
done 
Philip Carns's avatar
Philip Carns committed
52 53 54

echo =======================================================
echo darshan-summary-per-file.sh done.  Results can be found in $2/\*.pdf.