From 51b5cb0415d61acd7603982c74d9b26ba9a87662 Mon Sep 17 00:00:00 2001 From: yuyang18 Date: Tue, 30 Aug 2016 05:21:28 +0000 Subject: [PATCH] Split Dockerfile into multiple. to fit hub.docker.com ISSUE=4589547 git-svn-id: https://svn.baidu.com/idl/trunk/paddle@1417 1ad973e4-5ce8-4261-8a94-b56d1f490c56 --- paddle/scripts/docker/Dockerfile.m4 | 11 +++ .../scripts/docker/{ => cpu-demo}/Dockerfile | 12 +-- paddle/scripts/docker/cpu-demo/build.sh | 79 +++++++++++++++++++ paddle/scripts/docker/cpu-devel/Dockerfile | 11 +++ paddle/scripts/docker/cpu-devel/build.sh | 79 +++++++++++++++++++ paddle/scripts/docker/cpu/Dockerfile | 11 +++ paddle/scripts/docker/cpu/build.sh | 79 +++++++++++++++++++ paddle/scripts/docker/generate.sh | 28 +++++++ paddle/scripts/docker/gpu-demo/Dockerfile | 11 +++ paddle/scripts/docker/gpu-demo/build.sh | 79 +++++++++++++++++++ paddle/scripts/docker/gpu-devel/Dockerfile | 11 +++ paddle/scripts/docker/gpu-devel/build.sh | 79 +++++++++++++++++++ paddle/scripts/docker/gpu/Dockerfile | 11 +++ paddle/scripts/docker/gpu/build.sh | 79 +++++++++++++++++++ 14 files changed, 574 insertions(+), 6 deletions(-) create mode 100644 paddle/scripts/docker/Dockerfile.m4 rename paddle/scripts/docker/{ => cpu-demo}/Dockerfile (64%) create mode 100644 paddle/scripts/docker/cpu-demo/build.sh create mode 100644 paddle/scripts/docker/cpu-devel/Dockerfile create mode 100644 paddle/scripts/docker/cpu-devel/build.sh create mode 100644 paddle/scripts/docker/cpu/Dockerfile create mode 100644 paddle/scripts/docker/cpu/build.sh create mode 100644 paddle/scripts/docker/generate.sh create mode 100644 paddle/scripts/docker/gpu-demo/Dockerfile create mode 100644 paddle/scripts/docker/gpu-demo/build.sh create mode 100644 paddle/scripts/docker/gpu-devel/Dockerfile create mode 100644 paddle/scripts/docker/gpu-devel/build.sh create mode 100644 paddle/scripts/docker/gpu/Dockerfile create mode 100644 paddle/scripts/docker/gpu/build.sh diff --git a/paddle/scripts/docker/Dockerfile.m4 b/paddle/scripts/docker/Dockerfile.m4 new file mode 100644 index 00000000000..1e45889ad18 --- /dev/null +++ b/paddle/scripts/docker/Dockerfile.m4 @@ -0,0 +1,11 @@ +FROM ubuntu:14.04 +MAINTAINER PaddlePaddle Dev Team +COPY build.sh /root/ +ENV LOWEST_DL_SPEED=0 +ENV WITH_GPU=PADDLE_WITH_GPU +ENV IS_DEVEL=PADDLE_IS_DEVEL +ENV WITH_DEMO=PADDLE_WITH_DEMO +ENV PIP_INSTALL_ARGS +ENV PIP_GENERAL_ARGS +ENV CUDNN_DOWNLOAD_SUM 40d506d0a8a00a3faccce1433346806b8cd2535683b6f08a63683ce6e474419f +RUN cd /root/ && bash build.sh diff --git a/paddle/scripts/docker/Dockerfile b/paddle/scripts/docker/cpu-demo/Dockerfile similarity index 64% rename from paddle/scripts/docker/Dockerfile rename to paddle/scripts/docker/cpu-demo/Dockerfile index 625f2a0d632..0affeccb727 100644 --- a/paddle/scripts/docker/Dockerfile +++ b/paddle/scripts/docker/cpu-demo/Dockerfile @@ -1,11 +1,11 @@ FROM ubuntu:14.04 MAINTAINER PaddlePaddle Dev Team COPY build.sh /root/ -ARG LOWEST_DL_SPEED=0 -ARG WITH_GPU=OFF -ARG IS_DEVEL=OFF -ARG WITH_DEMO=OFF -ARG PIP_INSTALL_ARGS -ARG PIP_GENERAL_ARGS +ENV LOWEST_DL_SPEED=0 +ENV WITH_GPU=OFF +ENV IS_DEVEL=ON +ENV WITH_DEMO=ON +ENV PIP_INSTALL_ARGS +ENV PIP_GENERAL_ARGS ENV CUDNN_DOWNLOAD_SUM 40d506d0a8a00a3faccce1433346806b8cd2535683b6f08a63683ce6e474419f RUN cd /root/ && bash build.sh diff --git a/paddle/scripts/docker/cpu-demo/build.sh b/paddle/scripts/docker/cpu-demo/build.sh new file mode 100644 index 00000000000..be59c325b19 --- /dev/null +++ b/paddle/scripts/docker/cpu-demo/build.sh @@ -0,0 +1,79 @@ +#!/bin/bash + +function abort(){ + echo "An error occurred. Exiting..." 1>&2 + exit 1 +} + +trap 'abort' 0 +set -e +sed -i 's#http://archive\.ubuntu\.com/ubuntu/#mirror://mirrors\.ubuntu\.com/mirrors\.txt#g' /etc/apt/sources.list +apt-get update +apt-get install -y cmake libprotobuf-dev protobuf-compiler git \ + libgoogle-glog-dev libgflags-dev libatlas-dev libatlas3-base g++ m4 python-pip\ + python-protobuf python-numpy python-dev swig + +if [ ${WITH_GPU} == "ON" ]; then # install cuda + cd ~ + apt-get install -y aria2 wget + echo "Downloading cuda tookit" + set +e + for ((i=0; i<100; i++)) + do + aria2c -x 10 -s 10 --lowest-speed-limit=${LOWEST_DL_SPEED} http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run + if [ $? -eq 0 ]; then + break + fi + done + + set -e + wget http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run.md5 + md5sum -c cuda_7.5.18_linux.run.md5 + chmod +x cuda_7.5.18_linux.run + ./cuda_7.5.18_linux.run --extract=$PWD + ./cuda-linux64-rel-7.5.18-19867135.run -noprompt + rm *.run *.run.md5 + + echo "Downloading cudnn v5.1" + set +e + for ((i=0; i<100; i++)) + do + aria2c -x 10 --lowest-speed-limit=${LOWEST_DL_SPEED} http://developer.download.nvidia.com/compute/redist/cudnn/v5.1/cudnn-7.5-linux-x64-v5.1.tgz + if [ $? -eq 0 ]; then + break + fi + done + set -e + echo "$CUDNN_DOWNLOAD_SUM cudnn-7.5-linux-x64-v5.1.tgz" | sha256sum -c --strict - + tar -xzf cudnn-7.5-linux-x64-v5.1.tgz -C /usr/local + rm cudnn-7.5-linux-x64-v5.1.tgz + ldconfig + export PATH=/usr/local/cuda/bin:$PATH + apt-get purge -y aria2 +fi +set -e +cd ~ +git clone https://github.com/baidu/Paddle.git paddle +cd paddle +mkdir build +cd build +cmake .. -DWITH_DOC=OFF -DWITH_GPU=${WITH_GPU} -DWITH_SWIG_PY=ON +make -j `nproc` +# because durning make install, there are several warning, so set +e, do not cause abort +make install +echo 'export LD_LIBRARY_PATH=/usr/lib64:${LD_LIBRARY_PATH}' >> /etc/profile +pip ${PIP_GENERAL_ARGS} install ${PIP_INSTALL_ARGS} /usr/local/opt/paddle/share/wheels/*.whl +paddle version # print version after build + +if [ ${WITH_DEMO} == "ON" ]; then + apt-get install -y wget unzip perl python-matplotlib tar xz-utils bzip2 gzip coreutils\ + sed grep graphviz + pip ${PIP_GENERAL_ARGS} install ${PIP_INSTALL_ARGS} BeautifulSoup docopt PyYAML +fi +if [ ${IS_DEVEL} == "OFF" ]; then # clean build packages. + cd ~ + # TODO(yuyang18): Do clean for devel package, and cuda devel tools + rm -rf paddle +fi +apt-get clean -y +trap : 0 diff --git a/paddle/scripts/docker/cpu-devel/Dockerfile b/paddle/scripts/docker/cpu-devel/Dockerfile new file mode 100644 index 00000000000..5c611bfb0a6 --- /dev/null +++ b/paddle/scripts/docker/cpu-devel/Dockerfile @@ -0,0 +1,11 @@ +FROM ubuntu:14.04 +MAINTAINER PaddlePaddle Dev Team +COPY build.sh /root/ +ENV LOWEST_DL_SPEED=0 +ENV WITH_GPU=OFF +ENV IS_DEVEL=ON +ENV WITH_DEMO=OFF +ENV PIP_INSTALL_ARGS +ENV PIP_GENERAL_ARGS +ENV CUDNN_DOWNLOAD_SUM 40d506d0a8a00a3faccce1433346806b8cd2535683b6f08a63683ce6e474419f +RUN cd /root/ && bash build.sh diff --git a/paddle/scripts/docker/cpu-devel/build.sh b/paddle/scripts/docker/cpu-devel/build.sh new file mode 100644 index 00000000000..be59c325b19 --- /dev/null +++ b/paddle/scripts/docker/cpu-devel/build.sh @@ -0,0 +1,79 @@ +#!/bin/bash + +function abort(){ + echo "An error occurred. Exiting..." 1>&2 + exit 1 +} + +trap 'abort' 0 +set -e +sed -i 's#http://archive\.ubuntu\.com/ubuntu/#mirror://mirrors\.ubuntu\.com/mirrors\.txt#g' /etc/apt/sources.list +apt-get update +apt-get install -y cmake libprotobuf-dev protobuf-compiler git \ + libgoogle-glog-dev libgflags-dev libatlas-dev libatlas3-base g++ m4 python-pip\ + python-protobuf python-numpy python-dev swig + +if [ ${WITH_GPU} == "ON" ]; then # install cuda + cd ~ + apt-get install -y aria2 wget + echo "Downloading cuda tookit" + set +e + for ((i=0; i<100; i++)) + do + aria2c -x 10 -s 10 --lowest-speed-limit=${LOWEST_DL_SPEED} http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run + if [ $? -eq 0 ]; then + break + fi + done + + set -e + wget http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run.md5 + md5sum -c cuda_7.5.18_linux.run.md5 + chmod +x cuda_7.5.18_linux.run + ./cuda_7.5.18_linux.run --extract=$PWD + ./cuda-linux64-rel-7.5.18-19867135.run -noprompt + rm *.run *.run.md5 + + echo "Downloading cudnn v5.1" + set +e + for ((i=0; i<100; i++)) + do + aria2c -x 10 --lowest-speed-limit=${LOWEST_DL_SPEED} http://developer.download.nvidia.com/compute/redist/cudnn/v5.1/cudnn-7.5-linux-x64-v5.1.tgz + if [ $? -eq 0 ]; then + break + fi + done + set -e + echo "$CUDNN_DOWNLOAD_SUM cudnn-7.5-linux-x64-v5.1.tgz" | sha256sum -c --strict - + tar -xzf cudnn-7.5-linux-x64-v5.1.tgz -C /usr/local + rm cudnn-7.5-linux-x64-v5.1.tgz + ldconfig + export PATH=/usr/local/cuda/bin:$PATH + apt-get purge -y aria2 +fi +set -e +cd ~ +git clone https://github.com/baidu/Paddle.git paddle +cd paddle +mkdir build +cd build +cmake .. -DWITH_DOC=OFF -DWITH_GPU=${WITH_GPU} -DWITH_SWIG_PY=ON +make -j `nproc` +# because durning make install, there are several warning, so set +e, do not cause abort +make install +echo 'export LD_LIBRARY_PATH=/usr/lib64:${LD_LIBRARY_PATH}' >> /etc/profile +pip ${PIP_GENERAL_ARGS} install ${PIP_INSTALL_ARGS} /usr/local/opt/paddle/share/wheels/*.whl +paddle version # print version after build + +if [ ${WITH_DEMO} == "ON" ]; then + apt-get install -y wget unzip perl python-matplotlib tar xz-utils bzip2 gzip coreutils\ + sed grep graphviz + pip ${PIP_GENERAL_ARGS} install ${PIP_INSTALL_ARGS} BeautifulSoup docopt PyYAML +fi +if [ ${IS_DEVEL} == "OFF" ]; then # clean build packages. + cd ~ + # TODO(yuyang18): Do clean for devel package, and cuda devel tools + rm -rf paddle +fi +apt-get clean -y +trap : 0 diff --git a/paddle/scripts/docker/cpu/Dockerfile b/paddle/scripts/docker/cpu/Dockerfile new file mode 100644 index 00000000000..ddefe6a413b --- /dev/null +++ b/paddle/scripts/docker/cpu/Dockerfile @@ -0,0 +1,11 @@ +FROM ubuntu:14.04 +MAINTAINER PaddlePaddle Dev Team +COPY build.sh /root/ +ENV LOWEST_DL_SPEED=0 +ENV WITH_GPU=OFF +ENV IS_DEVEL=OFF +ENV WITH_DEMO=OFF +ENV PIP_INSTALL_ARGS +ENV PIP_GENERAL_ARGS +ENV CUDNN_DOWNLOAD_SUM 40d506d0a8a00a3faccce1433346806b8cd2535683b6f08a63683ce6e474419f +RUN cd /root/ && bash build.sh diff --git a/paddle/scripts/docker/cpu/build.sh b/paddle/scripts/docker/cpu/build.sh new file mode 100644 index 00000000000..be59c325b19 --- /dev/null +++ b/paddle/scripts/docker/cpu/build.sh @@ -0,0 +1,79 @@ +#!/bin/bash + +function abort(){ + echo "An error occurred. Exiting..." 1>&2 + exit 1 +} + +trap 'abort' 0 +set -e +sed -i 's#http://archive\.ubuntu\.com/ubuntu/#mirror://mirrors\.ubuntu\.com/mirrors\.txt#g' /etc/apt/sources.list +apt-get update +apt-get install -y cmake libprotobuf-dev protobuf-compiler git \ + libgoogle-glog-dev libgflags-dev libatlas-dev libatlas3-base g++ m4 python-pip\ + python-protobuf python-numpy python-dev swig + +if [ ${WITH_GPU} == "ON" ]; then # install cuda + cd ~ + apt-get install -y aria2 wget + echo "Downloading cuda tookit" + set +e + for ((i=0; i<100; i++)) + do + aria2c -x 10 -s 10 --lowest-speed-limit=${LOWEST_DL_SPEED} http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run + if [ $? -eq 0 ]; then + break + fi + done + + set -e + wget http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run.md5 + md5sum -c cuda_7.5.18_linux.run.md5 + chmod +x cuda_7.5.18_linux.run + ./cuda_7.5.18_linux.run --extract=$PWD + ./cuda-linux64-rel-7.5.18-19867135.run -noprompt + rm *.run *.run.md5 + + echo "Downloading cudnn v5.1" + set +e + for ((i=0; i<100; i++)) + do + aria2c -x 10 --lowest-speed-limit=${LOWEST_DL_SPEED} http://developer.download.nvidia.com/compute/redist/cudnn/v5.1/cudnn-7.5-linux-x64-v5.1.tgz + if [ $? -eq 0 ]; then + break + fi + done + set -e + echo "$CUDNN_DOWNLOAD_SUM cudnn-7.5-linux-x64-v5.1.tgz" | sha256sum -c --strict - + tar -xzf cudnn-7.5-linux-x64-v5.1.tgz -C /usr/local + rm cudnn-7.5-linux-x64-v5.1.tgz + ldconfig + export PATH=/usr/local/cuda/bin:$PATH + apt-get purge -y aria2 +fi +set -e +cd ~ +git clone https://github.com/baidu/Paddle.git paddle +cd paddle +mkdir build +cd build +cmake .. -DWITH_DOC=OFF -DWITH_GPU=${WITH_GPU} -DWITH_SWIG_PY=ON +make -j `nproc` +# because durning make install, there are several warning, so set +e, do not cause abort +make install +echo 'export LD_LIBRARY_PATH=/usr/lib64:${LD_LIBRARY_PATH}' >> /etc/profile +pip ${PIP_GENERAL_ARGS} install ${PIP_INSTALL_ARGS} /usr/local/opt/paddle/share/wheels/*.whl +paddle version # print version after build + +if [ ${WITH_DEMO} == "ON" ]; then + apt-get install -y wget unzip perl python-matplotlib tar xz-utils bzip2 gzip coreutils\ + sed grep graphviz + pip ${PIP_GENERAL_ARGS} install ${PIP_INSTALL_ARGS} BeautifulSoup docopt PyYAML +fi +if [ ${IS_DEVEL} == "OFF" ]; then # clean build packages. + cd ~ + # TODO(yuyang18): Do clean for devel package, and cuda devel tools + rm -rf paddle +fi +apt-get clean -y +trap : 0 diff --git a/paddle/scripts/docker/generate.sh b/paddle/scripts/docker/generate.sh new file mode 100644 index 00000000000..5040aa149de --- /dev/null +++ b/paddle/scripts/docker/generate.sh @@ -0,0 +1,28 @@ +#!/bin/bash +set -e +cd `dirname $0` +m4 -DPADDLE_WITH_GPU=OFF -DPADDLE_IS_DEVEL=OFF -DPADDLE_WITH_DEMO=OFF \ + Dockerfile.m4 > cpu/Dockerfile +cp build.sh cpu/ + +m4 -DPADDLE_WITH_GPU=OFF -DPADDLE_IS_DEVEL=ON -DPADDLE_WITH_DEMO=OFF \ + Dockerfile.m4 > cpu-devel/Dockerfile +cp build.sh cpu-devel/ + +m4 -DPADDLE_WITH_GPU=OFF -DPADDLE_IS_DEVEL=ON -DPADDLE_WITH_DEMO=ON \ + Dockerfile.m4 > cpu-demo/Dockerfile +cp build.sh cpu-demo/ + +m4 -DPADDLE_WITH_GPU=ON -DPADDLE_IS_DEVEL=OFF -DPADDLE_WITH_DEMO=OFF \ + Dockerfile.m4 > gpu/Dockerfile +cp build.sh gpu/ + +m4 -DPADDLE_WITH_GPU=ON -DPADDLE_IS_DEVEL=ON -DPADDLE_WITH_DEMO=OFF \ + Dockerfile.m4 > gpu-devel/Dockerfile +cp build.sh gpu-devel/ + +m4 -DPADDLE_WITH_GPU=ON -DPADDLE_IS_DEVEL=ON -DPADDLE_WITH_DEMO=ON \ + Dockerfile.m4 > gpu-demo/Dockerfile +cp build.sh gpu-demo/ + + diff --git a/paddle/scripts/docker/gpu-demo/Dockerfile b/paddle/scripts/docker/gpu-demo/Dockerfile new file mode 100644 index 00000000000..0688887f37f --- /dev/null +++ b/paddle/scripts/docker/gpu-demo/Dockerfile @@ -0,0 +1,11 @@ +FROM ubuntu:14.04 +MAINTAINER PaddlePaddle Dev Team +COPY build.sh /root/ +ENV LOWEST_DL_SPEED=0 +ENV WITH_GPU=ON +ENV IS_DEVEL=ON +ENV WITH_DEMO=ON +ENV PIP_INSTALL_ARGS +ENV PIP_GENERAL_ARGS +ENV CUDNN_DOWNLOAD_SUM 40d506d0a8a00a3faccce1433346806b8cd2535683b6f08a63683ce6e474419f +RUN cd /root/ && bash build.sh diff --git a/paddle/scripts/docker/gpu-demo/build.sh b/paddle/scripts/docker/gpu-demo/build.sh new file mode 100644 index 00000000000..be59c325b19 --- /dev/null +++ b/paddle/scripts/docker/gpu-demo/build.sh @@ -0,0 +1,79 @@ +#!/bin/bash + +function abort(){ + echo "An error occurred. Exiting..." 1>&2 + exit 1 +} + +trap 'abort' 0 +set -e +sed -i 's#http://archive\.ubuntu\.com/ubuntu/#mirror://mirrors\.ubuntu\.com/mirrors\.txt#g' /etc/apt/sources.list +apt-get update +apt-get install -y cmake libprotobuf-dev protobuf-compiler git \ + libgoogle-glog-dev libgflags-dev libatlas-dev libatlas3-base g++ m4 python-pip\ + python-protobuf python-numpy python-dev swig + +if [ ${WITH_GPU} == "ON" ]; then # install cuda + cd ~ + apt-get install -y aria2 wget + echo "Downloading cuda tookit" + set +e + for ((i=0; i<100; i++)) + do + aria2c -x 10 -s 10 --lowest-speed-limit=${LOWEST_DL_SPEED} http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run + if [ $? -eq 0 ]; then + break + fi + done + + set -e + wget http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run.md5 + md5sum -c cuda_7.5.18_linux.run.md5 + chmod +x cuda_7.5.18_linux.run + ./cuda_7.5.18_linux.run --extract=$PWD + ./cuda-linux64-rel-7.5.18-19867135.run -noprompt + rm *.run *.run.md5 + + echo "Downloading cudnn v5.1" + set +e + for ((i=0; i<100; i++)) + do + aria2c -x 10 --lowest-speed-limit=${LOWEST_DL_SPEED} http://developer.download.nvidia.com/compute/redist/cudnn/v5.1/cudnn-7.5-linux-x64-v5.1.tgz + if [ $? -eq 0 ]; then + break + fi + done + set -e + echo "$CUDNN_DOWNLOAD_SUM cudnn-7.5-linux-x64-v5.1.tgz" | sha256sum -c --strict - + tar -xzf cudnn-7.5-linux-x64-v5.1.tgz -C /usr/local + rm cudnn-7.5-linux-x64-v5.1.tgz + ldconfig + export PATH=/usr/local/cuda/bin:$PATH + apt-get purge -y aria2 +fi +set -e +cd ~ +git clone https://github.com/baidu/Paddle.git paddle +cd paddle +mkdir build +cd build +cmake .. -DWITH_DOC=OFF -DWITH_GPU=${WITH_GPU} -DWITH_SWIG_PY=ON +make -j `nproc` +# because durning make install, there are several warning, so set +e, do not cause abort +make install +echo 'export LD_LIBRARY_PATH=/usr/lib64:${LD_LIBRARY_PATH}' >> /etc/profile +pip ${PIP_GENERAL_ARGS} install ${PIP_INSTALL_ARGS} /usr/local/opt/paddle/share/wheels/*.whl +paddle version # print version after build + +if [ ${WITH_DEMO} == "ON" ]; then + apt-get install -y wget unzip perl python-matplotlib tar xz-utils bzip2 gzip coreutils\ + sed grep graphviz + pip ${PIP_GENERAL_ARGS} install ${PIP_INSTALL_ARGS} BeautifulSoup docopt PyYAML +fi +if [ ${IS_DEVEL} == "OFF" ]; then # clean build packages. + cd ~ + # TODO(yuyang18): Do clean for devel package, and cuda devel tools + rm -rf paddle +fi +apt-get clean -y +trap : 0 diff --git a/paddle/scripts/docker/gpu-devel/Dockerfile b/paddle/scripts/docker/gpu-devel/Dockerfile new file mode 100644 index 00000000000..63f14b3baca --- /dev/null +++ b/paddle/scripts/docker/gpu-devel/Dockerfile @@ -0,0 +1,11 @@ +FROM ubuntu:14.04 +MAINTAINER PaddlePaddle Dev Team +COPY build.sh /root/ +ENV LOWEST_DL_SPEED=0 +ENV WITH_GPU=ON +ENV IS_DEVEL=ON +ENV WITH_DEMO=OFF +ENV PIP_INSTALL_ARGS +ENV PIP_GENERAL_ARGS +ENV CUDNN_DOWNLOAD_SUM 40d506d0a8a00a3faccce1433346806b8cd2535683b6f08a63683ce6e474419f +RUN cd /root/ && bash build.sh diff --git a/paddle/scripts/docker/gpu-devel/build.sh b/paddle/scripts/docker/gpu-devel/build.sh new file mode 100644 index 00000000000..be59c325b19 --- /dev/null +++ b/paddle/scripts/docker/gpu-devel/build.sh @@ -0,0 +1,79 @@ +#!/bin/bash + +function abort(){ + echo "An error occurred. Exiting..." 1>&2 + exit 1 +} + +trap 'abort' 0 +set -e +sed -i 's#http://archive\.ubuntu\.com/ubuntu/#mirror://mirrors\.ubuntu\.com/mirrors\.txt#g' /etc/apt/sources.list +apt-get update +apt-get install -y cmake libprotobuf-dev protobuf-compiler git \ + libgoogle-glog-dev libgflags-dev libatlas-dev libatlas3-base g++ m4 python-pip\ + python-protobuf python-numpy python-dev swig + +if [ ${WITH_GPU} == "ON" ]; then # install cuda + cd ~ + apt-get install -y aria2 wget + echo "Downloading cuda tookit" + set +e + for ((i=0; i<100; i++)) + do + aria2c -x 10 -s 10 --lowest-speed-limit=${LOWEST_DL_SPEED} http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run + if [ $? -eq 0 ]; then + break + fi + done + + set -e + wget http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run.md5 + md5sum -c cuda_7.5.18_linux.run.md5 + chmod +x cuda_7.5.18_linux.run + ./cuda_7.5.18_linux.run --extract=$PWD + ./cuda-linux64-rel-7.5.18-19867135.run -noprompt + rm *.run *.run.md5 + + echo "Downloading cudnn v5.1" + set +e + for ((i=0; i<100; i++)) + do + aria2c -x 10 --lowest-speed-limit=${LOWEST_DL_SPEED} http://developer.download.nvidia.com/compute/redist/cudnn/v5.1/cudnn-7.5-linux-x64-v5.1.tgz + if [ $? -eq 0 ]; then + break + fi + done + set -e + echo "$CUDNN_DOWNLOAD_SUM cudnn-7.5-linux-x64-v5.1.tgz" | sha256sum -c --strict - + tar -xzf cudnn-7.5-linux-x64-v5.1.tgz -C /usr/local + rm cudnn-7.5-linux-x64-v5.1.tgz + ldconfig + export PATH=/usr/local/cuda/bin:$PATH + apt-get purge -y aria2 +fi +set -e +cd ~ +git clone https://github.com/baidu/Paddle.git paddle +cd paddle +mkdir build +cd build +cmake .. -DWITH_DOC=OFF -DWITH_GPU=${WITH_GPU} -DWITH_SWIG_PY=ON +make -j `nproc` +# because durning make install, there are several warning, so set +e, do not cause abort +make install +echo 'export LD_LIBRARY_PATH=/usr/lib64:${LD_LIBRARY_PATH}' >> /etc/profile +pip ${PIP_GENERAL_ARGS} install ${PIP_INSTALL_ARGS} /usr/local/opt/paddle/share/wheels/*.whl +paddle version # print version after build + +if [ ${WITH_DEMO} == "ON" ]; then + apt-get install -y wget unzip perl python-matplotlib tar xz-utils bzip2 gzip coreutils\ + sed grep graphviz + pip ${PIP_GENERAL_ARGS} install ${PIP_INSTALL_ARGS} BeautifulSoup docopt PyYAML +fi +if [ ${IS_DEVEL} == "OFF" ]; then # clean build packages. + cd ~ + # TODO(yuyang18): Do clean for devel package, and cuda devel tools + rm -rf paddle +fi +apt-get clean -y +trap : 0 diff --git a/paddle/scripts/docker/gpu/Dockerfile b/paddle/scripts/docker/gpu/Dockerfile new file mode 100644 index 00000000000..b2e9b8a9f76 --- /dev/null +++ b/paddle/scripts/docker/gpu/Dockerfile @@ -0,0 +1,11 @@ +FROM ubuntu:14.04 +MAINTAINER PaddlePaddle Dev Team +COPY build.sh /root/ +ENV LOWEST_DL_SPEED=0 +ENV WITH_GPU=ON +ENV IS_DEVEL=OFF +ENV WITH_DEMO=OFF +ENV PIP_INSTALL_ARGS +ENV PIP_GENERAL_ARGS +ENV CUDNN_DOWNLOAD_SUM 40d506d0a8a00a3faccce1433346806b8cd2535683b6f08a63683ce6e474419f +RUN cd /root/ && bash build.sh diff --git a/paddle/scripts/docker/gpu/build.sh b/paddle/scripts/docker/gpu/build.sh new file mode 100644 index 00000000000..be59c325b19 --- /dev/null +++ b/paddle/scripts/docker/gpu/build.sh @@ -0,0 +1,79 @@ +#!/bin/bash + +function abort(){ + echo "An error occurred. Exiting..." 1>&2 + exit 1 +} + +trap 'abort' 0 +set -e +sed -i 's#http://archive\.ubuntu\.com/ubuntu/#mirror://mirrors\.ubuntu\.com/mirrors\.txt#g' /etc/apt/sources.list +apt-get update +apt-get install -y cmake libprotobuf-dev protobuf-compiler git \ + libgoogle-glog-dev libgflags-dev libatlas-dev libatlas3-base g++ m4 python-pip\ + python-protobuf python-numpy python-dev swig + +if [ ${WITH_GPU} == "ON" ]; then # install cuda + cd ~ + apt-get install -y aria2 wget + echo "Downloading cuda tookit" + set +e + for ((i=0; i<100; i++)) + do + aria2c -x 10 -s 10 --lowest-speed-limit=${LOWEST_DL_SPEED} http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run + if [ $? -eq 0 ]; then + break + fi + done + + set -e + wget http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run.md5 + md5sum -c cuda_7.5.18_linux.run.md5 + chmod +x cuda_7.5.18_linux.run + ./cuda_7.5.18_linux.run --extract=$PWD + ./cuda-linux64-rel-7.5.18-19867135.run -noprompt + rm *.run *.run.md5 + + echo "Downloading cudnn v5.1" + set +e + for ((i=0; i<100; i++)) + do + aria2c -x 10 --lowest-speed-limit=${LOWEST_DL_SPEED} http://developer.download.nvidia.com/compute/redist/cudnn/v5.1/cudnn-7.5-linux-x64-v5.1.tgz + if [ $? -eq 0 ]; then + break + fi + done + set -e + echo "$CUDNN_DOWNLOAD_SUM cudnn-7.5-linux-x64-v5.1.tgz" | sha256sum -c --strict - + tar -xzf cudnn-7.5-linux-x64-v5.1.tgz -C /usr/local + rm cudnn-7.5-linux-x64-v5.1.tgz + ldconfig + export PATH=/usr/local/cuda/bin:$PATH + apt-get purge -y aria2 +fi +set -e +cd ~ +git clone https://github.com/baidu/Paddle.git paddle +cd paddle +mkdir build +cd build +cmake .. -DWITH_DOC=OFF -DWITH_GPU=${WITH_GPU} -DWITH_SWIG_PY=ON +make -j `nproc` +# because durning make install, there are several warning, so set +e, do not cause abort +make install +echo 'export LD_LIBRARY_PATH=/usr/lib64:${LD_LIBRARY_PATH}' >> /etc/profile +pip ${PIP_GENERAL_ARGS} install ${PIP_INSTALL_ARGS} /usr/local/opt/paddle/share/wheels/*.whl +paddle version # print version after build + +if [ ${WITH_DEMO} == "ON" ]; then + apt-get install -y wget unzip perl python-matplotlib tar xz-utils bzip2 gzip coreutils\ + sed grep graphviz + pip ${PIP_GENERAL_ARGS} install ${PIP_INSTALL_ARGS} BeautifulSoup docopt PyYAML +fi +if [ ${IS_DEVEL} == "OFF" ]; then # clean build packages. + cd ~ + # TODO(yuyang18): Do clean for devel package, and cuda devel tools + rm -rf paddle +fi +apt-get clean -y +trap : 0 -- GitLab