aboutsummaryrefslogtreecommitdiff
path: root/break-up-bmks.sh
blob: e87fbe14047d5291bce1cc95279de208b264be11 (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
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#!/bin/bash

# This script breaks up benchmark lists (SPEC CPU2006 and CPU2017)
# into parts to spread out across available hardware.
# It prints out one line of benchmarks per board.

set -euf -o pipefail

scripts=$(dirname "$0")/../jenkins-scripts
# shellcheck source=jenkins-helpers.sh
. $scripts/jenkins-helpers.sh

convert_args_to_variables "$@"

obligatory_variables bench_list bmk_hw n_boards run_profile
declare bench_list bmk_hw n_boards run_profile

board_selection="${board_selection-balance}"

# SPEC2006
spec2006_c_and_cxx=(
    # FOR LAURENT BRANCH TESTING
    453.povray 447.dealII
    483.xalancbmk 400.perlbench
    #400.perlbench 401.bzip2 403.gcc 429.mcf 433.milc 444.namd 445.gobmk
    #447.dealII 450.soplex 453.povray 456.hmmer 458.sjeng 462.libquantum
    #464.h264ref 470.lbm 471.omnetpp 473.astar 482.sphinx3 483.xalancbmk
)

spec2006_fortran=(
    410.bwaves 435.gromacs 436.cactusADM 454.calculix 416.gamess 434.zeusmp
    437.leslie3d 459.GemsFDTD 465.tonto 481.wrf
)

spec2006_speed=(
    400.perlbench_s 401.bzip2_s 403.gcc_s 429.mcf_s 433.milc_s 444.namd_s 445.gobmk_s
    447.dealII_s 450.soplex_s 453.povray_s 456.hmmer_s 458.sjeng_s 462.libquantum_s
    464.h264ref_s 470.lbm_s 471.omnetpp_s 473.astar_s 482.sphinx3_s 483.xalancbmk_s
    410.bwaves_s 435.gromacs_s 436.cactusADM_s 454.calculix_s 416.gamess_s 434.zeusmp_s
    437.leslie3d_s 459.GemsFDTD_s 465.tonto_s 481.wrf_s
)


spec2006_speed_nofortran=(
    400.perlbench_s 401.bzip2_s 403.gcc_s 429.mcf_s 433.milc_s 444.namd_s 445.gobmk_s
    447.dealII_s 450.soplex_s 453.povray_s 456.hmmer_s 458.sjeng_s 462.libquantum_s
    464.h264ref_s 470.lbm_s 471.omnetpp_s 473.astar_s 482.sphinx3_s 483.xalancbmk_s
)


spec2006_all=("${spec2006_c_and_cxx[@]}" "${spec2006_fortran[@]}")


# SPEC2017
spec2017_speed=(
    #-- intspeed.bset
    600.perlbench_s 602.gcc_s 605.mcf_s 620.omnetpp_s 623.xalancbmk_s
    625.x264_s 631.deepsjeng_s 641.leela_s 648.exchange2_s 657.xz_s
    #-- fpspeed.bset
    603.bwaves_s 607.cactuBSSN_s 619.lbm_s 621.wrf_s 627.cam4_s 628.pop2_s
    638.imagick_s 644.nab_s 649.fotonik3d_s 654.roms_s
)

spec2017_speed_nofortran=(
    #-- intspeed_no_fortran.bset
    600.perlbench_s 602.gcc_s 605.mcf_s 620.omnetpp_s 623.xalancbmk_s
    625.x264_s 631.deepsjeng_s 641.leela_s 657.xz_s
    #-- fppeed_no_fortran.bset
    619.lbm_s 638.imagick_s 644.nab_s
)

spec2017_rate=(
    #-- intrate.bset
    500.perlbench_r 502.gcc_r 505.mcf_r 520.omnetpp_r 523.xalancbmk_r 525.x264_r
    531.deepsjeng_r 541.leela_r 548.exchange2_r 557.xz_r
    #-- fpspeed.bset
    503.bwaves_r 507.cactuBSSN_r 508.namd_r 510.parest_r 511.povray_r 519.lbm_r
    521.wrf_r 526.blender_r 527.cam4_r 538.imagick_r 544.nab_r 549.fotonik3d_r
    554.roms_r
)

spec2017_rate_nofortran=(
    #-- intrate_no_fortran.bset
    500.perlbench_r 502.gcc_r 505.mcf_r 520.omnetpp_r 523.xalancbmk_r 525.x264_r
    531.deepsjeng_r 541.leela_r 557.xz_r
    #-- fpspeed.bset
    508.namd_r 510.parest_r 511.povray_r 519.lbm_r
    526.blender_r 538.imagick_r 544.nab_r
)


# keywords for subset of cpu2006 tests :
#    c_and_cxx, fortran, all, spec2006_speed, spec2006_speed_nofortran
# keywords for subset of cpu2017 tests :
#    spec2017_speed, spec2017_speed_nofortran, spec2017_rate, spec2017_rate_nofortran

mapfile -t bmks < <(echo "$bench_list" \
			| sed -e "s/\<c_and_cxx\>/${spec2006_c_and_cxx[*]}/g" \
			      -e "s/\<fortran\>/${spec2006_fortran[*]}/g" \
			      -e "s/\<all\>/${spec2006_all[*]}/g" \
			      -e "s/\<spec2006_speed\>/${spec2006_speed[*]}/g" \
			      -e "s/\<spec2006_speed_nofortran\>/${spec2006_speed_nofortran[*]}/g" \
			      -e "s/\<spec2017_speed\>/${spec2017_speed[*]}/g" \
			      -e "s/\<spec2017_speed_nofortran\>/${spec2017_speed_nofortran[*]}/g" \
			      -e "s/\<spec2017_rate\>/${spec2017_rate[*]}/g" \
			      -e "s/\<spec2017_rate_nofortran\>/${spec2017_rate_nofortran[*]}/g" \
			| tr " " "\n" \
			| sort -u)

if [ x"$board_selection" != x"balance" ]; then
    case "$board_selection" in
	one_board)
	    echo "${bmks[@]}"
	    ;;
	all_boards)
	    while [ $n_boards -gt 0 ]; do
		echo "${bmks[@]}"
		n_boards=$(($n_boards-1))
	    done
	    ;;
    esac
    exit
