summaryrefslogtreecommitdiff
path: root/automated/linux/linpack/linpack.sh
blob: 128240b4e51838a066f4282b8620327703b072d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh -e

. ../../lib/sh-test-lib
OUTPUT="$(pwd)/output"
ARRAY_SIZE="200"
RESULT_FILE="${OUTPUT}/result.txt"
TEST_LOG="${OUTPUT}/linpack-output.txt"

usage() {
    echo "Usage: $0 [-a <array size>]" 1>&2
    exit 1
}

while getopts "a:" o; do
    case "$o" in
        a) ARRAY_SIZE="${OPTARG}" ;;
        *) usage ;;
    esac
done

create_out_dir "${OUTPUT}"

# Run Test.
info_msg "Running linpack with array size ${ARRAY_SIZE}..."
detect_abi
# shellcheck disable=SC2154
( echo "${ARRAY_SIZE}"; echo "q" ) \
  | ./bin/"${abi}"/linpack 2>&1 \
  | tee "${TEST_LOG}"

# Parse output.
echo
egrep "^ +[0-9]+ " "${TEST_LOG}" \
      | awk -v array_size="${ARRAY_SIZE}" \
        'END{printf("linpack-%s pass %s flops\n", array_size, $NF)}' \
      | tee -a "${RESULT_FILE}"