-
Notifications
You must be signed in to change notification settings - Fork 65
/
full.Dockerfile
executable file
·134 lines (115 loc) · 3.96 KB
/
full.Dockerfile
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
# Base image built from `tf.Dockerfile`
FROM tlkh/ai-lab:20.12-base
LABEL maintainer="Timothy Liu <timothy_liu@mymail.sutd.edu.sg>"
USER root
ENV DEBIAN_FRONTEND=noninteractive \
TF_FORCE_GPU_ALLOW_GROWTH=true
# install conda TensorFlow and PyTorch
USER $NB_UID
RUN conda install -c anaconda -c pytorch --quiet --yes \
'python=3.7' \
pytorch torchvision torchaudio \
tensorflow-gpu \
tensorflow-hub \
tensorflow-datasets \
'cudatoolkit=10.2' && \
pip install --no-cache-dir torchtext pytorch-lightning['extra'] && \
pip uninstall pillow -y && \
CC="cc -mavx2" pip install -U --force-reinstall --no-cache-dir pillow-simd && \
conda clean -tipsy && \
conda build purge-all && \
find $CONDA_DIR -type f,l -name '*.a' -delete && \
find $CONDA_DIR -type f,l -name '*.pyc' -delete && \
find $CONDA_DIR -type f,l -name '*.js.map' -delete && \
rm -rf $CONDA_DIR/pkgs && \
rm -rf /tmp/* && \
rm -rf $HOME/.cache && \
rm -rf $HOME/.node-gyp && \
fix-permissions $CONDA_DIR && \
fix-permissions $HOME
# apex
USER root
RUN apt-get update && \
apt-get install -yq --no-upgrade \
cuda-nvml-dev-$CUDA_PKG_VERSION \
cuda-command-line-tools-$CUDA_PKG_VERSION \
cuda-libraries-dev-$CUDA_PKG_VERSION \
cuda-minimal-build-$CUDA_PKG_VERSION \
libnccl-dev=$NCCL_VERSION-1+cuda10.2 && \
cd /tmp/ && \
git clone --depth 1 https://github.com/NVIDIA/apex && \
cd apex && \
pip install -v --no-cache-dir \
--global-option="--cpp_ext" --global-option="--cuda_ext" \
. && \
cd .. && rm -rf apex && \
apt-get remove -yq \
cuda-nvml-dev-$CUDA_PKG_VERSION \
cuda-command-line-tools-$CUDA_PKG_VERSION \
cuda-libraries-dev-$CUDA_PKG_VERSION \
libnccl-dev=$NCCL_VERSION-1+cuda10.2 && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /var/cache/apt/* && \
rm -rf /tmp/* && \
rm -rf $HOME/.cache && \
rm -rf $HOME/.node-gyp && \
fix-permissions $CONDA_DIR && \
fix-permissions $HOME
# RAPIDS
USER $NB_UID
RUN conda install \
-c nvidia \
-c rapidsai \
-c numba -c conda-forge -c defaults \
'python=3.7' \
'rapids-blazing=0.17' \
'cudatoolkit=10.2' && \
conda install \
-c rapidsai/label/xgboost \
'xgboost' \
'dask-xgboost' && \
pip install --no-cache-dir \
dask_labextension && \
jupyter labextension install dask-labextension && jupyter lab clean && \
conda clean -tipsy && \
conda build purge-all && \
find $CONDA_DIR -type f,l -name '*.a' -delete && \
find $CONDA_DIR -type f,l -name '*.pyc' -delete && \
find $CONDA_DIR -type f,l -name '*.js.map' -delete && \
rm -rf $CONDA_DIR/pkgs && \
npm cache clean --force && \
rm -rf $CONDA_DIR/share/jupyter/lab/staging && \
rm -rf /tmp/* && \
rm -rf $HOME/.cache && \
rm -rf $HOME/.node-gyp && \
fix-permissions $CONDA_DIR && \
fix-permissions $HOME
ENV HOROVOD_GPU_ALLREDUCE=NCCL \
HOROVOD_WITH_TENSORFLOW=1 \
HOROVOD_WITH_PYTORCH=1
USER root
RUN apt-get update && \
apt-get install -yq --no-upgrade \
cuda-nvml-dev-$CUDA_PKG_VERSION \
cuda-command-line-tools-$CUDA_PKG_VERSION \
cuda-libraries-dev-$CUDA_PKG_VERSION \
cuda-minimal-build-$CUDA_PKG_VERSION \
libnccl-dev=$NCCL_VERSION-1+cuda10.2 && \
pip uninstall horovod -y && \
pip install --no-cache-dir horovod && \
apt-get remove -yq \
cuda-nvml-dev-$CUDA_PKG_VERSION \
cuda-command-line-tools-$CUDA_PKG_VERSION \
cuda-libraries-dev-$CUDA_PKG_VERSION \
libnccl-dev=$NCCL_VERSION-1+cuda10.2 && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /var/cache/apt/* && \
rm -rf /tmp/* && \
rm -rf $HOME/.cache && \
rm -rf $HOME/.node-gyp && \
fix-permissions $CONDA_DIR && \
fix-permissions $HOME
# Switch back to jovyan to avoid accidental container runs as root
USER $NB_UID