Skip to content

Separate dev baseline and cuda layers #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/workflows/docker-presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,16 @@ jobs:
tags: tensorflow/build:latest-${{ matrix.python-version }}
cache-from: type=registry,ref=tensorflow/build:latest-${{ matrix.python-version }}
cache-to: type=inline

-
name: Build containers CUDA
id: docker_build_cuda
uses: docker/build-push-action@v2
with:
push: false
context: ./tf_sig_build_dockerfiles
target: devel-cuda
build-args: |
PYTHON_VERSION=${{ matrix.python-version }}
tags: tensorflow/build:latest-${{ matrix.python-version }}-CUDA
cache-from: type=registry,ref=tensorflow/build:latest-${{ matrix.python-version }}-CUDA
cache-to: type=inline
19 changes: 18 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,21 @@ jobs:
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

-
name: Build and push CUDA
id: docker_build_cuda
uses: docker/build-push-action@v2
with:
push: true
context: ./tf_sig_build_dockerfiles
target: devel-cuda
build-args: |
PYTHON_VERSION=${{ matrix.python-version }}
tags: |
tensorflow/build:latest-${{ matrix.python-version }}-cuda
tensorflow/build:${{ steps.tf-version.outputs.TF_VERSION }}-${{ matrix.python-version }}-cuda
cache-from: type=registry,ref=tensorflow/build:latest-${{ matrix.python-version }}-cuda
cache-to: type=inline
-
name: Image digest CUDA
run: echo ${{ steps.docker_build_cuda.outputs.digest }}
14 changes: 10 additions & 4 deletions tf_sig_build_dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ COPY --from=builder /dt7 /dt7
# CUDA must be cleaned up in the same command to prevent Docker layer bloating
COPY setup.sources.sh /setup.sources.sh
COPY setup.packages.sh /setup.packages.sh
COPY setup.cuda.sh /setup.cuda.sh
COPY devel.packages.txt /devel.packages.txt
RUN /setup.sources.sh && /setup.packages.sh /devel.packages.txt && /setup.cuda.sh
COPY devel.packages_common.txt /devel.packages_common.txt
RUN /setup.sources.sh
RUN /setup.packages.sh /devel.packages_common.txt

# Install various tools.
# - bats: bash unit testing framework
# - bazelisk: always use the correct bazel version
# - buildifier: clean bazel build deps
# - buildozer: clean bazel build deps
RUN git clone --branch v1.3.0 https://github.com/bats-core/bats-core.git && bats-core/install.sh /usr/local && rm -rf bats-core
RUN git clone --depth 1 --branch v1.3.0 https://github.com/bats-core/bats-core.git && bats-core/install.sh /usr/local && rm -rf bats-core
RUN wget https://github.com/bazelbuild/bazelisk/releases/download/v1.7.4/bazelisk-linux-amd64 -O /usr/local/bin/bazel && chmod +x /usr/local/bin/bazel
RUN wget https://github.com/bazelbuild/buildtools/releases/download/3.5.0/buildifier -O /usr/local/bin/buildifier && chmod +x /usr/local/bin/buildifier
RUN wget https://github.com/bazelbuild/buildtools/releases/download/3.5.0/buildozer -O /usr/local/bin/buildozer && chmod +x /usr/local/bin/buildozer
Expand All @@ -48,3 +48,9 @@ RUN /setup.python.sh $PYTHON_VERSION devel.requirements.txt
COPY devel.usertools /usertools
COPY devel.bashrc /root/.bashrc

################################################################################
FROM devel as devel-cuda
################################################################################
COPY setup.cuda.sh /setup.cuda.sh
COPY devel.packages_cuda.txt /devel.packages_cuda.txt
RUN /setup.packages.sh /devel.packages_cuda.txt && /setup.cuda.sh
13 changes: 8 additions & 5 deletions tf_sig_build_dockerfiles/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ Actions](https://github.com/tensorflow/build/blob/master/.github/workflows/docke

The tags are defined as such:

- The `latest` tags are kept up-to-date to build TensorFlow's `master` branch.
- The `latest` tags are kept up-to-date to build TensorFlow's `master` branch CPU only.
- The `latest-cuda` tags are kept up-to-date to build TensorFlow's `master` branch CPU and GPU/CUDA
- The `version number` tags target the corresponding TensorFlow version. We
continuously build the `current-tensorflow-version + 1` tag, so when a new
TensorFlow branch is cut, that Dockerfile is frozen to support that branch.
Expand Down Expand Up @@ -83,13 +84,15 @@ Now let's build `tf-nightly`.
- `tensorflow/build:latest-python3.9`
- `tensorflow/build:latest-python3.8`
- `tensorflow/build:latest-python3.7`

For this example we'll use `tensorflow/build:latest-python3.9`.
- `tensorflow/build:latest-python3.9-cuda`
- `tensorflow/build:latest-python3.8-cuda`
- `tensorflow/build:latest-python3.7-cuda`
For this example we'll use `tensorflow/build:latest-python3.9-cuda`.

3. Pull the container you decided to use.

```bash
docker pull tensorflow/build:latest-python3.9
docker pull tensorflow/build:latest-python3.9-cuda
```

4. Start a backgrounded Docker container with the three folders mounted.
Expand All @@ -115,7 +118,7 @@ Now let's build `tf-nightly`.
-v "/tmp/packages:/tf/pkg" \
-v "/tmp/tensorflow:/tf/tensorflow" \
-v "/tmp/bazelcache:/tf/cache" \
tensorflow/build:latest-python3.9 \
tensorflow/build:latest-python3.9-cuda \
bash
```

Expand Down
35 changes: 35 additions & 0 deletions tf_sig_build_dockerfiles/devel.packages_common.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# build-related tools
apt-transport-https
autoconf
automake
build-essential
ca-certificates
clang-8
clang-format
curl
ffmpeg
git
libcurl3-dev
libcurl4-openssl-dev
libfreetype6-dev
libhdf5-serial-dev
libssl-dev
libtool
libzmq3-dev
mlocate
moreutils
openjdk-11-jdk
openjdk-11-jre-headless
patchelf
pkg-config
python3-dev
python3-setuptools
rsync
software-properties-common
sudo
swig
unzip
vim
wget
zip
zlib1g-dev
Original file line number Diff line number Diff line change
Expand Up @@ -18,39 +18,3 @@ libnvinfer-plugin7=7.2.2-1+cuda11.1
libnvinfer7=7.2.2-1+cuda11.1
libnvinfer-dev=7.2.2-1+cuda11.1
libnvinfer-plugin-dev=7.2.2-1+cuda11.1

# Other build-related tools
apt-transport-https
autoconf
automake
build-essential
ca-certificates
clang-8
clang-format
curl
ffmpeg
git
libcurl3-dev
libcurl4-openssl-dev
libfreetype6-dev
libhdf5-serial-dev
libssl-dev
libtool
libzmq3-dev
mlocate
moreutils
openjdk-11-jdk
openjdk-11-jre-headless
patchelf
pkg-config
python3-dev
python3-setuptools
rsync
software-properties-common
sudo
swig
unzip
vim
wget
zip
zlib1g-dev