darshan-summary-per-file.sh 1.31 KB
Newer Older
1
#!/bin/bash
2 3 4 5 6 7

#
# (C) 2013 by Argonne National Laboratory.
#     See COPYRIGHT in top-level directory.
#

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

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

16 17 18 19 20 21 22 23
# count number of files present in log
filecount=`darshan-parser --file-list $1| egrep -v '^(#|$)' | wc -l`
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 '^(#|$)' | 
while read -r hash suffix stuff ; do
34
        counter=$((counter+1))
35 36 37 38
	file=$(basename $suffix)
	if [ -x $file.gz ] ; then
		$file = $file.$hash.gz
	fi
39 40
        echo Status: Generating summary for file $counter of $filecount: $file
        echo =======================================================
41
	darshan-convert --file $hash $1 $2/$file.gz
42 43 44 45
        rc=$?
        if [ $rc -ne 0 ]; then
           exit $rc
        fi
46
	darshan-job-summary.pl $2/$file.gz --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.