fi

get_testsuite ()
{
    local bch bmks suite
    bmks=$*

    testsuite=""
    # Which bench are we running exactly ?
    for bch in $bmks; do
	case ${bch} in
	  4[0-9][0-9].*|99[89].specrand)
             suite=cpu2006 ;;
	  5[0-9][0-9].*|6[0-9][0-9].*|99[6789].specrand_[fi][rs])
             suite=cpu2017 ;;
	  coremark)
             suite=coremark ;;
	  *)
             echo "ERROR: Option benchmark $bch not recognized"
             exit 1
	esac
	if [ -z "$testsuite" ]; then
	  testsuite=$suite
	elif [ "$testsuite" != "$suite" ]; then
	echo ERROR: Option --bench cannot mix benches tests within a single run.
	exit 1
      fi
    done
}

get_testsuite "${bmks[@]}"

n_cores=1 # e.g., stm32
case "$bmk_hw:$testsuite" in
    apm:*) n_cores=8 ;;
    sq:cpu2006) n_cores=24 ;;
    sq:cpu2017) n_cores=10 ;;
    tk1:*) n_cores=4 ;;
    tx1:*) n_cores=4 ;;
    fx:cpu2006)  n_cores=20 ;;
    fx:cpu2017)  n_cores=4 ;;
esac
case "$run_profile" in
    "serial") n_cores=1 ;;
esac

while [ ${#bmks[@]} -ge 1 ]; do
    # Number of jobs needed for benchmarking
    n_jobs=$(((${#bmks[@]} + $n_cores - 1) / $n_cores))
    if [ $n_jobs -gt $n_boards ]; then
	n_jobs=$n_boards
    fi

    # Number of benchmarks per job
    N=$(((${#bmks[@]} + $n_jobs - 1) / $n_jobs))

    echo "${bmks[@]:0:$N}"
    bmks=("${bmks[@]:$N}")
    n_boards=$(($n_boards-1))
done