Skip to content

Commit 82fcf45

Browse files
bashimaorhdong
authored andcommitted
Necessary minimum to make the dev image build again.
[CI] switch bazel to 5.1.1 and update dev docker container
1 parent e680e8e commit 82fcf45

11 files changed

+47
-34
lines changed

.github/workflows/ci_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
- master
1111
- r*
1212
env:
13-
USE_BAZEL_VERSION: "3.7.2"
13+
USE_BAZEL_VERSION: "5.1.1"
1414

1515
jobs:
1616
yapf-test:

.github/workflows/release.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ on:
1717
env:
1818
MIN_PY_VERSION: '3.7'
1919
MAX_PY_VERSION: '3.9'
20-
USE_BAZEL_VERSION: "3.7.2"
20+
USE_BAZEL_VERSION: "5.1.1"
2121
HOROVOD_VERSION: '0.23.0'
2222

2323
jobs:
@@ -167,11 +167,15 @@ jobs:
167167
name: Upload dev container to DockerHub
168168
needs: [release-wheel, test-with-bazel]
169169
runs-on: ubuntu-18.04
170+
strategy:
171+
matrix:
172+
py-version: ['3.7', '3.8', '3.9']
170173
if: (github.event_name == 'push' && github.ref == 'refs/heads/master')
171174
steps:
172175
- uses: actions/checkout@v2
173176
- run: |
174177
set -e -x
175178
echo ${{ secrets.DOCKER_PW }} | docker login --username ${{ secrets.DOCKER_USER }} --password-stdin
179+
export PY_VERSION=${{ matrix.py-version }}
176180
bash .github/workflows/github_build_dev_container.sh
177-
docker push tfra/dev_container:latest-cpu
181+
docker push tfra/dev_container:latest-python${{ matrix.py-version }}

