-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
793 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fargate/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fargate/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
services: | ||
- docker | ||
|
||
script: | ||
- ./build.sh && ./push.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
# 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. | ||
# ============================================================================ | ||
|
||
# adapted from https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/dockerfiles/dockerfiles/gpu.Dockerfile | ||
|
||
ARG UBUNTU_VERSION=16.04 | ||
|
||
FROM nvidia/cuda:9.0-base-ubuntu${UBUNTU_VERSION} as base | ||
|
||
# For CUDA profiling, TensorFlow requires CUPTI. | ||
ENV LD_LIBRARY_PATH /usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH | ||
|
||
ARG PYTHON=python3 | ||
|
||
ENV TF_NEED_CUDA 1 | ||
ENV TF_NEED_TENSORRT 1 | ||
ENV TF_CUDA_COMPUTE_CAPABILITIES=3.5,5.2,6.0,6.1,7.0 | ||
ENV TF_CUDA_VERSION=9.0 | ||
ENV TF_CUDNN_VERSION=7 | ||
|
||
# NCCL 2.x | ||
ENV TF_NCCL_VERSION=2 | ||
|
||
# See http://bugs.python.org/issue19846 | ||
ENV LANG C.UTF-8 | ||
|
||
COPY bashrc /etc/bash.bashrc | ||
|
||
# Pick up some TF dependencies | ||
RUN chmod a+rx /etc/bash.bashrc \ | ||
&& apt-get update && apt-get install -y --no-install-recommends \ | ||
git \ | ||
time \ | ||
build-essential \ | ||
cuda-command-line-tools-9-0 \ | ||
cuda-cublas-9-0 \ | ||
cuda-cufft-9-0 \ | ||
cuda-curand-9-0 \ | ||
cuda-cusolver-9-0 \ | ||
cuda-cusparse-9-0 \ | ||
curl \ | ||
libcudnn7=7.2.1.38-1+cuda9.0 \ | ||
libnccl2=2.2.13-1+cuda9.0 \ | ||
libfreetype6-dev \ | ||
libhdf5-serial-dev \ | ||
libpng12-dev \ | ||
libzmq3-dev \ | ||
pkg-config \ | ||
rsync \ | ||
software-properties-common \ | ||
unzip \ | ||
&& apt-get update \ | ||
&& apt-get install nvinfer-runtime-trt-repo-ubuntu1604-4.0.1-ga-cuda9.0 \ | ||
&& apt-get update \ | ||
&& apt-get install libnvinfer4=4.1.2-1+cuda9.0 \ | ||
&& apt-get update && apt-get install -y \ | ||
${PYTHON} \ | ||
${PYTHON}-pip \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& ln -s $(which ${PYTHON}) /usr/local/bin/python # Copyright 2018 The TensorFlow Authors. All Rights Reserved. | ||
|
||
RUN git clone https://github.com/tensorflow/benchmarks.git \ | ||
&& cd /benchmarks/ \ | ||
&& git checkout cnn_tf_v1.9_compatible | ||
|
||
WORKDIR /benchmarks/scripts/tf_cnn_benchmarks/ | ||
CMD time python tf_cnn_benchmarks.py --batch_size=32 --model=resnet50 --variable_update=parameter_server --data_format=NHWC --device=cpu --summary_verbosity=1 | ||
|
||
FROM base AS tensorflow-cpu | ||
ARG PIP=pip3 | ||
|
||
# Options: | ||
# tensorflow | ||
# tensorflow-gpu | ||
# tf-nightly | ||
# tf-nightly-gpu | ||
ARG TF_PACKAGE=tensorflow | ||
RUN ${PIP} install --no-cache-dir ${TF_PACKAGE} | ||
|
||
FROM base AS tensorflow-gpu | ||
ARG PIP=pip3 | ||
|
||
ENV GPU=1 | ||
ENV BATCH_SIZE=32 | ||
|
||
# Options: | ||
# tensorflow | ||
# tensorflow-gpu | ||
# tf-nightly | ||
# tf-nightly-gpu | ||
ARG TF_PACKAGE=tensorflow-gpu | ||
RUN ${PIP} install --no-cache-dir ${TF_PACKAGE} | ||
|
||
WORKDIR /benchmarks/scripts/tf_cnn_benchmarks/ | ||
CMD time python tf_cnn_benchmarks.py --num_gpus=$GPU --batch_size=$BATCH_SIZE --model=resnet50 --variable_update=parameter_server --data_format=NHWC --device=gpu --summary_verbosity=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
[](https://travis-ci.org/brentley/tensorflow-container) | ||
|
||
This is a sample tensorflow container used to test cpu and gpu support on ECS. | ||
|
||
See corresponding blog post: | ||
|
||
``` | ||
export PATH=$HOME/.local/bin:$HOME/bin:$PATH >> ~/.bash_profile | ||
source ~/.bash_profile | ||
pip install --user -U awscli | ||
``` | ||
|
||
``` | ||
aws cloudformation deploy --stack-name tensorflow-test --template-file cluster-cpu-gpu.yml --capabilities CAPABILITY_IAM | ||
aws cloudformation deploy --stack-name tensorflow-cpu-taskdef --template-file task-cpu.yml | ||
aws ecs register-task-definition --cli-input-json file://gpu-1-taskdef.json | ||
``` | ||
|
||
``` | ||
export cluster=$(aws cloudformation describe-stacks --stack-name tensorflow-test --query 'Stacks[0].Outputs[?OutputKey==`ClusterName`].OutputValue' --output text) | ||
echo $cluster | ||
``` | ||
|
||
``` | ||
aws ecs run-task --cluster $cluster --task-definition tensorflow-cpu | ||
aws ecs run-task --cluster $cluster --task-definition tensorflow-gpu | ||
``` | ||
|
||
``` | ||
aws cloudformation deploy --stack-name tensorflow-test --template-file cluster-cpu-gpu.yml --parameter-overrides GPUInstanceType=p3.16xlarge --capabilities CAPABILITY_IAM | ||
``` | ||
|
||
``` | ||
aws ecs register-task-definition --cli-input-json file://gpu-4-taskdef.json | ||
aws ecs register-task-definition --cli-input-json file://gpu-8-taskdef.json | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
opyright 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. | ||
# | ||
# ============================================================================== | ||
|
||
export PS1="\[\e[31m\]tf-docker\[\e[m\] \[\e[33m\]\w\[\e[m\] > " | ||
export TERM=xterm-256color | ||
alias grep="grep --color=auto" | ||
alias ls="ls --color=auto" | ||
|
||
echo -e "\e[1;31m" | ||
cat<<TF | ||
________ _______________ | ||
___ __/__________________________________ ____/__ /________ __ | ||
__ / _ _ \_ __ \_ ___/ __ \_ ___/_ /_ __ /_ __ \_ | /| / / | ||
_ / / __/ / / /(__ )/ /_/ / / _ __/ _ / / /_/ /_ |/ |/ / | ||
/_/ \___//_/ /_//____/ \____//_/ /_/ /_/ \____/____/|__/ | ||
TF | ||
echo -e "\e[0;33m" | ||
|
||
if [[ $EUID -eq 0 ]]; then | ||
cat <<WARN | ||
WARNING: You are running this container as root, which can cause new files in | ||
mounted volumes to be created as the root user on your host machine. | ||
To avoid this, run the container by specifying your user's userid: | ||
$ docker run -u \$(id -u):\$(id -g) args... | ||
WARN | ||
else | ||
cat <<EXPL | ||
You are running this container as user with ID $(id -u) and group $(id -g), | ||
which should map to the ID and group for your user on the Docker host. Great! | ||
EXPL | ||
fi | ||
|
||
# Turn off colors | ||
echo -e "\e[m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
DOCKER_ID=${DOCKER_USERNAME} | ||
GIT_TAG=$(git rev-parse --short HEAD) | ||
|
||
for i in cpu gpu | ||
do | ||
docker build -t ${DOCKER_ID}/tensorflow-${i}:${GIT_TAG} --target tensorflow-${i} . | ||
docker tag ${DOCKER_ID}/tensorflow-${i}:${GIT_TAG} ${DOCKER_ID}/tensorflow-${i}:latest | ||
done |
Oops, something went wrong.