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
|
#!/bin/bash
# Using SLURM to run the Spike regression
# p
WORKSPACE=${HOME}/local
BENGAL_TEAM_ROOT=${WORKSPACE}/bengal-team-regression
set -x
if [ -z -d "${BENGAL_TEAM_ROOT}" ]
then
mkdir -p ${HOME}/local
pushd ${HOME}/local
git clone git@github.com:sifive/bengal-team.git bengal-team-regression
pushd bengal-team-regression
git submodule update --init --recursive
pushd riscv-isa-sim
git co rvv
popd
pushd riscv-tests-internal
git co hankuan
popd
make -j
else
pushd ${BENGAL_TEAM_ROOT}
make -j
fi
ASM="${BENGAL_TEAM_ROOT}/toolchain-prefix/bin/riscv64-unknown-elf-gcc"
SPIKE="${BENGAL_TEAM_ROOT}/spike-prefix/build-spike/spike"
TEST_FRAMEWORK="${BENGAL_TEAM_ROOT}/riscv-tests-internal/vector"
cwd=$(dirname $(readlink -f "$0"))
if [ -z "${cwd}/regression.db" ]
then
sqlite3 ${cwd}/regression.db "CREATE TABLE regression \
(inx INTEGER PRIMARY KEY AUTOINCREMENT, seed TEXT, \
exp_time DATETIME, status TEXT);"
fi
if [ -z -d "${cwd}/out" ]
then
mkdir "${cwd}/out"
fi
runs=$1
if [ -z $1 ];then
runs=1
fi
function gen_job_file {
job_name=$2
job_file="$1/${job_name}.job"
echo "#!/bin/bash
#SBATCH --job-name=${job_name}.job
#SBATCH --output=${cwd}/out/${job_name}.out
#SBATCH --error=${cwd}/out/${job_name}.err
#SBATCH --time=$5
#SBATCH --mem=$4
#SBATCH --cpus-per-task=$3
#SBATCH --partition=standard
#SBATCH --mail-user=davewen@sifive.com
pushd ${target}
$6
popd
" > ${job_file}
}
for i in $(seq 1 ${runs}); do
while true; do
SEED=$RANDOM
result=$(sqlite3 ${cwd}/regression.db "SELECT 1 FROM regression \
WHERE seed = \"${SEED}\" AND status = 'init'")
if [[ -z $result ]];then
result=$(sqlite3 ${cwd}/regression.db "INSERT INTO regression(seed, \
exp_time, status) SELECT \"${SEED}\", datetime('now'), \
'init' WHERE NOT EXISTS(SELECT 1 FROM regression \
WHERE seed = \"${SEED}\")")
break
fi
done
target="${cwd}/regression/build_${SEED}"
echo $target
if [ -z -d ${target} ]
then
mkdir -p ${target}
else
rm -rf ${target}/*
fi
gen_job_file ${target} "${SEED}_conf" 1 12000 "0-00:10" "\
cmake -DCMAKE_ASM_COMPILER=\"${ASM}\" \
-DSPIKE=\"${SPIKE}\" \
-DSEED=${SEED} \
-DBASE=64 --VLEN=512 --ELEN=64 --SLEN=128 \
\"${TEST_FRAMEWORK}\""
conf_job_file=$job_file
gen_job_file ${target} "${SEED}_make" 20 12000 "0-00:20" " \
make -j20 > /dev/null \
"
make_job_file=$job_file
CONF=$(sbatch ${conf_job_file})
MAKE=$(sbatch --dependency=afterok:${CONF##* } ${make_job_file})
dep_chain=
vpat=("v[abcde]", "vf[abcdefghijkl]", "vfm", "vf[nopqr]", "vf[stuvwxyz]", \
"vl", "vs", "v[mn]", "v[opqr]", "v[tuvwxyz]")
for pat in ${vpat[*]}; do
f_name=${pat/[/}
gen_job_file ${target} "${SEED}_ctest_${fname/]//}" 1 12000 "0-00:15" " \
ctest --timeout 10 -R .*${pat}.* --ouput-log ${target}/${SEED}_${i}.log;
"
dep=$(sbatch --dependency=afterok:${MAKE##* } ${job_file})
dep_chain+=":${dep##* }"
done
gen_job_file ${target} "${SEED}_result" 1 1000 "0-00:01" " \
if grep -Fxq Failed ${target}/*.log \
then \
sqlite3 ${cwd}/regression.db "update regression set \
status=\"failed\" where seed = \"${SEED}\"" \
grep -Fxq Failed ${target}/*.log \
else \
sqlite3 ${cwd}/regression.db "update regression set \
status=\"successed\" where seed = \"${SEED}\"" \
fi \
#rm -rf ${target}
"
sbatch --dependency=afterany$dep_chain ${job_file}
break
done
|