forked from stefanos1316/ICSE_2022_artifact
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_and_configure.yml
executable file
·371 lines (328 loc) · 13.3 KB
/
install_and_configure.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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
---
- hosts: localhost
gather_facts: false
tasks:
- name: Download apt key
get_url:
url: https://packages.cloud.google.com/apt/doc/apt-key.gpg
dest: /tmp # or /etc/pki/rpm-gpg depending on the infrastructure
- name: Add a key from a file
ansible.builtin.apt_key:
file: /tmp/apt-key.gpg
state: present
- name: Set up cuda key
tags: experiment
shell: |
sudo apt-key del 7fa2af80
sudo wget https://developer.download.nvidia.com/compute/cuda/repos/$distro/$arch/cuda-keyring_1.0-1_all.deb
sudo -i cuda-keyring_1.0-1_all.deb
- name: Update the apt package index
tags: experiment
become: yes
apt:
name: "*"
state: latest
update_cache: yes
force_apt_get: yes
- name: install required modules
tags: experiment
become: true
apt:
name: ['git', 'apt-transport-https', 'ca-certificates', 'wget', 'software-properties-common', 'gnupg2', 'curl', 'make', 'gcc', 'autoconf', 'automake', 'libtool', 'g++', 'protobuf-compiler', 'python3-pip']
- name: Install Pillow for Python3
tags: experiment
pip:
name: Pillow
executable: pip3
- name: Install TensorFlow for Python3
tags: experiment
pip:
name: TensorFlow
executable: pip3
- name: Install pycocotools for Python3
tags: experiment
pip:
name: pycocotools
executable: pip3
- name: Install pandas for Python3
tags: experiment
pip:
name: pandas
executable: pip3
- name: enable sudoless invocation for perf
tags: experiment
become: true
shell: |
sh -c echo -1 >/proc/sys/kernel/perf_event_paranoid
sysctl -w kernel.perf_event_paranoid=-1
- name: add apt signing key from official docker repo
tags: experiment
become: true
apt_key:
url: https://download.docker.com/linux/debian/gpg
state: present
- name: add docker official repository for Debian Stretch
tags: experiment
become: true
apt_repository:
repo: deb [arch=amd64] https://download.docker.com/linux/debian stretch stable
state: present
- name: Index new repo into the cache
tags: experiment
become: yes
apt:
name: "*"
state: latest
update_cache: yes
force_apt_get: yes
- name: install docker
tags: experiment
become: true
apt:
name: "docker-ce"
state: latest
- name: ensure docker deamon is running
tags: experiment
become: yes
service:
name: docker
state: started
- name: add user to docker group
tags: experiment
become: yes
shell: |
groupadd docker
usermod -aG docker {{ user }}
- name: define variable for nvidia-docker
tags: experiment
stat:
path: ./nvidia-docker
register: nvidiadocker
- name: clone and install nvidia-docker
tags: experiment
when: not nvidiadocker.stat.exists
become: true
become_user: "{{ user }}"
shell: |
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
&& curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
&& curl -s -L https://nvidia.github.io/libnvidia-container/experimental/$distribution/libnvidia-container.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
cd nvidia-docker
make
- name: clone and install nvidia-smi 470
tags: experiment
when: not nvidiadocker.stat.exists
become: true
become_user: "{{ user }}"
shell: |
apt-get purge nvidia-*
apt-get update
apt-get autoremove
apt install libnvidia-common-470
apt install libnvidia-gl-470
apt install nvidia-driver-470
cd nvidia-docker
make
- name: define variable for DeepLearningExamples
tags: experiment
stat:
path: ./DeepLearningExamples
register: deep_learning_examples
- name: clone repo DeepLearningExamples
tags: experiment
when: not deep_learning_examples.stat.exists
become: true
become_user: "{{ user }}"
shell: git clone https://github.com/NVIDIA/DeepLearningExamples.git
# Build and configure Transformer-XL (Pytroch)
- name: download data-set and build docker image for Pytorch's Transformer-XL
tags: experiment
become: true
become_user: "{{ user }}"
shell: |
cp configs/pytorch_transformer_to_wt103_base.yml DeepLearningExamples/PyTorch/LanguageModeling/Transformer-XL/pytorch/wt103_base.yaml
cd DeepLearningExamples/PyTorch/LanguageModeling/Transformer-XL
mkdir data || echo Already exists
cd data
wget --continue https://s3.amazonaws.com/research.metamind.io/wikitext/wikitext-103-v1.zip
unzip -q wikitext-103-v1.zip
cd wikitext-103
mv wiki.train.tokens train.txt
mv wiki.valid.tokens valid.txt
mv wiki.test.tokens test.txt
cd ../..
rm data/wikitext-103-v1.zip
register: transformer_pytorch_output
- debug:
msg: "{{ transformer_pytorch_output.stdout_lines|list }}"
tags: experiment
# Build, configure, and generate train data-set corpuse.json for Transformer-XL (Tensorflow)
- name: download data-set and build docker image for TensorFlow's Transformer-XL
tags: experiment
become: true
become_user: "{{ user }}"
shell: |
cp configs/tensorflow_transformer_to_run_wt103_base.sh DeepLearningExamples/TensorFlow/LanguageModeling/Transformer-XL/tf/run_wt103_base.sh
cd DeepLearningExamples/TensorFlow/LanguageModeling/Transformer-XL
mkdir data || echo Already exist
cd data
wget --continue https://s3.amazonaws.com/research.metamind.io/wikitext/wikitext-103-v1.zip
unzip -q wikitext-103-v1.zip
cd wikitext-103
mv wiki.train.tokens train.txt
mv wiki.valid.tokens valid.txt
mv wiki.test.tokens test.txt
cd ../..
rm data/wikitext-103-v1.zip
bash tf/scripts/docker/build.sh
docker run --tty --rm --gpus 1 --init --network=host --ipc=host -v $PWD:/workspace/transformer-xl transformer-xl bash run_wt103_base.sh train_data --batch_chunk 32 --train_batch_size 16
register: transformer_tensorflow_output
- debug:
msg: "{{ transformer_tensorflow_output.stdout_lines|list }}"
tags: experiment
# Build and configure GNMT (Pytroch)
- name: download data-set and build docker image for Pytorch's GNMT
tags: experiment
become: true
become_user: "{{ user }}"
shell: |
cp configs/pytorch_gnmt_to_be_renamed_as_train.py DeepLearningExamples/PyTorch/Translation/GNMT/train.py
cd DeepLearningExamples/PyTorch/Translation/GNMT
bash scripts/docker/build.sh
docker run \
--gpus 1 \
--init --tty --rm \
--network=host \
--ipc=host \
-v $PWD:/workspace/gnmt/ \
gnmt bash scripts/wmt16_en_de.sh \
register: gnmt_tensorflow_output
- debug:
msg: "{{gnmt_tensorflow_output.stdout_lines|list }}"
tags: experiment
# Build and configure NCF (Pytroch)
- name: download data-set and build docker image for Pytorch's NCF
tags: experiment
become: true
become_user: "{{ user }}"
shell: |
cp configs/pytorch_ncf_to_be_renamed_as_ncf.py DeepLearningExamples/PyTorch/Recommendation/NCF/ncf.py
cd DeepLearningExamples/PyTorch/Recommendation/NCF
rm -rf data || echo data dir not found
mkdir data
curl http://files.grouplens.org/datasets/movielens/ml-20m.zip --output ./data/ml-20m.zip && ./prepare_dataset.sh ml-20m data
register: ncf_pytorch_output
- debug:
msg: "{{ ncf_pytorch_output.stdout_lines|list }}"
tags: experiment
# Build and configure NCF (TensorFlow)
- name: download data-set and build docker image for TensorFlow's NCF
tags: experiment
become: true
become_user: "{{ user }}"
shell: |
cp configs/tensorflow_ncf_to_be_renamed_as_ncf.py DeepLearningExamples/TensorFlow/Recommendation/NCF/ncf.py
cd DeepLearningExamples/TensorFlow/Recommendation/NCF
rm -rf data || echo data dir not ounf
mkdir data
curl http://files.grouplens.org/datasets/movielens/ml-20m.zip --output ./data/ml-20m.zip && ./prepare_dataset.sh ml-20m data
register: ncf_tensorflow_output
- debug:
msg: "{{ ncf_tensorflow_output.stdout_lines|list }}"
tags: experiment
# Build and configure SSD (PyTorch)
- name: download dataset and build docker image for PyTorch's SSD
tags: experiment
become: true
become_user: "{{ user }}"
shell: |
cp configs/pytorch_ssd_SSD300_FP16_1GPU.sh DeepLearningExamples/PyTorch/Detection/SSD/examples/SSD300_FP16_1GPU.sh
cd DeepLearningExamples/PyTorch/Detection/SSD
mkdir coco2017 || echo Already exists
bash download_dataset.sh ./coco2017
register: ssd_pytorch_output
- debug:
msg: "{{ ssd_pytorch_output.stdout_lines|list }}"
tags: experiment
# Build and configure SSD (TensorFlow)
- name: download dataset and build docker image for TensorFlows's SSD
tags: experiment
become: true
become_user: "{{ user }}"
shell: |
cp configs/tensorflow_ssd_ssd320_full_1gpus.config DeepLearningExamples/TensorFlow/Detection/SSD/configs/ssd320_full_1gpus.config
cp configs/tensorflow_ssd_SSD320_FP16_1GPU.sh DeepLearningExamples/TensorFlow/Detection/SSD/examples/SSD320_FP16_1GPU.sh
cd DeepLearningExamples/TensorFlow/Detection/SSD
rm -rf coco2017 checkpoints || echo dirs not found
mkdir coco2017 checkpoints
sed -i 's/COPY\ qa\/\ qa\///g' Dockerfile
docker build . -t nvidia_ssd
bash download_all.sh nvidia_ssd $PWD/coco2017 $PWD/checkpoints
register: ssd_tensorflow_output
- debug:
msg: "{{ ssd_tensorflow_output.stdout_lines|list }}"
tags: experiment
# Build and configure MaskRCNN (PyTorch)
- name: download dataset and build docker image for PyTorch's MaskRCNN
tags: experiment
become: true
become_user: "{{ user }}"
shell: |
cp configs/pytorch_mask_r_cnn_e2e_mask_rcnn_R_50_FPN_1x_1GPU.yaml DeepLearningExamples/PyTorch/Segmentation/MaskRCNN/pytorch/configs
cp configs/pytorch_mask_r_cnn_paths_catalog.py DeepLearningExamples/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/config/paths_catalog.py
cd DeepLearningExamples/PyTorch/Segmentation/MaskRCNN
cp -r ../../Detection/SSD/coco2017 ./data
register: maskrcnn_pytorch_output
- debug:
msg: "{{ maskrcnn_pytorch_output.stdout_lines|list }}"
tags: experiment
# Build and configure MaskRCNN (TensorFlow)
- name: download dataset and build docker image for TensorFlows's MaskRCNN
tags: experiment
become: true
become_user: "{{ user }}"
shell: |
cd DeepLearningExamples/TensorFlow2/Segmentation/MaskRCNN
cd dataset
sed -i 's/python\ \$SCRIPT_DIR/python3\ \$SCRIPT_DIR/g' download_and_preprocess_coco.sh
bash download_and_preprocess_coco.sh ./data
cd ..
python scripts/download_weights.py --save_dir=./weights
register: maskrcnn_tensorflow_output
- debug:
msg: "{{ maskrcnn_tensorflow_output.stdout_lines|list }}"
tags: experiment
# Build and configure ResNet50 (PyTorch)
- name: download dataset and build docker image for PyTorch's ResNet50
tags: experiment
become: true
become_user: "{{ user }}"
shell: |
cp configs/pytorch_rn50_DGX1V_resnet50_AMP_90E.sh DeepLearningExamples/PyTorch/Classification/ConvNets/resnet50v1.5/training/AMP/DGX1V_resnet50_AMP_90E.sh
cd DeepLearningExamples/PyTorch/Classification/ConvNets
cp -r ../../Segmentation/MaskRCNN/download_dataset.sh ./
bash download_dataset.sh coco2014
register: rn_pytorch_output
- debug:
msg: "{{ rn_pytorch_output.stdout_lines|list }}"
tags: experiment
# Build and configure ResNet50 (TensorFlow)
- name: download dataset and build docker image for TensorFlow's ResNet50
tags: experiment
become: true
become_user: "{{ user }}"
shell: |
cp configs/tensorflow_rn50_DGX1_RN50_AMP_90E.sh DeepLearningExamples/TensorFlow/Classification/ConvNets/resnet50v1.5/training/DGX1_RN50_AMP_90E.sh
cd DeepLearningExamples/TensorFlow/Classification/ConvNets
cp -r ../../../TensorFlow2/Segmentation/MaskRCNN/dataset ./
cd dataset
rm -rf data tf-models
sed 's/2017/2014/g' download_and_preprocess_coco.sh
bash download_and_preprocess_coco.sh ./data
register: rn_tensorflow_output
- debug:
msg: "{{ rn_tensorflow_output.stdout_lines|list }}"
tags: experiment