-
Notifications
You must be signed in to change notification settings - Fork 16
/
.gitlab-ci.yml
304 lines (293 loc) · 8.58 KB
/
.gitlab-ci.yml
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
variables:
NUCLEI_SDK: git@gito:software/library/nuclei-sdk.git
SDK_BRANCH: develop
SOC: evalsoc
RUNTARGET: qemu
IMAGE: rego.corp.nucleisys.com/software/sdkbuild
IMAGE_TAG: "2024.06"
default:
tags:
- env::docker
- net::outside
image: $IMAGE:$IMAGE_TAG
before_script:
- free -g
- uname -a
- lscpu
after_script:
- free -g
- ps aux | grep qemu
stages:
- build
- test
- release
build_doc:
stage: build
interruptible: true
retry: 1
only:
refs:
- master
- develop
- /^feature\/.*/
- merge_requests
changes:
- NMSIS/doc/source/**/**/**/*
- .gitlab-ci.yml
- NMSIS/Core/
- NMSIS/DSP/
- NMSIS/NN/
artifacts:
when: always
name: "nmsis_doc-job${CI_JOB_ID}-${CI_COMMIT_SHA::8}"
paths:
- NMSIS/doc/build
expire_in: 2 day
before_script:
- apt update
- apt install -y doxygen python3 make latexmk texlive-base texlive-latex-extra python3-pip
- pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
- pip3 install -r NMSIS/doc/requirements.txt
script:
- cd NMSIS/doc
- make clean
- mkdir build
- make all > build/build.log 2>&1
- make latexpdf >> build/build.log 2>&1
- make clean_xml
- cp build/latex/*.pdf build/html/
build_library:
stage: build
interruptible: true
retry: 1
only:
refs:
- master
- develop
- /^feature\/.*/
- merge_requests
artifacts:
when: always
name: "nmsis_library-job${CI_JOB_ID}-${CI_COMMIT_SHA::8}"
paths:
- NMSIS/gen
- NMSIS/build/*/*/build.log
expire_in: 2 day
variables:
PARALLEL_OPTS: "-j8"
script:
- apt update
- apt install -y python3 python3-pip
- pip3 install prettytable
- cd NMSIS
- echo "Generate NMSIS Library for Nuclei RISC-V Processors"
- make gen | grep -E "^Build\ Library|^\+|^\|"
- buildsts=${PIPESTATUS[0]}
- mkdir -p gen/
- mv Library gen/
- exit $buildsts
build_align_library:
stage: build
interruptible: true
retry: 1
only:
refs:
- master
- develop
- /^feature\/.*/
- merge_requests
artifacts:
when: always
name: "nmsis_align_library-job${CI_JOB_ID}-${CI_COMMIT_SHA::8}"
paths:
- NMSIS/Library
- NMSIS/build.log
expire_in: 2 day
script:
- apt update
- apt install -y python3 python3-pip
- pip3 install prettytable
- cd NMSIS
- echo "Generate NMSIS Library(Memory access without unalign R/W) for Nuclei RISC-V Processors"
- make gen_unalign > build.log 2>&1
.test_job_template: &test_job_template_default
stage: test
timeout: 4h
interruptible: true
only:
refs:
- master
- develop
- /^feature\/.*/
- merge_requests
before_script:
- free -g
- uname -a
- lscpu
# prepare for docker ssh environment
## https://docs.gitlab.com/ee/ci/ssh_keys/#ssh-keys-when-using-the-docker-executor
- apt update
- command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )
- eval $(ssh-agent -s)
- mkdir -p ~/.ssh
- chmod 700 ~/.
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
# important: need to avoid git ssh asking yes/no when clone
# https://serverfault.com/questions/469052/ssh-failing-from-script-working-on-command-line-git
- ssh-keyscan gito > ~/.ssh/known_hosts
- apt install -y python3 python3-pip
- pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
- python3 -m pip install --upgrade pip
- pip3 install prettytable==2.1.0 psutil==5.8.0 pyserial==3.5 markdown
- export SDK_COPY_OBJECTS="elf,map"
dependencies:
- build_library
test_nn_library:
<<: *test_job_template_default
artifacts:
when: always
name: "nmsis_nn_test_cycles_logs-job${CI_JOB_ID}-${CI_COMMIT_SHA::8}"
paths:
- log_nmsis_*.zip
- NMSIS/Logs
expire_in: 2 day
parallel:
matrix:
- NUCLEI_DSP: ["rv32_NO", "rv64_NO", "N1", "N2", "N3"]
script:
- git clone -b $SDK_BRANCH $NUCLEI_SDK NMSIS/nuclei_sdk
- export NUCLEI_SDK_ROOT=$(readlink -f NMSIS/nuclei_sdk)
- pip3 install -r $NUCLEI_SDK_ROOT/tools/scripts/requirements.txt
- export NUCLEI_SDK_NMSIS=$(readlink -f NMSIS)
- export NMSIS_LOGS=$NUCLEI_SDK_NMSIS/Logs
# change ilm/dlm size from 64K to 1M for ${SOC}
- sed -i "s/64K/1M/g" $NUCLEI_SDK_ROOT/SoC/${SOC}/Board/nuclei_fpga_eval/Source/GCC/gcc_${SOC}_ilm.ld
# change ilm/dlm size from 64K to 1M for evalsoc from Nuclei SDK 0.6.0
- |
EVALSOC_MEMORY=$NUCLEI_SDK_ROOT/SoC/evalsoc/Board/nuclei_fpga_eval/Source/GCC/evalsoc.memory
if [ -f $EVALSOC_MEMORY ] ; then
echo "Maybe you are using >= Nuclei SDK 0.6.0, will sed and replace ilm/dlm memory size in $EVALSOC_MEMORY"
sed -i 's/\([ID]LM_MEMORY_SIZE\).*/\1 = 0x100000;/' $EVALSOC_MEMORY
fi
- mkdir $NMSIS_LOGS
- source NMSIS/env.sh
- export SILENT=1
- cd NMSIS
- rm -rf Library
- ln -s gen/Library .
- make gen_nnref_lib
- export SDK_VERB_BUILDMSG=0
- python3 $NUCLEI_SDK_ROOT/tools/scripts/nsdk_cli/nsdk_bench.py --appcfg Scripts/Runner/nmsis_nn_${NUCLEI_DSP}.json --logdir $NMSIS_LOGS/${NUCLEI_DSP}/nmsis_nn --parallel=-j --make_options "SIMU=$RUNTARGET" --run_target $RUNTARGET --run
# zip logs
- cd -
- zip -q -r log_nmsis_nn_${NUCLEI_DSP}.zip NMSIS/Logs
- rm -rf NMSIS/Logs
test_dsp_library:
<<: *test_job_template_default
artifacts:
when: always
name: "nmsis_dsp_test_cycles_logs-job${CI_JOB_ID}-${CI_COMMIT_SHA::8}"
paths:
- log_nmsis_*.zip
- NMSIS/Logs
expire_in: 2 day
parallel:
matrix:
- NUCLEI_DSP: ["rv32_NO", "rv64_NO", "N1", "N2", "N3", "f16"]
script:
- git clone -b $SDK_BRANCH $NUCLEI_SDK NMSIS/nuclei_sdk
- export NUCLEI_SDK_ROOT=$(readlink -f NMSIS/nuclei_sdk)
- pip3 install -r $NUCLEI_SDK_ROOT/tools/scripts/requirements.txt
- export NUCLEI_SDK_NMSIS=$(readlink -f NMSIS)
- export NMSIS_LOGS=$NUCLEI_SDK_NMSIS/Logs
# change ilm/dlm size from 64K to 1M for ${SOC}
- sed -i "s/64K/1M/g" $NUCLEI_SDK_ROOT/SoC/${SOC}/Board/nuclei_fpga_eval/Source/GCC/gcc_${SOC}_ilm.ld
# change ilm/dlm size from 64K to 1M for evalsoc from Nuclei SDK 0.6.0
- |
EVALSOC_MEMORY=$NUCLEI_SDK_ROOT/SoC/evalsoc/Board/nuclei_fpga_eval/Source/GCC/evalsoc.memory
if [ -f $EVALSOC_MEMORY ] ; then
echo "Maybe you are using >= Nuclei SDK 0.6.0, will sed and replace ilm/dlm memory size in $EVALSOC_MEMORY"
sed -i 's/\([ID]LM_MEMORY_SIZE\).*/\1 = 0x100000;/' $EVALSOC_MEMORY
fi
- mkdir $NMSIS_LOGS
- source NMSIS/env.sh
- export SILENT=1
- cd NMSIS
- rm -rf Library
- ln -s gen/Library .
- export SDK_VERB_BUILDMSG=0
- python3 $NUCLEI_SDK_ROOT/tools/scripts/nsdk_cli/nsdk_bench.py --appcfg Scripts/Runner/nmsis_dsp_${NUCLEI_DSP}.json --logdir $NMSIS_LOGS/${NUCLEI_DSP}/nmsis_dsp --parallel=-j --make_options "SIMU=$RUNTARGET" --run_target $RUNTARGET --run
# zip logs
- cd -
- zip -q -r log_nmsis_dsp_${NUCLEI_DSP}.zip NMSIS/Logs
- rm -rf NMSIS/Logs
release_benchmark:
stage: release
interruptible: true
only:
refs:
- master
- develop
- /^feature\/.*/
- merge_requests
artifacts:
name: "nmsis_test_logs-job${CI_JOB_ID}-${CI_COMMIT_SHA::8}"
paths:
- log_nmsis.zip
expire_in: 2 day
dependencies:
- test_nn_library
- test_dsp_library
script:
# unzip all log_nmsis_*.zip files
- for zf in `find . -name "log_nmsis*.zip"` ; do unzip -qo $zf ; done
- ls -lh NMSIS/Logs
- rm -f log_nmsis_*.zip
- zip -q -r log_nmsis.zip NMSIS/Logs
release_nmsis:
stage: release
interruptible: true
only:
refs:
- master
- develop
- /^feature\/.*/
- merge_requests
artifacts:
name: "nmsis_release-$job${CI_JOB_ID}-{CI_COMMIT_SHA::8}"
paths:
- NMSIS/Core
- NMSIS/DSP/Include
- NMSIS/DSP/PrivateInclude
- NMSIS/NN/Include
- NMSIS/Library
- NMSIS/npk.yml
- NMSIS/build.mk
expire_in: 2 day
dependencies:
- build_library
script:
- ls -lh NMSIS/gen/
# choose proper built library to release
- rm -rf NMSIS/Library
- mv NMSIS/gen/Library NMSIS/
- ls -lh NMSIS/Library
- cat NMSIS/npk.yml
deploy_website:
stage: release
only:
refs:
- master
changes:
- NMSIS/doc/source/**/**/**/*
- .gitlab-ci.yml
- NMSIS/Core/
- NMSIS/DSP/
- NMSIS/NN/
dependencies:
- build_doc
tags:
- env::shell
- host::whss1
script:
- ./.ci/ftp_deploy.sh $FTPUSER $FTPPWD $FTPSERVER NMSIS/doc/build/html nmsis