-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy path.gitlab-ci.yml
267 lines (257 loc) · 10.2 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
# used by our internal gitlab server
stages:
- prepare
- build
- test
- deploy
prepare:aten:merged:
stage: prepare
before_script:
- git config --global user.email '[email protected]'
- git config --global user.name 'Giovanni'
script:
- git clone -b fragcolor-devel https://[email protected]/fragcolor-xyz/pytorch.git
- cd pytorch
- git remote add upstream https://github.com/pytorch/pytorch.git
- git pull upstream master --no-edit
- git push
- git rev-parse HEAD > ../torch/commit.txt
- date +%Y.%m.%d.$CI_PIPELINE_ID > ../docker/version.txt
artifacts:
paths:
- torch/commit.txt
- docker/version.txt
tags:
- LINUX
only:
refs:
- schedules
variables:
- $FETCH_PYTORCH == "true"
prepare:aten:fast:
stage: prepare
before_script:
- git config --global user.email '[email protected]'
- git config --global user.name 'Giovanni'
script:
- git clone -b fragcolor-devel https://[email protected]/fragcolor-xyz/pytorch.git
- cd pytorch
- git rev-parse HEAD > ../torch/commit.txt
- date +%Y.%m.%d.$CI_PIPELINE_ID > ../docker/version.txt
artifacts:
paths:
- torch/commit.txt
- docker/version.txt
tags:
- LINUX
only:
refs:
- schedules
variables:
- $FETCH_PYTORCH == "false"
build:aten:cuda10.0:
stage: build
script:
# Clean up docker - make sure we got space
- docker rm $(docker ps -q -f status=exited) || true
- docker volume rm $(docker volume ls -qf dangling=true) || true
- docker rmi $(docker images --filter "dangling=true" -q --no-trunc) || true
# Build
- cd docker
- sed -i -r "s/const version\* = "'"'"[12][0-9]{3}.[01][0-9].[0-3][0-9].[0-9]+"'"'"/const version* = "'"'"`cat version.txt`"'"'"/g" ../torch/torch_cpp.nim
- sed -i -r "s/[12][0-9]{3}.[01][0-9].[0-3][0-9].[0-9]+/`cat version.txt`/g" conda/aten/meta.yaml
- sed -i -r "s/[12][0-9]{3}.[01][0-9].[0-3][0-9].[0-9]+/`cat version.txt`/g" conda/aten_lite/meta.yaml
- sed -i -r "s/[12][0-9]{3}.[01][0-9].[0-3][0-9].[0-9]+/`cat version.txt`/g" conda/aten_static/meta.yaml
- sed -i -r "s/[12][0-9]{3}.[01][0-9].[0-3][0-9].[0-9]+/`cat version.txt`/g" conda/aten_wasm/meta.yaml
- sed -i -r "s/[12][0-9]{3}.[01][0-9].[0-3][0-9].[0-9]+/`cat version.txt`/g" ../conda/nimtorch/meta.yaml # always needed by the next step
- docker pull nvidia/cuda:10.0-devel-ubuntu18.04
- docker build -f Dockerfile-aten-cuda10.0 -t docker_aten_cuda10 --build-arg TOKEN=$CONDA_TOKEN --build-arg PYTORCH_COMMIT=`cat ../torch/commit.txt` .
dependencies:
- prepare:aten:merged
- prepare:aten:fast
artifacts:
paths:
# Notice files from docker won't be passed, specially cos Docker in Docker
- torch/commit.txt
- torch/torch_cpp.nim
- docker/version.txt
- docker/conda/aten/meta.yaml
- docker/conda/aten_lite/meta.yaml
- docker/conda/aten_static/meta.yaml
- docker/conda/aten_wasm/meta.yaml
- conda/nimtorch/meta.yaml
tags:
- LINUX, DOCKER
only:
refs:
- schedules
variables:
- $BUILD_PYTORCH == "true"
build:aten:wasm:
stage: build
script:
# Clean up docker - make sure we got space
- docker rm $(docker ps -q -f status=exited) || true
- docker volume rm $(docker volume ls -qf dangling=true) || true
- docker rmi $(docker images --filter "dangling=true" -q --no-trunc) || true
# Build
- cd docker
- sed -i -r "s/[12][0-9]{3}.[01][0-9].[0-3][0-9].[0-9]+/`cat version.txt`/g" conda/aten_wasm/meta.yaml
- sed -i -r "s/[12][0-9]{3}.[01][0-9].[0-3][0-9].[0-9]+/`cat version.txt`/g" ../conda/nimtorch/meta.yaml # always needed by the next step
- docker pull archlinux/base:latest
- docker build -f Dockerfile-aten-wasm -t docker_aten_wasm --build-arg TOKEN=$CONDA_TOKEN --build-arg PYTORCH_COMMIT=`cat ../torch/commit.txt` .
dependencies:
- prepare:aten:merged
- prepare:aten:fast
artifacts:
paths:
- conda/nimtorch/meta.yaml # only this is needed for wasm build
tags:
- LINUX, DOCKER
only:
refs:
- schedules
variables:
- $BUILD_PYTORCH == "true"
build:aten:macos:
stage: build
# cache:
# key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
# untracked: true
# paths:
# - pytorch/
before_script:
- conda env remove -n aten_build || true
script:
- conda create -n aten_build mkl mkl-include intel-openmp
- source activate aten_build
- export LDFLAGS="-L$CONDA_PREFIX/lib"
# Fix up versions
- export PYTORCH_COMMIT=`cat torch/commit.txt`
- sed -E -i bak "s/const version\* = "'"'"[12][0-9]{3}.[01][0-9].[0-3][0-9].[0-9]+"'"'"/const version* = "'"'"`cat docker/version.txt`"'"'"/g" torch/torch_cpp.nim
- sed -E -i bak "s/[12][0-9]{3}.[01][0-9].[0-3][0-9].[0-9]+/`cat docker/version.txt`/g" docker/conda/aten/meta.yaml
- sed -E -i bak "s/[12][0-9]{3}.[01][0-9].[0-3][0-9].[0-9]+/`cat docker/version.txt`/g" conda/nimtorch/meta.yaml # always needed by the next step
# Use cache
- export MACOSX_DEPLOYMENT_TARGET=10.13
- export PYTORCH=https://github.com/fragcolor-xyz/pytorch.git
- git clone -b fragcolor-devel "$PYTORCH" "pytorch" 2> /dev/null || (cd "pytorch"; git reset --hard HEAD; git clean -x -d -f; git pull)
- cd pytorch
- git reset --hard $PYTORCH_COMMIT
- git submodule update --init --recursive
- mkdir built || true
- cd built
- cmake -DPYTHON_EXECUTABLE=python -DCMAKE_C_COMPILER=/usr/local/opt/llvm/bin/clang -DCMAKE_CXX_COMPILER=/usr/local/opt/llvm/bin/clang++ -DCMAKE_INCLUDE_PATH=$CONDA_PREFIX/include -DCMAKE_LIBRARY_PATH=$CONDA_PREFIX/lib -DUSE_MKLDNN=OFF -DBLAS=MKL -DUSE_OPENMP=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_ATEN_ONLY=ON -DHAS_GCC_ATOMICS=ON -DCMAKE_INSTALL_PREFIX=`pwd`/output ../
- make -j 4
- make install
- make clean
- cp ../tools/autograd/derivatives.yaml `pwd`/output/share/
- cd ../..
- export ATEN=`pwd`/pytorch/built/output
- cd docker/conda
- conda build purge-all
- conda build aten
- anaconda -t $CONDA_TOKEN upload ~/miniconda3/conda-bld/osx-64/aten-*.tar.bz2
after_script:
- conda clean --all
- conda env remove -n aten_build || true
dependencies:
- prepare:aten:merged
- prepare:aten:fast
artifacts:
paths:
- conda/nimtorch/meta.yaml
- torch/torch_cpp.nim
tags:
- MACOS, CMAKE, PYTHON, PYYAML, CONDA, BREWLLVM
only:
refs:
- schedules
variables:
- $BUILD_PYTORCH == "true"
test:nimtorch:native:
stage: test
script:
- docker build -f docker/Dockerfile-tests-cuda10.0 -t nimtorch-test-cuda10.0 --build-arg USER_ID=`id -u` --build-arg GROUP_ID=`id -g` --build-arg ATEN=`cat conda/nimtorch/meta.yaml | grep -o "aten ==[12][0-9]*.[01][0-9]*.[0-3][0-9]*.[0-9]*" | sed -r "s/aten /aten/g"` .
- docker run --name test_nimtorch_native -t -u`id -u`:`id -g` nimtorch-test-cuda10.0:latest nimble test
- docker run --rm -t -u`id -u`:`id -g` nimtorch-test-cuda10.0:latest nimble test_clang
- docker run --runtime=nvidia --rm -t -u`id -u`:`id -g` nimtorch-test-cuda10.0:latest nimble test_cuda
- docker run --runtime=nvidia --rm -t -u`id -u`:`id -g` nimtorch-test-cuda10.0:latest nimble test_clang_cuda
- docker cp test_nimtorch_native:/home/tester/nimtorch/torch `pwd`/
after_script:
- git clean -x -d -f
- docker stop test_nimtorch_native || true
- docker rm test_nimtorch_native || true
dependencies:
- build:aten:cuda10.0
artifacts:
paths:
- torch/
- conda/
- docker/
tags:
- LINUX, DOCKER, DOCKERNVIDIA
test:nimtorch:wasm:
stage: test
script:
- docker build -f docker/Dockerfile-tests-wasm -t nimtorch-test-wasm --build-arg USER_ID=`id -u` --build-arg GROUP_ID=`id -g` --build-arg ATEN=`cat conda/nimtorch/meta.yaml | grep -o "aten ==[12][0-9]*.[01][0-9]*.[0-3][0-9]*.[0-9]*" | sed -r "s/aten /aten/g"` .
- docker run --rm -t -u`id -u`:`id -g` nimtorch-test-wasm:latest /bin/bash -c "source /etc/profile.d/emscripten.sh && nimble test_wasm"
after_script:
- git clean -x -d -f
dependencies:
- build:aten:wasm
tags:
- LINUX, DOCKER
only:
refs:
- schedules
variables:
- $BUILD_PYTORCH == "true"
test:nimtorch:macos:
stage: test
before_script:
- conda env remove -n nimtorch_testing || true
script:
- export MACOSX_DEPLOYMENT_TARGET=10.13
- conda create -n nimtorch_testing -c fragcolor nim=0.19.9.1 fragments=0.1.27 `cat conda/nimtorch/meta.yaml | grep -o "aten ==[12][0-9]*.[01][0-9]*.[0-3][0-9]*.[0-9]*" | sed -E "s/aten /aten/g"`
- export ATEN=$HOME/miniconda3/envs/nimtorch_testing
- export PATH="$PATH:$HOME/miniconda3/envs/nimtorch_testing/bin"
- nimble test
after_script:
# Recycle space - should keep latest pkg on branch
- conda clean -y --all
dependencies:
- build:aten:macos
tags:
- MACOS, CMAKE, PYTHON, PYYAML, CONDA
deploy:nimtorch:
stage: deploy
before_script:
- git config --global user.email '[email protected]'
- git config --global user.name 'Giovanni'
script:
# Merge on current branch
- git stash
- git checkout $CI_COMMIT_REF_NAME
- git reset --hard origin/$CI_COMMIT_REF_NAME
- git stash pop || true # allow failure
# Check and notify diffs after generator.nim
- sh scripts/diffcheck.sh
# Commit and push on this branch
- git commit --allow-empty -a -m "PyTorch upstream nightly success"
- git push ssh://[email protected]:27030/fragcolor/nimtorch.git $CI_COMMIT_REF_NAME
# Merge master on release
- git checkout release
- git reset --hard origin/release
- git merge master
- git push ssh://[email protected]:27030/fragcolor/nimtorch.git release
# Also push release on github
- git push https://[email protected]/fragcolor-xyz/nimtorch.git release
# Finally trigger conda automations, aka: windows and macOS release builds
- curl -X POST -F token=$TRIGGER_TOKEN -F "ref=$CI_COMMIT_REF_NAME" -F "variables[TRIGGER]=CondaDeploy" -F "variables[PYTORCH_COMMIT]=`cat torch/commit.txt`" -F "variables[NIMTORCH_COMMIT]=`git rev-parse HEAD`" https://git.fragcolor.xyz/api/v4/projects/32/trigger/pipeline
dependencies:
- test:nimtorch:native
tags:
- DEPLOY
only:
refs:
- schedules