Skip to content

Commit 66aba8a

Browse files
authored
Install sagemaker-tensorflow from pypi. Add MKL environment variables for TF 1.8 (#61)
* Switch to install sagemaker-tensorflow from pypi. Add MKL environment variables for TF 1.8. * Remove sagemaker-tensorflow-extensions from docker file.
1 parent b41f636 commit 66aba8a

File tree

4 files changed

+14
-34
lines changed

4 files changed

+14
-34
lines changed

docker/1.7.0/final/py2/Dockerfile.cpu

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,10 @@ RUN framework_installable_local=$(basename $framework_installable) && \
1616
\
1717
pip install --no-cache --upgrade $framework_installable_local && \
1818
pip install $framework_support_installable_local && \
19+
pip install "sagemaker-tensorflow>=1.7,<1.8" &&\
1920
\
2021
rm $framework_installable_local && \
2122
rm $framework_support_installable_local
2223

23-
COPY sagemaker-tensorflow-extensions sagemaker-tensorflow-extensions
24-
25-
RUN cd sagemaker-tensorflow-extensions && \
26-
LD_LIBRARY_PATH=$(dirname $(find /usr/local/lib | grep "libmkl")):$LD_LIBRARY_PATH pip install . && \
27-
cd .. && \
28-
rm -rf sagemaker-tensorflow-extensions
29-
3024
# entry.py comes from sagemaker-container-support
3125
ENTRYPOINT ["entry.py"]

docker/1.7.0/final/py2/Dockerfile.gpu

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,11 @@ RUN framework_installable_local=$(basename $framework_installable) && \
1616
\
1717
pip install --no-cache --upgrade $framework_installable_local && \
1818
pip install $framework_support_installable_local && \
19+
pip install "sagemaker-tensorflow>=1.7,<1.8" &&\
1920
\
2021
rm $framework_installable_local && \
2122
rm $framework_support_installable_local
2223

23-
COPY sagemaker-tensorflow-extensions sagemaker-tensorflow-extensions
24-
25-
RUN cd sagemaker-tensorflow-extensions && \
26-
ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/stubs/libcuda.so.1 && \
27-
LD_LIBRARY_PATH=/usr/local/cuda/lib64/stubs:$LD_LIBRARY_PATH \
28-
pip install . && \
29-
cd .. && \
30-
rm -rf sagemaker-tensorflow-extensions
31-
3224
# entry.py comes from sagemaker-container-support
3325
ENTRYPOINT ["entry.py"]
3426

docker/1.8.0/final/py2/Dockerfile.cpu

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,22 @@ ARG framework_support_installable=sagemaker_tensorflow_container-1.0.0.tar.gz
77

88
WORKDIR /root
99

10+
COPY $framework_installable .
1011
COPY $framework_support_installable .
1112

12-
RUN framework_support_installable_local=$(basename $framework_support_installable) && \
13+
RUN framework_installable_local=$(basename $framework_installable) && \
14+
framework_support_installable_local=$(basename $framework_support_installable) && \
15+
\
16+
pip install --no-cache --upgrade $framework_installable_local && \
1317
pip install $framework_support_installable_local && \
18+
pip install "sagemaker-tensorflow>=1.8,<1.9" &&\
19+
\
20+
rm $framework_installable_local && \
1421
rm $framework_support_installable_local
1522

16-
RUN pip install --no-cache --upgrade tensorflow==1.8.0
17-
18-
COPY sagemaker-tensorflow-extensions sagemaker-tensorflow-extensions
19-
20-
RUN cd sagemaker-tensorflow-extensions && \
21-
pip install . && \
22-
cd .. && \
23-
rm -rf sagemaker-tensorflow-extensions
23+
# Set environment variables for MKL
24+
# TODO: investigate the right value for OMP_NUM_THREADS
25+
ENV KMP_AFFINITY=granularity=fine,compact,1,0 KMP_BLOCKTIME=1 KMP_SETTINGS=0
2426

2527
# entry.py comes from sagemaker-container-support
2628
ENTRYPOINT ["entry.py"]

docker/1.8.0/final/py2/Dockerfile.gpu

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,10 @@ RUN framework_installable_local=$(basename $framework_installable) && \
1616
\
1717
pip install --no-cache --upgrade $framework_installable_local && \
1818
pip install $framework_support_installable_local && \
19+
pip install "sagemaker-tensorflow>=1.8,<1.9" &&\
1920
\
2021
rm $framework_installable_local && \
2122
rm $framework_support_installable_local
2223

23-
COPY sagemaker-tensorflow-extensions sagemaker-tensorflow-extensions
24-
25-
RUN cd sagemaker-tensorflow-extensions && \
26-
ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/stubs/libcuda.so.1 && \
27-
LD_LIBRARY_PATH=/usr/local/cuda/lib64/stubs:$LD_LIBRARY_PATH \
28-
pip install . && \
29-
cd .. && \
30-
rm -rf sagemaker-tensorflow-extensions
31-
3224
# entry.py comes from sagemaker-container-support
3325
ENTRYPOINT ["entry.py"]

0 commit comments

Comments
 (0)