run-all.sh 2 KB
Newer Older
1
2
3
#!/bin/bash

if [ "$#" -ne 3 ]; then
4
5
    echo "Usage: run-all.sh <darshan_install_path> <tmp_path> <platform>" 1>&2
    echo "Example: ./run-all.sh ~/darshan-install /tmp/test ws" 1>&2
6
7
8
9
10
11
12
    exit 1
fi

# set variables for use by other sub-scripts
export DARSHAN_PATH=$1
export DARSHAN_TMP=$2
export DARSHAN_PLATFORM=$3
Philip Carns's avatar
Philip Carns committed
13
14
# number of procs that most test jobs will use
export DARSHAN_DEFAULT_NPROCS=4
15

Philip Carns's avatar
Philip Carns committed
16
17
BASEDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

18
19
# check darshan path
if [ ! -x $DARSHAN_PATH/bin/darshan-parser ]; then
20
    echo "Error: $DARSHAN_PATH doesn't contain a valid Darshan install." 1>&2
21
22
23
24
25
26
27
28
29
    exit 1
fi

# check and/or create tmp path
if [ ! -d $DARSHAN_TMP ]; then
    mkdir -p $DARSHAN_TMP
fi

if [ ! -d $DARSHAN_TMP ]; then
30
    echo "Error: unable to find or create $DARSHAN_TMP" 1>&2
31
32
33
    exit 1
fi
if [ ! -w $DARSHAN_TMP ]; then
34
    echo "Error: unable to write to $DARSHAN_TMP" 1>&2
35
36
37
38
    exit 1
fi

# make sure that we have sub-scripts for the specified platform
Philip Carns's avatar
Philip Carns committed
39
if [ ! -d $BASEDIR/$DARSHAN_PLATFORM ]; then
40
    echo "Error: unable to find scripts for platform $DARSHAN_PLATFORM" 1>&2
41
42
43
    exit 1
fi

44
# set up c compiler for this platform
Philip Carns's avatar
Philip Carns committed
45
DARSHAN_CC=`$BASEDIR/$DARSHAN_PLATFORM/setup-cc.sh`
Philip Carns's avatar
Philip Carns committed
46
if [ $? -ne 0 ]; then
47
48
49
50
    exit 1
fi
export DARSHAN_CC

Philip Carns's avatar
Philip Carns committed
51
# set up c++ compiler for this platform
Philip Carns's avatar
Philip Carns committed
52
DARSHAN_CXX=`$BASEDIR/$DARSHAN_PLATFORM/setup-cxx.sh`
Philip Carns's avatar
Philip Carns committed
53
54
55
56
57
if [ $? -ne 0 ]; then
    exit 1
fi
export DARSHAN_CXX

Philip Carns's avatar
Philip Carns committed
58
# set up Fortran compilers for this platform
Philip Carns's avatar
Philip Carns committed
59
DARSHAN_F77=`$BASEDIR/$DARSHAN_PLATFORM/setup-f77.sh`
Philip Carns's avatar
Philip Carns committed
60
61
62
63
if [ $? -ne 0 ]; then
    exit 1
fi
export DARSHAN_F77
Philip Carns's avatar
Philip Carns committed
64
DARSHAN_F90=`$BASEDIR/$DARSHAN_PLATFORM/setup-f90.sh`
Philip Carns's avatar
Philip Carns committed
65
66
67
68
69
if [ $? -ne 0 ]; then
    exit 1
fi
export DARSHAN_F90

Philip Carns's avatar
Philip Carns committed
70
# set up job execution wrapper for this platform
Philip Carns's avatar
Philip Carns committed
71
DARSHAN_RUNJOB=`$BASEDIR/$DARSHAN_PLATFORM/setup-runjob.sh`
Philip Carns's avatar
Philip Carns committed
72
if [ $? -ne 0 ]; then
Philip Carns's avatar
Philip Carns committed
73
74
75
76
    exit 1
fi
export DARSHAN_RUNJOB

Philip Carns's avatar
Philip Carns committed
77
for i in `ls $BASEDIR/test-cases/*.sh`; do
Philip Carns's avatar
Philip Carns committed
78
    echo Running ${i}...
79
    $i
Philip Carns's avatar
Philip Carns committed
80
    if [ $? -ne 0 ]; then
81
82
83
        echo "Error: failed to execute test case $i"
        exit 1
    fi
Philip Carns's avatar
Philip Carns committed
84
    echo Done.
85
86
done

87
exit 0