mpi-io-test.sh 1.47 KB
Newer Older
1 2
#!/bin/bash

Philip Carns's avatar
Philip Carns committed
3 4 5
PROG=mpi-io-test

# set log file path; remove previous log if present
6
export DARSHAN_LOGFILE=$DARSHAN_TMP/${PROG}.darshan
Philip Carns's avatar
Philip Carns committed
7 8 9
rm -f ${DARSHAN_LOGFILE}

# compile
Philip Carns's avatar
Philip Carns committed
10
$DARSHAN_CC $DARSHAN_TESTDIR/test-cases/src/${PROG}.c -o $DARSHAN_TMP/${PROG}
Philip Carns's avatar
Philip Carns committed
11
if [ $? -ne 0 ]; then
Philip Carns's avatar
Philip Carns committed
12 13 14 15 16 17
    echo "Error: failed to compile ${PROG}" 1>&2
    exit 1
fi

# execute
$DARSHAN_RUNJOB $DARSHAN_TMP/${PROG} -f $DARSHAN_TMP/${PROG}.tmp.dat
Philip Carns's avatar
Philip Carns committed
18
if [ $? -ne 0 ]; then
Philip Carns's avatar
Philip Carns committed
19 20 21 22 23
    echo "Error: failed to execute ${PROG}" 1>&2
    exit 1
fi

# parse log
24
$DARSHAN_PATH/bin/darshan-parser $DARSHAN_LOGFILE > $DARSHAN_TMP/${PROG}.darshan.txt
25 26 27 28
if [ $? -ne 0 ]; then
    echo "Error: failed to parse ${DARSHAN_LOGFILE}" 1>&2
    exit 1
fi
Philip Carns's avatar
Philip Carns committed
29

30 31
# check results
# in this case we want to confirm that both the MPI and POSIX open counters were triggered
32
POSIX_OPENS=`grep POSIX_OPENS $DARSHAN_TMP/${PROG}.darshan.txt |grep -vE "^#" |cut -f 5`
33
if [ ! "$POSIX_OPENS" -gt 0 ]; then
Philip Carns's avatar
Philip Carns committed
34
    echo "Error: POSIX open count of $POSIX_OPENS is incorrect" 1>&2
35 36
    exit 1
fi
37
MPI_OPENS=`grep INDEP_OPENS $DARSHAN_TMP/${PROG}.darshan.txt |grep -vE "^#" |cut -f 5`
38
if [ ! "$MPI_OPENS" -gt 0 ]; then
39 40 41
    echo "Error: MPI open count of $MPI_OPENS is incorrect" 1>&2
    exit 1
fi
Philip Carns's avatar
Philip Carns committed
42

43 44 45 46 47 48 49 50
# also, ensure that darshan-dxt-parser doesn't complain if given a log file that
# does not have DXT data present
$DARSHAN_PATH/bin/darshan-dxt-parser $DARSHAN_LOGFILE > /dev/null
if [ $? -ne 0 ]; then
    echo "Error: darshan-dxt-parser failed to handle ${DARSHAN_LOGFILE}" 1>&2
    exit 1
fi

51
exit 0