cpu and gpu Dockerfiles for ppc64le

Adding Dockerfile.cpu.ppc64le and Dockerfile.gpu.ppc64le to enable the ability
to do builds using docker on ppc64le. Also enables the ability to run
ci_sanity.sh (from ci_build.sh) on ppc64le.

Modified ci_build.sh and ci_parameterized_build.sh to accept container types
that start with cpu or gpu.

Added install_bazel_from_source.sh and install_buildifier_from_source.sh install
scripts to avoid installing x86 versions of the binaries. These scripts could be
used by other platforms in the future.
This commit is contained in:
William D. Irons 2018-06-18 13:08:29 -05:00
parent ff7e639944
commit 9ac856f657
7 changed files with 144 additions and 6 deletions

View File

@ -0,0 +1,19 @@
FROM ubuntu:16.04
LABEL maintainer="William Irons <wdirons@us.ibm.com>"
# Copy and run the install scripts.
COPY install/*.sh /install/
RUN /install/install_bootstrap_deb_packages.sh
RUN add-apt-repository -y ppa:openjdk-r/ppa
RUN /install/install_deb_packages.sh
RUN apt-get update && apt-get install -y libopenblas-dev
RUN /install/install_pip_packages.sh
RUN /install/install_bazel_from_source.sh
RUN /install/install_proto3.sh
RUN /install/install_buildifier_from_source.sh
RUN /install/install_auditwheel.sh
RUN /install/install_golang_ppc64el.sh
# Set up the master bazelrc configuration file.
COPY install/.bazelrc /etc/bazel.bazelrc

View File

@ -0,0 +1,27 @@
FROM nvidia/cuda-ppc64le:9.0-cudnn7-devel-ubuntu16.04
LABEL maintainer="William Irons <wdirons@us.ibm.com>"
# In the Ubuntu 16.04 images, cudnn is placed in system paths. Move them to
# /usr/local/cuda
RUN cp -P /usr/include/cudnn.h /usr/local/cuda/include
RUN cp -P /usr/lib/powerpc64le-linux-gnu/libcudnn* /usr/local/cuda/lib64
# Copy and run the install scripts.
COPY install/*.sh /install/
ARG DEBIAN_FRONTEND=noninteractive
RUN /install/install_bootstrap_deb_packages.sh
RUN add-apt-repository -y ppa:openjdk-r/ppa
RUN /install/install_deb_packages.sh
RUN apt-get update && apt-get install -y libopenblas-dev
RUN /install/install_pip_packages.sh
RUN /install/install_bazel_from_source.sh
RUN /install/install_golang_ppc64el.sh
# Set up the master bazelrc configuration file.
COPY install/.bazelrc /etc/bazel.bazelrc
ENV LD_LIBRARY_PATH /usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH
# Configure the build for our CUDA configuration.
ENV TF_NEED_CUDA 1
ENV TF_CUDA_COMPUTE_CAPABILITIES 3.0

View File

@ -79,7 +79,7 @@ if [[ "${CONTAINER_TYPE}" == "cmake" ]]; then
fi fi
# Use nvidia-docker if the container is GPU. # Use nvidia-docker if the container is GPU.
if [[ "${CONTAINER_TYPE}" == "gpu" ]]; then if [[ "${CONTAINER_TYPE}" == gpu* ]]; then
DOCKER_BINARY="nvidia-docker" DOCKER_BINARY="nvidia-docker"
else else
DOCKER_BINARY="docker" DOCKER_BINARY="docker"
@ -99,7 +99,7 @@ BUILD_TAG="${BUILD_TAG:-tf_ci}"
# Add extra params for cuda devices and libraries for GPU container. # Add extra params for cuda devices and libraries for GPU container.
# And clear them if we are not building for GPU. # And clear them if we are not building for GPU.
if [[ "${CONTAINER_TYPE}" != "gpu" ]]; then if [[ "${CONTAINER_TYPE}" != gpu* ]]; then
GPU_EXTRA_PARAMS="" GPU_EXTRA_PARAMS=""
fi fi

View File

@ -258,9 +258,9 @@ function set_script_variable() {
# Process container type # Process container type
if [[ ${CTYPE} == "cpu" ]] || [[ ${CTYPE} == "debian.jessie.cpu" ]]; then if [[ ${CTYPE} == cpu* ]] || [[ ${CTYPE} == "debian.jessie.cpu" ]]; then
: :
elif [[ ${CTYPE} == "gpu" ]]; then elif [[ ${CTYPE} == gpu* ]]; then
set_script_variable TF_NEED_CUDA 1 set_script_variable TF_NEED_CUDA 1
if [[ $TF_CUDA_CLANG == "1" ]]; then if [[ $TF_CUDA_CLANG == "1" ]]; then
@ -418,12 +418,12 @@ if [[ ${TF_BUILD_IS_PIP} == "no_pip" ]] ||
BAZEL_TARGET=${TF_BUILD_BAZEL_TARGET} BAZEL_TARGET=${TF_BUILD_BAZEL_TARGET}
fi fi
if [[ ${CTYPE} == "cpu" ]] || \ if [[ ${CTYPE} == cpu* ]] || \
[[ ${CTYPE} == "debian.jessie.cpu" ]]; then [[ ${CTYPE} == "debian.jessie.cpu" ]]; then
# CPU only command, fully parallel. # CPU only command, fully parallel.
NO_PIP_MAIN_CMD="${MAIN_CMD} ${BAZEL_CMD} ${OPT_FLAG} ${EXTRA_ARGS} -- "\ NO_PIP_MAIN_CMD="${MAIN_CMD} ${BAZEL_CMD} ${OPT_FLAG} ${EXTRA_ARGS} -- "\
"${BAZEL_TARGET}" "${BAZEL_TARGET}"
elif [[ ${CTYPE} == "gpu" ]]; then elif [[ ${CTYPE} == gpu* ]]; then
# GPU only command, run as many jobs as the GPU count only. # GPU only command, run as many jobs as the GPU count only.
NO_PIP_MAIN_CMD="${BAZEL_CMD} ${OPT_FLAG} "\ NO_PIP_MAIN_CMD="${BAZEL_CMD} ${OPT_FLAG} "\
"--local_test_jobs=${TF_GPU_COUNT} "\ "--local_test_jobs=${TF_GPU_COUNT} "\

View File

@ -0,0 +1,40 @@
#!/usr/bin/env bash
# Copyright 2018 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.
# ==============================================================================
# This script is to be used to install bzel on non x86_64 systems
# It will compile bazel from source and install it in /usr/local/bin
# Select bazel version.
BAZEL_VERSION="0.11.0"
set +e
local_bazel_ver=$(bazel version 2>&1 | grep -i label | awk '{print $3}')
if [[ "$local_bazel_ver" == "$BAZEL_VERSION" ]]; then
exit 0
fi
set -e
# Compile bazel from source
mkdir -p /bazel
cd /bazel
curl -fSsL -O https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-dist.zip
unzip bazel-$BAZEL_VERSION-dist.zip
bash ./compile.sh
cp output/bazel /usr/local/bin/
rm -rf /bazel

View File

@ -0,0 +1,30 @@
#!/usr/bin/env bash
# Copyright 2018 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.
# ==============================================================================
set -e
BUILDTOOLS_VERSION="0.11.1"
# Clone buildtools
git clone -b $BUILDTOOLS_VERSION https://github.com/bazelbuild/buildtools
cd buildtools
# Build buildifier
bazel build //buildifier
sudo mv bazel-bin/buildifier/linux*stripped/buildifier /usr/local/bin
# Build buildozer
bazel build //buildozer
sudo mv bazel-bin/buildozer/linux*stripped/buildozer /usr/local/bin

View File

@ -0,0 +1,22 @@
#!/usr/bin/env bash
# Copyright 2018 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.
# ==============================================================================
set -ex
GOLANG_URL="https://storage.googleapis.com/golang/go1.10.linux-ppc64le.tar.gz"
sudo mkdir -p /usr/local
wget -q -O - "${GOLANG_URL}" | sudo tar -C /usr/local -xz