Skip to content

Commit b07c765

Browse files
zufangzhuguizili0
authored andcommitted
[Docker] dockerfile release for v1.1.0 (#1685)
1 parent 5779878 commit b07c765

6 files changed

+179
-26
lines changed

docker/README.md

+12-5
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,28 @@ Refer to [Install for GPU](../docs/install/install_for_gpu.md) and [Install for
1515

1616
## Binaries Preparation
1717

18-
Download and copy Intel® Extension for TensorFlow* wheel into ./models/ binaries directory.
18+
Download and copy Intel® Extension for TensorFlow* wheel into ./models/binaries directory.
1919

2020
```
2121
mkdir ./models/binaries
2222
```
2323

24+
To use Intel® Optimization for Horovod* with the Intel® oneAPI Collective Communications Library (oneCCL), copy Horovod wheel into ./models/horovod as well.
25+
26+
```bash
27+
mkdir ./models/horovod
28+
```
29+
2430
## Usage of Docker Container
2531
### I. Customize build script
2632
[build.sh](./build.sh) is provided as docker container build script. While OS version and some software version (such as Python and TensorFlow) is hard coded inside the script. If you prefer to use newer or later version, you can edit this script.
2733

28-
For example, to build docker container with Python 3.9 and TensorFlow 2.10 on Ubuntu 20.04 layer, update [build.sh](./build.sh) as below.
34+
For example, to build docker container with Python 3.9 and TensorFlow 2.11 on Ubuntu 20.04 layer, update [build.sh](./build.sh) as below.
2935
```
3036
IMAGE_NAME=intel-extension-for-tensorflow:cpu-ubuntu
3137
docker build --build-arg UBUNTU_VERSION=20.04 \
3238
--build-arg PYTHON=python3.9 \
33-
--build-arg TF_VER=2.10 \
39+
--build-arg TF_VER=2.11 \
3440
--build-arg TF_PLUGIN_WHEEL=intel_extension_for_tensorflow*.whl \
3541
-t $IMAGE_NAME \
3642
-f itex-cpu-ubuntu.Dockerfile .
@@ -41,15 +47,16 @@ IMAGE_NAME=intel-extension-for-tensorflow:cpu-ubuntu
4147
To build the docker container, enter into [docker](./) folder and run below commands:
4248

4349
```
44-
./build.sh [gpu/cpu-centos/cpu-ubuntu]
50+
./build.sh [gpu-flex/gpu-max/cpu-centos/cpu-ubuntu]
4551
```
4652
### III. Running container
4753

4854
Run following commands to start docker container. You can use `-v` option to mount your local directory into container. To make GPU available in the container, attach the GPU to the container using `--device /dev/dri` option and run the container:
4955

5056
```
51-
IMAGE_NAME=intel-extension-for-tensorflow:gpu
57+
IMAGE_NAME=intel-extension-for-tensorflow:gpu-max
5258
docker run -v <your-local-dir>:/workspace \
59+
-v /dev/dri/by-path:/dev/dri/by-path \
5360
--device /dev/dri \
5461
--privileged \
5562
-e http_proxy=$http_proxy \

docker/build.sh

+30-13
Original file line numberDiff line numberDiff line change
@@ -17,35 +17,52 @@
1717

1818
set -e
1919
IMAGE_TYPE=$1
20-
if [ $IMAGE_TYPE == "gpu" ]
20+
if [ $IMAGE_TYPE == "gpu-flex" ]
2121
then
22-
IMAGE_NAME=intel-extension-for-tensorflow:gpu
23-
docker build --build-arg UBUNTU_VERSION=20.04 \
24-
--build-arg PYTHON=python3.9 \
25-
--build-arg ICD_VER=22.28.23726.1+i419~u20.04 \
26-
--build-arg LEVEL_ZERO_GPU_VER=1.3.23726.1+i419~u20.04 \
27-
--build-arg LEVEL_ZERO_VER=1.8.1+i755~u20.04 \
28-
--build-arg TF_VER=2.10 \
29-
--build-arg DPCPP_VER=2022.2.0-8734 \
30-
--build-arg MKL_VER=2022.2.0-8748 \
22+
IMAGE_NAME=intel-extension-for-tensorflow:gpu-flex
23+
docker build --build-arg UBUNTU_VERSION=22.04 \
24+
--build-arg ICD_VER=22.43.24595.35+i538~22.04 \
25+
--build-arg LEVEL_ZERO_GPU_VER=1.3.24595.35+i538~22.04 \
26+
--build-arg LEVEL_ZERO_VER=1.8.8+i524~u22.04 \
27+
--build-arg TF_VER=2.11 \
28+
--build-arg DPCPP_VER=2023.0.0-25370 \
29+
--build-arg MKL_VER=2023.0.0-25398 \
30+
--build-arg PYTHON=python3.10 \
31+
--build-arg TF_PLUGIN_WHEEL=intel_extension_for_tensorflow*.whl \
32+
-t $IMAGE_NAME \
33+
-f itex-gpu-flex.Dockerfile .
34+
elif [ $IMAGE_TYPE == "gpu-max" ]
35+
then
36+
IMAGE_NAME=intel-extension-for-tensorflow:gpu-max
37+
docker build --build-arg UBUNTU_VERSION=22.04 \
38+
--build-arg ICD_VER=22.43.24595.35+i538~22.04 \
39+
--build-arg LEVEL_ZERO_GPU_VER=1.3.24595.35+i538~22.04 \
40+
--build-arg LEVEL_ZERO_VER=1.8.8+i524~u22.04 \
41+
--build-arg LEVEL_ZERO_DEV_VER=1.8.8+i524~u22.04 \
42+
--build-arg TF_VER=2.11 \
43+
--build-arg DPCPP_VER=2023.0.0-25370 \
44+
--build-arg MKL_VER=2023.0.0-25398 \
45+
--build-arg CCL_VER=2021.8.0-25371 \
46+
--build-arg PYTHON=python3.10 \
47+
--build-arg HOROVOD_WHL=intel_optimization_for_horovod-*.whl \
3148
--build-arg TF_PLUGIN_WHEEL=intel_extension_for_tensorflow*.whl \
3249
-t $IMAGE_NAME \
33-
-f itex-gpu.Dockerfile .
50+
-f itex-gpu-max.Dockerfile .
3451
elif [ $IMAGE_TYPE == "cpu-centos" ]
3552
then
3653
IMAGE_NAME=intel-extension-for-tensorflow:cpu-centos
3754
docker build --build-arg CENTOS_VER=8 \
3855
--build-arg PY_VER=39 \
3956
--build-arg PYTHON=python3.9 \
40-
--build-arg TF_VER=2.10 \
57+
--build-arg TF_VER=2.11 \
4158
--build-arg TF_PLUGIN_WHEEL=intel_extension_for_tensorflow*.whl \
4259
-t $IMAGE_NAME \
4360
-f itex-cpu-centos.Dockerfile .
4461
else
4562
IMAGE_NAME=intel-extension-for-tensorflow:cpu-ubuntu
4663
docker build --build-arg UBUNTU_VERSION=20.04 \
4764
--build-arg PYTHON=python3.9 \
48-
--build-arg TF_VER=2.10 \
65+
--build-arg TF_VER=2.11 \
4966
--build-arg TF_PLUGIN_WHEEL=intel_extension_for_tensorflow*.whl \
5067
-t $IMAGE_NAME \
5168
-f itex-cpu-ubuntu.Dockerfile .

docker/itex-cpu-centos.Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ RUN ln -sf $(which ${PYTHON}) /usr/local/bin/python && \
5959
ln -sf $(which ${PYTHON}) /usr/local/bin/python3 && \
6060
ln -sf $(which ${PYTHON}) /usr/bin/python
6161

62-
ARG TF_VER="2.10"
62+
ARG TF_VER="2.11"
6363

6464
RUN pip --no-cache-dir install tensorflow==${TF_VER}
6565

docker/itex-cpu-ubuntu.Dockerfile

+4-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ RUN ln -sf $(which ${PYTHON}) /usr/local/bin/python && \
5959
ln -sf $(which ${PYTHON}) /usr/bin/python && \
6060
ln -sf $(which ${PYTHON}) /usr/bin/python3
6161

62-
ARG TF_VER="2.10"
62+
RUN sed -i "/if util.abstract_sockets_supported:/d" /usr/lib/python3.9/multiprocessing/connection.py && \
63+
sed -i "/{next(_mmap_counter)}/d" /usr/lib/python3.9/multiprocessing/connection.py
64+
65+
ARG TF_VER="2.11"
6366

6467
RUN pip --no-cache-dir install tensorflow==${TF_VER}
6568

docker/itex-gpu.Dockerfile renamed to docker/itex-gpu-flex.Dockerfile

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Copyright (c) 2022 Intel Corporation
12
#
23
# Licensed under the Apache License, Version 2.0 (the "License");
34
# you may not use this file except in compliance with the License.
@@ -40,8 +41,8 @@ RUN apt-get update && \
4041

4142
RUN no_proxy=$no_proxy wget -qO - https://repositories.intel.com/graphics/intel-graphics.key | \
4243
gpg --dearmor --output /usr/share/keyrings/intel-graphics.gpg
43-
RUN echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/graphics/ubuntu focal main' | \
44-
tee /etc/apt/sources.list.d/intel.gpu.focal.list
44+
RUN echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/graphics/ubuntu jammy flex' | \
45+
tee /etc/apt/sources.list.d/intel.gpu.jammy.list
4546

4647
ARG ICD_VER
4748
ARG LEVEL_ZERO_GPU_VER
@@ -73,7 +74,7 @@ RUN apt-get update && \
7374
RUN echo "intelpython=exclude" > $HOME/cfg.txt
7475

7576
ENV LANG=C.UTF-8
76-
ARG PYTHON=python3.9
77+
ARG PYTHON=python3.10
7778

7879
RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \
7980
${PYTHON} lib${PYTHON} python3-pip && \
@@ -89,7 +90,7 @@ RUN ln -sf $(which ${PYTHON}) /usr/local/bin/python && \
8990
ln -sf $(which ${PYTHON}) /usr/bin/python && \
9091
ln -sf $(which ${PYTHON}) /usr/bin/python3
9192

92-
ARG TF_VER="2.10"
93+
ARG TF_VER="2.11"
9394

9495
RUN pip --no-cache-dir install tensorflow==${TF_VER}
9596

@@ -101,12 +102,11 @@ RUN pip install /tmp/tf_whls/* && \
101102
rm -rf /tmp/tf_whls
102103

103104
ENV LD_LIBRARY_PATH=/opt/intel/oneapi/lib:/opt/intel/oneapi/lib/intel64:$LD_LIBRARY_PATH
104-
ENV LD_PRELOAD=/opt/intel/oneapi/lib/intel64/libmkl_rt.so
105105

106106
ADD https://raw.githubusercontent.com/intel/intel-extension-for-tensorflow/master/third-party-programs/dockerlayer/THIRD-PARTY-PROGRAMS.txt /licenses/
107107
ADD https://raw.githubusercontent.com/intel/intel-extension-for-tensorflow/master/third-party-programs/dockerlayer/dpcpp-third-party-programs.txt /licenses/
108108
ADD https://raw.githubusercontent.com/intel/intel-extension-for-tensorflow/master/third-party-programs/dockerlayer/oneccl-third-party-programs.txt /licenses/
109109
ADD https://raw.githubusercontent.com/intel/intel-extension-for-tensorflow/master/third-party-programs/dockerlayer/onemkl-third-party-program-sub-tpp.txt /licenses/
110110
ADD https://raw.githubusercontent.com/intel/intel-extension-for-tensorflow/master/third-party-programs/dockerlayer/onemkl-third-party-program.txt /licenses/
111111
ADD https://raw.githubusercontent.com/intel/intel-extension-for-tensorflow/master/third-party-programs/dockerlayer/third-party-program-of-intel-extension-for-tensorflow.txt /licenses/
112-
ADD https://raw.githubusercontent.com/intel/intel-extension-for-tensorflow/master/third-party-programs/dockerlayer/third-party-programs-of-intel-tensorflow.txt /licenses/
112+
ADD https://raw.githubusercontent.com/intel/intel-extension-for-tensorflow/master/third-party-programs/dockerlayer/third-party-programs-of-intel-tensorflow.txt /licenses/

docker/itex-gpu-max.Dockerfile

+126
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# Copyright (c) 2022 Intel Corporation
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# ============================================================================
15+
16+
ARG UBUNTU_VERSION
17+
18+
FROM ubuntu:${UBUNTU_VERSION}
19+
20+
ENV LANG=C.UTF-8
21+
22+
ARG DEBIAN_FRONTEND=noninteractive
23+
24+
HEALTHCHECK NONE
25+
RUN useradd -d /home/itex -m -s /bin/bash itex
26+
27+
RUN apt-get update && \
28+
apt-get install -y --no-install-recommends --fix-missing \
29+
apt-utils \
30+
build-essential \
31+
ca-certificates \
32+
clinfo \
33+
curl \
34+
git \
35+
gnupg2 \
36+
gpg-agent \
37+
rsync \
38+
sudo \
39+
unzip \
40+
wget && \
41+
apt-get clean && \
42+
rm -rf /var/lib/apt/lists/*
43+
44+
RUN no_proxy=$no_proxy wget -qO - https://repositories.intel.com/graphics/intel-graphics.key | \
45+
gpg --dearmor --output /usr/share/keyrings/intel-graphics.gpg
46+
RUN echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/graphics/ubuntu jammy flex' | \
47+
tee /etc/apt/sources.list.d/intel.gpu.jammy.list
48+
49+
ARG ICD_VER
50+
ARG LEVEL_ZERO_GPU_VER
51+
ARG LEVEL_ZERO_VER
52+
ARG LEVEL_ZERO_DEV_VER
53+
54+
RUN apt-get update && \
55+
apt-get install -y --no-install-recommends --fix-missing \
56+
intel-opencl-icd=${ICD_VER} \
57+
intel-level-zero-gpu=${LEVEL_ZERO_GPU_VER} \
58+
level-zero=${LEVEL_ZERO_VER} \
59+
level-zero-dev=${LEVEL_ZERO_DEV_VER} && \
60+
apt-get clean && \
61+
rm -rf /var/lib/apt/lists/*
62+
63+
RUN no_proxy=$no_proxy wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \
64+
| gpg --dearmor | tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null && \
65+
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" \
66+
| tee /etc/apt/sources.list.d/oneAPI.list
67+
68+
ARG DPCPP_VER
69+
ARG MKL_VER
70+
ARG CCL_VER
71+
72+
RUN apt-get update && \
73+
apt-get install -y --no-install-recommends --fix-missing \
74+
intel-oneapi-runtime-dpcpp-cpp=${DPCPP_VER} \
75+
intel-oneapi-runtime-mkl=${MKL_VER} \
76+
intel-oneapi-runtime-ccl=${CCL_VER} && \
77+
apt-get clean && \
78+
rm -rf /var/lib/apt/lists/*
79+
80+
RUN echo "intelpython=exclude" > $HOME/cfg.txt
81+
82+
ENV LANG=C.UTF-8
83+
ARG PYTHON=python3.10
84+
85+
RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \
86+
${PYTHON} lib${PYTHON} python3-pip && \
87+
apt-get clean && \
88+
rm -rf /var/lib/apt/lists/*
89+
90+
RUN pip --no-cache-dir install --upgrade \
91+
pip \
92+
setuptools
93+
94+
RUN ln -sf $(which ${PYTHON}) /usr/local/bin/python && \
95+
ln -sf $(which ${PYTHON}) /usr/local/bin/python3 && \
96+
ln -sf $(which ${PYTHON}) /usr/bin/python && \
97+
ln -sf $(which ${PYTHON}) /usr/bin/python3
98+
99+
ARG TF_VER="2.11"
100+
101+
RUN pip --no-cache-dir install tensorflow==${TF_VER}
102+
103+
ARG HOROVOD_WHL
104+
105+
COPY models/horovod/${HOROVOD_WHL} /tmp/horovod_whls/
106+
107+
RUN pip install /tmp/horovod_whls/* && \
108+
rm -rf /tmp/horovod_whls
109+
110+
ARG TF_PLUGIN_WHEEL
111+
112+
COPY models/binaries/$TF_PLUGIN_WHEEL /tmp/tf_whls/
113+
114+
RUN pip install /tmp/tf_whls/* && \
115+
rm -rf /tmp/tf_whls
116+
117+
ENV LD_LIBRARY_PATH=/opt/intel/oneapi/lib:/opt/intel/oneapi/lib/intel64:$LD_LIBRARY_PATH
118+
119+
ADD https://raw.githubusercontent.com/intel/intel-extension-for-tensorflow/master/third-party-programs/dockerlayer/THIRD-PARTY-PROGRAMS.txt /licenses/
120+
ADD https://raw.githubusercontent.com/intel/intel-extension-for-tensorflow/master/third-party-programs/dockerlayer/dpcpp-third-party-programs.txt /licenses/
121+
ADD https://raw.githubusercontent.com/intel/intel-extension-for-tensorflow/master/third-party-programs/dockerlayer/oneccl-third-party-programs.txt /licenses/
122+
ADD https://raw.githubusercontent.com/intel/intel-extension-for-tensorflow/master/third-party-programs/dockerlayer/onemkl-third-party-program-sub-tpp.txt /licenses/
123+
ADD https://raw.githubusercontent.com/intel/intel-extension-for-tensorflow/master/third-party-programs/dockerlayer/onemkl-third-party-program.txt /licenses/
124+
ADD https://raw.githubusercontent.com/intel/intel-extension-for-tensorflow/master/third-party-programs/dockerlayer/third-party-program-of-intel-extension-for-tensorflow.txt /licenses/
125+
ADD https://raw.githubusercontent.com/intel/intel-extension-for-tensorflow/master/third-party-programs/dockerlayer/third-party-programs-of-intel-tensorflow.txt /licenses/
126+
ADD https://raw.githubusercontent.com/oneapi-src/oneCCL/master/third-party-programs.txt /licenses/

0 commit comments

Comments
 (0)