Skip to content
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

Dockerfile.devel-gpu: optimize the size of the generated image #15355

Merged
merged 1 commit into from
Dec 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 1 addition & 4 deletions tensorflow/tools/docker/Dockerfile.devel
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,8 @@ RUN mkdir /bazel && \
rm -f /bazel/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh

# Download and build TensorFlow.

RUN git clone https://github.com/tensorflow/tensorflow.git && \
cd tensorflow && \
git checkout r1.4
WORKDIR /tensorflow
RUN git clone --branch=r1.4 --depth=1 https://github.com/tensorflow/tensorflow.git .

# TODO(craigcitro): Don't install the pip package, since it makes it
# more difficult to experiment with local changes. Instead, just add
Expand Down
23 changes: 14 additions & 9 deletions tensorflow/tools/docker/Dockerfile.devel-gpu
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04
FROM nvidia/cuda:9.0-base-ubuntu16.04

LABEL maintainer="Craig Citro <craigcitro@google.com>"

RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cuda-command-line-tools-9-0 \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noticed. TF also depends on libcupti.
Do we need to install that separately?

Copy link
Contributor Author

@flx42 flx42 Dec 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mentioned it in my original RFE: #15284

And there is still room for improvement in CUDA 9.1 when CUPTI has its own package (today we have to pull cuda-command-line-tools-9-0), or if we disable CUPTI tracing (not sure if possible).

In this image we need the compiler toolchain anyway, so CUPTI comes with it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ dpkg -S /usr/local/cuda-9.0/extras/CUPTI/lib64/libcupti.so.9.0.176
cuda-command-line-tools-9-0: /usr/local/cuda-9.0/extras/CUPTI/lib64/libcupti.so.9.0.176

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

cuda-cublas-dev-9-0 \
cuda-cudart-dev-9-0 \
cuda-cufft-dev-9-0 \
cuda-curand-dev-9-0 \
cuda-cusolver-dev-9-0 \
cuda-cusparse-dev-9-0 \
curl \
git \
libcudnn7=7.0.5.15-1+cuda9.0 \
libcudnn7-dev=7.0.5.15-1+cuda9.0 \
libcurl3-dev \
libfreetype6-dev \
libpng12-dev \
Expand All @@ -17,12 +26,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
unzip \
zip \
zlib1g-dev \
openjdk-8-jdk \
openjdk-8-jre-headless \
wget \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
rm -rf /var/lib/apt/lists/* && \
find /usr/local/cuda-9.0/lib64/ -type f -name 'lib*_static.a' -not -name 'libcudart_static.a' -delete && \
rm /usr/lib/x86_64-linux-gnu/libcudnn_static_v7.a

RUN curl -fSsL -O https://bootstrap.pypa.io/get-pip.py && \
python get-pip.py && \
Expand Down Expand Up @@ -70,11 +78,8 @@ RUN mkdir /bazel && \
rm -f /bazel/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh

# Download and build TensorFlow.

RUN git clone https://github.com/tensorflow/tensorflow.git && \
cd tensorflow && \
git checkout r1.4
WORKDIR /tensorflow
RUN git clone --branch=r1.4 --depth=1 https://github.com/tensorflow/tensorflow.git .

# Configure the build for our CUDA configuration.
ENV CI_BUILD_PYTHON python
Expand Down
2 changes: 1 addition & 1 deletion tensorflow/tools/docker/parameterized_docker_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ else
DOCKERFILE="${TMP_DIR}/Dockerfile"

# Modify the devel Dockerfile to specify the git branch
sed -r "s/([\s]*git checkout )(.*)/\1${TF_DOCKER_BUILD_DEVEL_BRANCH}/g" \
sed "s/^RUN git clone --branch=.* --depth=1/RUN git clone --branch=${TF_DOCKER_BUILD_DEVEL_BRANCH} --depth=1/" \
"${ORIG_DOCKERFILE}" > "${DOCKERFILE}"

# Modify python/pip version if necessary.
Expand Down