run_one.sh 1.39 KB
Newer Older
one's avatar
one committed
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
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env bash
set -euo pipefail

mode="${1:?usage: run_one.sh hip|fastpt-C [device]}"
device="${2:-${DEVICE:-0}}"
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
root="$(cd "${script_dir}/.." && pwd)"
out_dir="${OUT_ROOT:-${root}/results}/${mode}"
build_dir="${root}/build-${mode}"

source_dtk="${root}/../source_dtk_library_path.sh"
if [[ -f "${source_dtk}" ]]; then
    # shellcheck disable=SC1091
    source "${source_dtk}"
fi

if [[ "${mode}" == "fastpt-C" ]]; then
    set +u
    # shellcheck disable=SC1091
    source /usr/local/bin/fastpt -C >/dev/null
    set -u
elif [[ "${mode}" != "hip" ]]; then
    echo "usage: run_one.sh hip|fastpt-C [device]" >&2
    exit 2
fi

if [[ ! -x "${build_dir}/bin/device_query" || ! -f "${build_dir}/lib/libguard_ext.so" ]]; then
    bash "${script_dir}/build.sh" "${mode}"
fi

mkdir -p "${out_dir}"
"${build_dir}/bin/device_query" \
    "${device}" \
    "${DEVICE_QUERY_LOOPS:-1000000}" \
    "${DEVICE_QUERY_ROUNDS:-7}" \
    "${DEVICE_QUERY_WARMUP:-10000}" \
    > "${out_dir}/device_query.csv"

python3 "${script_dir}/bench_guard.py" \
    --device "${device}" \
    --lib "${build_dir}/lib/libguard_ext.so" \
    --inner-loops "${GUARD_INNER_LOOPS:-0,1,2,4,8,16,32,64}" \
    --steps "${GUARD_STEPS:-10000}" \
    --warmup "${GUARD_WARMUP:-1000}" \
    --rounds "${GUARD_ROUNDS:-5}" \
    > "${out_dir}/guard_loop.csv"

echo "RUN_DONE,${mode},${out_dir}"