@@ -5,6 +5,27 @@ LABEL maintainer="Amazon AI"
5
5
# prevent stopping by user interaction
6
6
ENV DEBIAN_FRONTEND noninteractive
7
7
ENV DEBCONF_NONINTERACTIVE_SEEN true
8
+ ENV SAGEMAKER_TRAINING_MODULE sagemaker_tensorflow_container.training:main
9
+
10
+ # Set environment variables for MKL
11
+ # For more about MKL with TensorFlow see:
12
+ # https://www.tensorflow.org/performance/performance_guide#tensorflow_with_intel%C2%AE_mkl_dnn
13
+ ENV KMP_AFFINITY=granularity=fine,compact,1,0
14
+ ENV KMP_BLOCKTIME=1
15
+ ENV KMP_SETTINGS=0
16
+
17
+ ENV PYTHONDONTWRITEBYTECODE=1
18
+ ENV PYTHONUNBUFFERED=1
19
+ ENV PYTHONIOENCODING=UTF-8
20
+ ENV LANG=C.UTF-8
21
+ ENV LC_ALL=C.UTF-8
22
+
23
+ ARG FRAMEWORK_SUPPORT_INSTALLABLE=sagemaker_tensorflow_container-2.0.8.dev0.tar.gz
24
+ ARG TENSORFLOW_WHL=tensorflow-2.0.0-cp27-cp27mu-manylinux2010_x86_64.whl
25
+
26
+ ARG PYTHON=python
27
+ ARG PYTHON_PIP=python-pip
28
+ ARG PIP=pip
8
29
9
30
RUN apt-get update && apt-get install -y --no-install-recommends \
10
31
software-properties-common \
@@ -17,93 +38,82 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
17
38
wget \
18
39
vim \
19
40
zlib1g-dev \
20
- && rm -rf /var/lib/apt/lists/*
41
+ && rm -rf /var/lib/apt/lists/*
21
42
22
43
# Install Open MPI
23
- RUN mkdir /tmp/openmpi && \
24
- cd /tmp/openmpi && \
25
- curl -fSsL -O https://download.open-mpi.org/release/open-mpi/v4.0/openmpi-4.0.1.tar.gz && \
26
- tar zxf openmpi-4.0.1.tar.gz && \
27
- cd openmpi-4.0.1 && \
28
- ./configure --enable-orterun-prefix-by-default && \
29
- make -j $(nproc) all && \
30
- make install && \
31
- ldconfig && \
32
- rm -rf /tmp/openmpi
44
+ RUN mkdir /tmp/openmpi \
45
+ && cd /tmp/openmpi \
46
+ && curl -fSsL -O https://download.open-mpi.org/release/open-mpi/v4.0/openmpi-4.0.1.tar.gz \
47
+ && tar zxf openmpi-4.0.1.tar.gz \
48
+ && cd openmpi-4.0.1 \
49
+ && ./configure --enable-orterun-prefix-by-default \
50
+ && make -j $(nproc) all \
51
+ && make install \
52
+ && ldconfig \
53
+ && rm -rf /tmp/openmpi
33
54
34
55
# Create a wrapper for OpenMPI to allow running as root by default
35
- RUN mv /usr/local/bin/mpirun /usr/local/bin/mpirun.real && \
36
- echo '#!/bin/bash' > /usr/local/bin/mpirun && \
37
- echo 'mpirun.real --allow-run-as-root "$@"' >> /usr/local/bin/mpirun && \
38
- chmod a+x /usr/local/bin/mpirun
56
+ RUN mv /usr/local/bin/mpirun /usr/local/bin/mpirun.real \
57
+ && echo '#!/bin/bash' > /usr/local/bin/mpirun \
58
+ && echo 'mpirun.real --allow-run-as-root "$@"' >> /usr/local/bin/mpirun \
59
+ && chmod a+x /usr/local/bin/mpirun
39
60
40
- RUN echo "hwloc_base_binding_policy = none" >> /usr/local/etc/openmpi-mca-params.conf && \
41
- echo "rmaps_base_mapping_policy = slot" >> /usr/local/etc/openmpi-mca-params.conf
61
+ RUN echo "hwloc_base_binding_policy = none" >> /usr/local/etc/openmpi-mca-params.conf \
62
+ && echo "rmaps_base_mapping_policy = slot" >> /usr/local/etc/openmpi-mca-params.conf
42
63
43
64
ENV LD_LIBRARY_PATH=/usr/local/openmpi/lib:$LD_LIBRARY_PATH
44
-
45
65
ENV PATH /usr/local/openmpi/bin/:$PATH
46
66
47
67
# SSH login fix. Otherwise user is kicked off after login
48
68
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
49
69
50
70
# Create SSH key.
51
- RUN mkdir -p /root/.ssh/ && \
52
- mkdir -p /var/run/sshd && \
53
- ssh-keygen -q -t rsa -N '' -f /root/.ssh/id_rsa && \
54
- cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys && \
55
- printf "Host *\n StrictHostKeyChecking no\n" >> /root/.ssh/config
56
-
57
- # Set environment variables for MKL
58
- # For more about MKL with TensorFlow see:
59
- # https://www.tensorflow.org/performance/performance_guide#tensorflow_with_intel%C2%AE_mkl_dnn
60
- ENV KMP_AFFINITY=granularity=fine,compact,1,0 KMP_BLOCKTIME=1 KMP_SETTINGS=0
71
+ RUN mkdir -p /root/.ssh/ \
72
+ && mkdir -p /var/run/sshd \
73
+ && ssh-keygen -q -t rsa -N '' -f /root/.ssh/id_rsa \
74
+ && cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys \
75
+ && printf "Host *\n StrictHostKeyChecking no\n" >> /root/.ssh/config
61
76
62
77
WORKDIR /
63
78
64
- ARG PYTHON=python
65
- ARG PYTHON_PIP=python-pip
66
- ARG PIP=pip
67
-
68
79
RUN apt-get update && apt-get install -y \
69
80
${PYTHON} \
70
81
${PYTHON_PIP}
71
82
72
- ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 PYTHONIOENCODING=UTF-8 LANG=C.UTF-8 LC_ALL=C.UTF-8
73
-
74
- ARG framework_support_installable=sagemaker_tensorflow_container-2.0.8.dev0.tar.gz
75
- ARG sagemaker_tensorflow_extensions=tensorflow-2.0.0-cp27-cp27mu-manylinux2010_x86_64.whl
76
- COPY $framework_support_installable .
77
- COPY $sagemaker_tensorflow_extensions .
83
+ COPY $FRAMEWORK_SUPPORT_INSTALLABLE .
84
+ COPY $TENSORFLOW_WHL .
78
85
79
- RUN ${PIP} --no-cache-dir install --upgrade pip setuptools
86
+ RUN ${PIP} --no-cache-dir install --upgrade \
87
+ pip \
88
+ setuptools
80
89
81
90
# Some TF tools expect a "python" binary
82
91
RUN ln -s $(which ${PYTHON}) /usr/local/bin/python
83
92
84
93
RUN ${PIP} install --no-cache-dir -U \
85
- numpy==1.16.4 \
86
- scipy==1.2.2 \
87
- scikit-learn==0.20.3 \
88
- pandas==0.24.2 \
89
- Pillow==6.1.0 \
90
- h5py==2.9.0 \
91
- keras_applications==1.0.8 \
92
- keras_preprocessing==1.1.0 \
93
- requests==2.22.0 \
94
- keras==2.2.4 \
95
- awscli==1.16.196 \
96
- mpi4py==3.0.2 \
97
- $sagemaker_tensorflow_extensions \
98
- # Let's install TensorFlow separately in the end to avoid
99
- # the library version to be overwritten
100
- # && ${PIP} install --force-reinstall --no-cache-dir -U ${TF_URL} \
101
- && ${PIP} install --no-cache-dir -U $framework_support_installable && \
102
- rm -f $framework_support_installable \
103
- && ${PIP} install --no-cache-dir -U horovod==0.18.2 \
104
- && ${PIP} uninstall -y --no-cache-dir \
105
- markdown
106
-
107
- ENV SAGEMAKER_TRAINING_MODULE sagemaker_tensorflow_container.training:main
94
+ numpy==1.16.5 \
95
+ scipy==1.2.2 \
96
+ scikit-learn==0.20.3 \
97
+ pandas==0.24.2 \
98
+ Pillow==6.1.0 \
99
+ h5py==2.9.0 \
100
+ keras_applications==1.0.8 \
101
+ keras_preprocessing==1.1.0 \
102
+ requests==2.22.0 \
103
+ keras==2.3.1 \
104
+ awscli \
105
+ mpi4py==3.0.2 \
106
+ # Let's install TensorFlow separately in the end to avoid
107
+ # the library version to be overwritten
108
+ # ${PIP} install --force-reinstall --no-cache-dir -U ${TF_URL} \
109
+ && ${PIP} install --force-reinstall --no-cache-dir -U \
110
+ $TENSORFLOW_WHL \
111
+ && ${PIP} install --no-cache-dir -U \
112
+ $FRAMEWORK_SUPPORT_INSTALLABLE \
113
+ && rm -f $FRAMEWORK_SUPPORT_INSTALLABLE \
114
+ && ${PIP} install --no-cache-dir -U \
115
+ horovod==0.18.2 \
116
+ && ${PIP} uninstall -y --no-cache-dir \
117
+ markdown
108
118
109
119
CMD ["bin/bash"]
0 commit comments