From 5911c8a43ed0b7700eaf713e5737e4caff105ec8 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Mon, 25 Mar 2019 11:48:24 -0700 Subject: [PATCH] n/a PiperOrigin-RevId: 240186934 --- .../Dockerfile.rbe.cuda10.0-cudnn7-centos7 | 60 +++++++++++++++++++ .../Dockerfile.rbe.cuda10.0-cudnn7-centos7.sh | 42 +++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 tensorflow/tools/ci_build/Dockerfile.rbe.cuda10.0-cudnn7-centos7 create mode 100755 tensorflow/tools/ci_build/Dockerfile.rbe.cuda10.0-cudnn7-centos7.sh diff --git a/tensorflow/tools/ci_build/Dockerfile.rbe.cuda10.0-cudnn7-centos7 b/tensorflow/tools/ci_build/Dockerfile.rbe.cuda10.0-cudnn7-centos7 new file mode 100644 index 00000000000..a98997b5444 --- /dev/null +++ b/tensorflow/tools/ci_build/Dockerfile.rbe.cuda10.0-cudnn7-centos7 @@ -0,0 +1,60 @@ +# To push a new version: +# 1. Download tensorrt from +# https://developer.nvidia.com/nvidia-tensorrt-5x-download +# and copy it into /tmp. +# 2. $ ./Dockerfile.rbe.cuda10.0-cudnn7-centos.sh +# 3. $ docker push gcr.io/tensorflow-testing/nosla-cuda10.0-cudnn7-centos7 +# +# We can't currently build this Dockerfile directly: +# tensorrt for centos is only availble via a authenticated download link from +# nvidia, and it's larger than citc's max file size. +# To work around this, we create a Docker environment in /tmp to build the +# image from in a shell script (2). + +FROM nvidia/cuda:10.0-cudnn7-devel-centos7 +LABEL maintainer="Manuel Klimek " + +# Install packages required to build tensorflow. +RUN yum install -y centos-release-scl && \ + yum install -y \ + devtoolset-7 \ + java-1.8.0-openjdk-devel \ + patch \ + rh-python34 \ + wget && \ + yum clean all -y + +# TODO(klimek): Once nvidia provides a way to install tensorrt from within +# docker, switch to that. Until then, we copy the tensorrt rpm into the docker +# environment. +ADD tensorrt.rpm tensorrt.rpm +RUN rpm -ihv tensorrt.rpm && \ + yum install -y --nogpgcheck tensorrt && \ + rm -f tensorrt.rpm + +# Enable devtoolset-7 and rh-python34 in the docker image. +env PATH="/opt/rh/rh-python34/root/usr/bin:/opt/rh/devtoolset-7/root/usr/bin:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \ + LD_LIBRARY_PATH="/opt/rh/rh-python34/root/usr/lib64:/opt/rh/devtoolset-7/root/usr/lib64:/opt/rh/devtoolset-7/root/usr/lib:/opt/rh/devtoolset-7/root/usr/lib64/dyninst:/opt/rh/devtoolset-7/root/usr/lib/dyninst:/opt/rh/devtoolset-7/root/usr/lib64:/opt/rh/devtoolset-7/root/usr/lib:/usr/local/nvidia/lib:/usr/local/nvidia/lib64" \ + PCP_DIR="/opt/rh/devtoolset-7/root" \ + PERL5LIB="/opt/rh/devtoolset-7/root//usr/lib64/perl5/vendor_perl:/opt/rh/devtoolset-7/root/usr/lib/perl5:/opt/rh/devtoolset-7/root//usr/share/perl5/vendor_perl" \ + PKG_CONFIG_PATH="/opt/rh/rh-python34/root/usr/lib64/pkgconfig/" + +# Install pip packages needed to build tensorflow. +COPY install/*.sh /install/ +RUN grep -E 'easy_install |pip3' install/install_pip_packages.sh \ + | grep -v 'no-binary=:all:' \ + > install/centos_pip_packages.sh && \ + bash install/centos_pip_packages.sh + +# Install a /usr/bin/python3 link. +# centos by default does not provide links, and instead relies on paths into +# /opt/ to switch to alternative configurations. For bazel remote builds, +# the python path between the local machine running bazel and the remote setup +# must be the same. +RUN update-alternatives --install /usr/bin/python3 python3 /opt/rh/rh-python34/root/usr/bin/python3 0 + +# Install a ubuntu-compatible openjdk link so that ubuntu JAVA_HOME works +# for this image. +# TODO(klimek): Figure out a way to specify a different remote java path from +# the local one. +RUN ln -s /usr/lib/jvm/java /usr/lib/jvm/java-8-openjdk-amd64 diff --git a/tensorflow/tools/ci_build/Dockerfile.rbe.cuda10.0-cudnn7-centos7.sh b/tensorflow/tools/ci_build/Dockerfile.rbe.cuda10.0-cudnn7-centos7.sh new file mode 100755 index 00000000000..80568a10d33 --- /dev/null +++ b/tensorflow/tools/ci_build/Dockerfile.rbe.cuda10.0-cudnn7-centos7.sh @@ -0,0 +1,42 @@ +#!/bin/bash -eux +# Copyright 2019 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== +# +# Script to create a centos7 docker image. +# Before running, copy tensorrt into /tmp after downlading it from: +# https://developer.nvidia.com/nvidia-tensorrt-5x-download +# +# TODO(klimek): once there are downloadable images for tensorrt for centos7 +# similar to debian, use those. +# +# Note that this creates a lot of large files in your filesystem: +# 1. The tensorrt rpm itself in your downloads folder. +# 2. The tensorrt copy in /tmp. +# 3. For each time this script is run and fails, there's a remaining copy +# in the corresponding /tmp directory. +# 4. The docker cache grows large very quickly. +# +# To clean up failed script runs: +# $ rm /tmp/*/*.rpm + +WORKDIR="$(mktemp -d)" +BASE="$(pwd)" +cp -R "${BASE}/"* "${WORKDIR}/" +cp "/tmp/nv-tensorrt-repo-rhel7-cuda10.0-trt5.0.2.6-ga-20181010-1-1.x86_64.rpm" "${WORKDIR}/tensorrt.rpm" +cd "${WORKDIR}" +docker build -f Dockerfile.rbe.cuda10.0-cudnn7-centos7 \ + --tag "gcr.io/tensorflow-testing/nosla-cuda10.0-cudnn7-centos7" . +cd "${BASE}" +rm -rf "${WORKDIR}"