README.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,15 @@ but maybe this doc can help you : [Extract headers from TensorFlow compiling dir
134134
At the same time, we find some OPs used by TRFA have better performance, so we highly recommend you update TensorFlow to 2.x.
135135

136136
#### Installing from Source
137+
138+
For all developers, we recommend you use the development docker containers which are all GPU enabled:
139+
```shell
140+
docker pull tfra/dev_container:latest-python3.8 # "3.7", "3.9" are all avaliable.
141+
docker run --privileged --gpus all -it --rm -v $(pwd):$(pwd) tfra/dev_container:latest-3.8
142+
```
143+
137144
##### CPU Only
138-
You can also install from source. This requires the [Bazel](https://bazel.build/) build system (version == 3.7.2).
145+
You can also install from source. This requires the [Bazel](https://bazel.build/) build system (version == 5.1.1).
139146
Please install a TensorFlow on your compiling machine, The compiler needs to know the version of Tensorflow and
140147
its headers according to the installed TensorFlow.
141148

@@ -158,18 +165,20 @@ pip install artifacts/tensorflow_recommenders_addons-*.whl
158165
##### GPU Support
159166
Only `TF_NEED_CUDA=1` is required and other environment variables are optional:
160167
```shell
161-
PY_VERSION="3.7" \
162-
TF_NEED_CUDA=1 \
163-
TF_CUDA_VERSION=11.2 \
164-
TF_CUDNN_VERSION=8.1 \
165-
CUDA_TOOLKIT_PATH="/usr/local/cuda" \
166-
CUDNN_INSTALL_PATH="/usr/lib/x86_64-linux-gnu" \
168+
export TF_VERSION="2.5.1" # "2.7.0", "2.5.1" are well tested.
169+
export PY_VERSION="3.8"
170+
export TF_NEED_CUDA=1
171+
export TF_CUDA_VERSION=11.2
172+
export TF_CUDNN_VERSION=8.1
173+
export CUDA_TOOLKIT_PATH="/usr/local/cuda"
174+
export CUDNN_INSTALL_PATH="/usr/lib/x86_64-linux-gnu"
175+
167176
python configure.py
168177
```
169178
And then build the pip package and install:
170179
```shell
171180
bazel build --enable_runfiles build_pip_pkg
172-
TF_NEED_CUDA=1 bazel-bin/build_pip_pkg artifacts
181+
bazel-bin/build_pip_pkg artifacts
173182
pip install artifacts/tensorflow_recommenders_addons_gpu-*.whl
174183
```
175184
##### Apple Silicon Support (Beta Release)

configure.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ def _VALID_BAZEL_VERSION(tf_version):
4040
'refering to the previous COMMIT to compile properly by themselves.')
4141
return target_bazel
4242
elif tf_version >= "2.0.0":
43-
target_bazel = "3.7.2"
43+
target_bazel = "5.1.1"
4444
logging.info(
4545
'To ensure code compatibility with Bazel rules_foreign_cc component, '
46-
'we specify Bazel version greater than 3.7.2 '
46+
'we specify Bazel version greater than 5.1.1 '
4747
'for Tensorflow versions greater than 2.0.0.')
4848
return target_bazel
4949
else:

tools/build_dev_container.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#!/usr/bin/env bash
22

33
set -x -e
4-
5-
DOCKER_BUILDKIT=1 docker build \
4+
docker build \
65
-f tools/docker/dev_container.Dockerfile \
76
--build-arg TF_VERSION=2.5.1 \
8-
--build-arg TF_PACKAGE=tensorflow-cpu \
9-
--target dev_container_cpu \
10-
-t tfaddons/dev_container:latest-cpu ./
7+
--build-arg TF_PACKAGE=tensorflow-gpu \
8+
--build-arg PY_VERSION=$PY_VERSION \
9+
--no-cache \
10+
--target dev_container \
11+
-t tfra/dev_container:latest-python$PY_VERSION ./

tools/docker/cpu_tests.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
FROM python:3.7 as build_wheel
33

44
ARG TF_VERSION=2.5.1
5-
ARG USE_BAZEL_VERSION=3.7.2
5+
ARG USE_BAZEL_VERSION=5.1.1
66
ARG MPI_VERSION="4.1.1"
77
ARG HOROVOD_VERSION="0.23.0"
88

tools/docker/cuda11.0-cudnn8-ubuntu18.04-manylinux2010-multipython.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ RUN apt-get update && apt-get install -y \
7979
rm -rf /var/lib/apt/lists/*
8080

8181
COPY install/install_bazel.sh /install/
82-
RUN /install/install_bazel.sh "3.7.2"
82+
RUN /install/install_bazel.sh "5.1.1"
8383

8484
COPY install/build_and_install_python.sh /install/
8585
RUN /install/build_and_install_python.sh "3.5.9"

tools/docker/cuda11.2-cudnn8.1-ubuntu18.04-manylinux2010-multipython.Dockerfile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,14 @@ RUN apt-get update && apt-get install -y \
7777
RUN chmod 777 /tmp/
7878
WORKDIR /tmp/
7979

80-
COPY install/install_trt.sh /install/
81-
RUN /install/install_trt.sh "7.2.3-1+cuda11.1"
82-
8380
COPY install/install_nccl.sh /install/
8481
RUN /install/install_nccl.sh "2.8.4-1+cuda11.2"
8582

8683
COPY install/install_rocksdb.sh /install/
8784
RUN /install/install_rocksdb.sh "6.22.1"
8885

8986
COPY install/install_bazel.sh /install/
90-
RUN /install/install_bazel.sh "3.7.2"
87+
RUN /install/install_bazel.sh "5.1.1"
9188

9289
COPY install/build_and_install_python.sh /install/
9390
RUN /install/build_and_install_python.sh "3.6.9"
Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
#syntax=docker/dockerfile:1.1.5-experimental
2-
FROM tensorflow/tensorflow:2.1.0-custom-op-ubuntu16 as dev_container_cpu
2+
ARG PY_VERSION
3+
ARG IMAGE_TYPE
4+
5+
# Currenly all of our dev images are GPU capable but at a cost of being quite large.
6+
# See https://github.com/tensorflow/build/pull/47
7+
FROM tensorflow/build:latest-python$PY_VERSION as dev_container
38
ARG TF_PACKAGE
49
ARG TF_VERSION
510

6-
# Temporary until custom-op container is updated
7-
RUN ln -sf /usr/bin/python3 /usr/bin/python
8-
RUN ln -sf /usr/local/bin/pip3 /usr/local/bin/pip
11+
RUN pip uninstall $TF_PACKAGE -y
912
RUN pip install --default-timeout=1000 $TF_PACKAGE==$TF_VERSION
1013

1114
COPY tools/install_deps /install_deps
1215
COPY requirements.txt /tmp/requirements.txt
13-
RUN pip install -r /install_deps/black.txt \
14-
-r /install_deps/flake8.txt \
16+
RUN pip install -r /install_deps/yapf.txt \
1517
-r /install_deps/pytest.txt \
1618
-r /install_deps/typedapi.txt \
1719
-r /tmp/requirements.txt
1820

1921
RUN bash /install_deps/buildifier.sh
2022
RUN bash /install_deps/clang-format.sh
2123

22-
ENV TFRA_DEV_CONTAINER="1"
24+
ENV ADDONS_DEV_CONTAINER="1"
2325

2426
# Clean up
2527
RUN apt-get autoremove -y \
2628
&& apt-get clean -y \
27-
&& rm -rf /var/lib/apt/lists/*
29+
&& rm -rf /var/lib/apt/lists/*

tools/run_build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ set -e
66

77
DOCKER_BUILDKIT=1 docker build \
88
-f tools/docker/sanity_check.Dockerfile \
9-
--build-arg USE_BAZEL_VERSION=${USE_BAZEL_VERSION:-"3.7.2"} \
9+
--build-arg USE_BAZEL_VERSION=${USE_BAZEL_VERSION:-"5.1.1"} \
1010
--target=${1} ./

0 commit comments

Comments
 (0)