-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-evaluation.sh
executable file
·68 lines (59 loc) · 2.61 KB
/
run-evaluation.sh
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
# Runs the evaluation.
#
# Technically, the evaluation can be run simply by running `doit`, which will
# run all tasks associated with the evaluation. However, this is non-optimal, as
# each task requires a different amount of resources, and the evaluation run can
# be optimized by running groups of tasks with different numbers of threads.
#
# If the machine is too overloaded, we'll see odd failures, e.g. #116.
#
# The environment variables expected by this script are:
# - NUM_JOBS_VIVADO_TASKS: The number of parallel jobs to use for Vivado tasks.
# Suggestion: (nproc - buffer) / 4
# - NUM_JOBS_LAKEROAD_TASKS: The number of parallel jobs to use for Lakeroad
# tasks. Suggestion: (nproc - buffer) / 4
# - NUM_JOBS_OTHER_TASKS: The number of parallel jobs to use for all other
# tasks. Suggestion: nproc - buffer
# "buffer" is a number of cores to leave free for the OS and other tasks. I
# suggest about 10% of cores.
#
# You can also optionally set PRINT_UPTIME_INTERVAL to an interval (in seconds)
# at which to print the uptime. This is useful for performance debugging,
# to understand which parts of the evaluation are using the most resources.
set -eo pipefail
PRINT_UPTIME_INTERVAL="${PRINT_UPTIME_INTERVAL:-0}"
if [[ -z "$NUM_JOBS_VIVADO_TASKS" ]]; then
echo "Must provide NUM_JOBS_VIVADO_TASKS in environment" 1>&2
exit 1
fi
if [[ -z "$NUM_JOBS_LAKEROAD_TASKS" ]]; then
echo "Must provide NUM_JOBS_LAKEROAD_TASKS in environment" 1>&2
exit 1
fi
if [[ -z "$NUM_JOBS_OTHER_TASKS" ]]; then
echo "Must provide NUM_JOBS_OTHER_TASKS in environment" 1>&2
exit 1
fi
# Optionally track uptime. Set PRINT_UPTIME_INTERVAL to a positive number to
# enable.
if [[ -n "$PRINT_UPTIME_INTERVAL" ]] && [[ $PRINT_UPTIME_INTERVAL -gt 0 ]]; then
# Trap to kill uptime process on exit.
trap 'kill $(jobs -p)' EXIT
# Uptime process.
while true; do uptime; sleep $PRINT_UPTIME_INTERVAL; done &
fi
echo "Running Vivado tasks with ${NUM_JOBS_VIVADO_TASKS} parallel jobs."
doit --continue -n $NUM_JOBS_VIVADO_TASKS \
'robustness_experiments:*vivado'
echo "Running Lakeroad tasks with ${NUM_JOBS_LAKEROAD_TASKS} parallel jobs."
doit --continue -n $NUM_JOBS_LAKEROAD_TASKS \
'robustness_experiments:*lakeroad-xilinx' \
'robustness_experiments:*lakeroad-xilinx-7-series' \
'robustness_experiments:*lattice-ecp5-lakeroad' \
'robustness_experiments:*lakeroad_intel' \
'robustness_experiments:*lakeroad-xilinx' \
'robustness_experiments:*lattice-ecp5-lakeroad' \
'robustness_experiments:*lakeroad_intel'
echo "Running remaining tasks with ${NUM_JOBS_OTHER_TASKS} parallel jobs."
doit --continue -n $NUM_JOBS_OTHER_TASKS