From 1a00d6c7204d9f5b1ca2942e1035746845f5495b Mon Sep 17 00:00:00 2001 From: bjjwwang Date: Tue, 27 Apr 2021 19:47:40 +0800 Subject: [PATCH] modify some sh --- .../dockerfiles/build_scripts/install_gcc.sh | 17 ++++++ .../build_scripts/install_python.sh | 9 ++++ .../dockerfiles/build_scripts/install_whl.sh | 54 ++++++++++++++++--- 3 files changed, 73 insertions(+), 7 deletions(-) diff --git a/tools/dockerfiles/build_scripts/install_gcc.sh b/tools/dockerfiles/build_scripts/install_gcc.sh index bf0dd5f2..f62deaf7 100644 --- a/tools/dockerfiles/build_scripts/install_gcc.sh +++ b/tools/dockerfiles/build_scripts/install_gcc.sh @@ -20,6 +20,7 @@ set -ex if [ -f "/etc/redhat-release" ];then + lib_so_3=/usr/lib64/libgfortran.so.3 lib_so_5=/usr/lib64/libgfortran.so.5 lib_so_6=/usr/lib64/libstdc++.so.6 lib_path=/usr/lib64 @@ -44,4 +45,20 @@ if [ "$1" == "gcc82" ]; then ln -s /usr/local/gcc-8.2/lib64/libgfortran.so.5 ${lib_so_5} && \ ln -s /usr/local/gcc-8.2/lib64/libstdc++.so.6 ${lib_so_6} && \ cp /usr/local/gcc-8.2/lib64/libstdc++.so.6.0.25 ${lib_path} + +elif [ "$1" == "gcc54" ]; then + wget -q https://paddle-ci.gz.bcebos.com/gcc-5.4.0.tar.gz + tar -xvf gcc-5.4.0.tar.gz + cd gcc-5.4.0 && \ + unset LIBRARY_PATH CPATH C_INCLUDE_PATH PKG_CONFIG_PATH CPLUS_INCLUDE_PATH INCLUDE && \ + ./contrib/download_prerequisites && \ + cd .. && mkdir temp_gcc54 && cd temp_gcc54 && \ + ../gcc-5.4.0/configure --prefix=/usr/local/gcc-5.4 --enable-threads=posix --disable-checking --disable-multilib && \ + make -j8 && make install + cd .. && rm -rf temp_gcc54 + rm -rf gcc-5.4.0 gcc-5.4.0.tar.gz + cp ${lib_so_6} ${lib_so_6}.bak && rm -f ${lib_so_6} && + ln -s /usr/local/gcc-5.4/lib64/libgfortran.so.3 ${lib_so_3} && \ + ln -s /usr/local/gcc-5.4/lib64/libstdc++.so.6 ${lib_so_6} && \ + cp /usr/local/gcc-5.4/lib64/libstdc++.so.6.0.21 ${lib_path} fi diff --git a/tools/dockerfiles/build_scripts/install_python.sh b/tools/dockerfiles/build_scripts/install_python.sh index 4809a31c..d2b460e8 100644 --- a/tools/dockerfiles/build_scripts/install_python.sh +++ b/tools/dockerfiles/build_scripts/install_python.sh @@ -37,4 +37,13 @@ elif [[ "$VERSION" == "3.7" ]];then make -j8 > /dev/null && make altinstall > /dev/null && ldconfig cd .. && rm -rf Python-3.7.0* python3.7 -m pip install -U pip +elif [[ "$VERSION" == "3.8" ]];then + wget -q https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz && \ + tar -xzf Python-3.8.0.tgz && cd Python-3.8.0 && \ + CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ + make -j8 > /dev/null && make altinstall > /dev/null && ldconfig + cd .. && rm -rf Python-3.8.0* + python3.8 -m pip install -U pip fi + + diff --git a/tools/dockerfiles/build_scripts/install_whl.sh b/tools/dockerfiles/build_scripts/install_whl.sh index 8d27e953..a913b059 100644 --- a/tools/dockerfiles/build_scripts/install_whl.sh +++ b/tools/dockerfiles/build_scripts/install_whl.sh @@ -18,17 +18,55 @@ SERVING_VERSION=$1 PADDLE_VERSION=$2 RUN_ENV=$3 # cpu/10.1 10.2 PYTHON_VERSION=$4 - +serving_release= client_release="paddle-serving-client==$SERVING_VERSION" app_release="paddle-serving-app==0.3.1" + +if [[ $PYTHON_VERSION == "3.6" ]];then + CPYTHON="36" +elif [[ $PYTHON_VERSION == "3.7" ]];then + CPYTHON="37" +elif [[ $PYTHON_VERSION == "3.8" ]];then + CPYTHON="38" +fi + +if [[ $SERVING_VERSION == "0.5.0" ]]; then + if [[ "$RUN_ENV" == "cpu" ]];then + server_release="paddle-serving-server==$SERVING_VERSION" + serving_bin="https://paddle-serving.bj.bcebos.com/bin/serving-cpu-noavx-openblas-${SERVING_VERSION}.tar.gz" + elif [[ "$RUN_ENV" == "cuda10.1" ]];then + server_release="paddle-serving-server-gpu==$SERVING_VERSION.post101" + serving_bin="https://paddle-serving.bj.bcebos.com/bin/serving-gpu-101-${SERVING_VERSION}.tar.gz" + elif [[ "$RUN_ENV" == "cuda10.2" ]];then + server_release="paddle-serving-server-gpu==$SERVING_VERSION.post102" + serving_bin="https://paddle-serving.bj.bcebos.com/bin/serving-gpu-102-${SERVING_VERSION}.tar.gz" + fi + client_release="paddle-serving-client==$SERVING_VERSION" + app_release="paddle-serving-app==0.3.1" +elif [[ $SERVING_VERSION == "0.6.0" ]]; then + if [[ "$RUN_ENV" == "cpu" ]];then + server_release="https://paddle-serving.bj.bcebos.com/test-dev/whl/paddle_serving_server-$SERVING_VERSION-py3-none-any.whl" + serving_bin="https://paddle-serving.bj.bcebos.com/test-dev/bin/serving-cpu-avx-openblas-$SERVING_VERSION.tar.gz" + elif [[ "$RUN_ENV" == "cuda10.1" ]];then + server_release="https://paddle-serving.bj.bcebos.com/test-dev/whl/paddle_serving_server_gpu-$SERVING_VERSION.post101-py3-none-any.whl" + serving_bin="https://paddle-serving.bj.bcebos.com/test-dev/bin/serving-gpu-101-$SERVING_VERSION.tar.gz" + elif [[ "$RUN_ENV" == "cuda10.2" ]];then + server_release="https://paddle-serving.bj.bcebos.com/test-dev/whl/paddle_serving_server_gpu-$SERVING_VERSION.post102-py3-none-any.whl" + serving_bin="https://paddle-serving.bj.bcebos.com/test-dev/bin/serving-gpu-102-$SERVING_VERSION.tar.gz" + fi + client_release="https://paddle-serving.bj.bcebos.com/test-dev/whl/paddle_serving_client-$SERVING_VERSION-cp$CPYTHON-none-any.whl" + app_release="https://paddle-serving.bj.bcebos.com/test-dev/whl/paddle_serving_app-$SERVING_VERSION-py3-none-any.whl" +fi + if [[ "$RUN_ENV" == "cpu" ]];then server_release="paddle-serving-server==$SERVING_VERSION" python$PYTHON_VERSION -m pip install $client_release $app_release $server_release python$PYTHON_VERSION -m pip install paddlepaddle==${PADDLE_VERSION} cd /usr/local/ - wget https://paddle-serving.bj.bcebos.com/bin/serving-cpu-noavx-openblas-${SERVING_VERSION}.tar.gz + wget $serving_bin tar xf serving-cpu-noavx-openblas-${SERVING_VERSION}.tar.gz - echo "export SERVING_BIN=$PWD/serving-cpu-noavx-openblas-${SERVING_VERSION}/serving">>/root/.bashrc + mv $PWD/serving-cpu-noavx-openblas-${SERVING_VERSION} $PWD/serving_bin + echo "export SERVING_BIN=$PWD/serving_bin/serving">>/root/.bashrc rm -rf serving-cpu-noavx-openblas-${SERVING_VERSION}.tar.gz cd - elif [[ "$RUN_ENV" == "cuda10.1" ]];then @@ -36,9 +74,10 @@ elif [[ "$RUN_ENV" == "cuda10.1" ]];then python$PYTHON_VERSION -m pip install $client_release $app_release $server_release python$PYTHON_VERSION -m pip install paddlepaddle-gpu==${PADDLE_VERSION} cd /usr/local/ - wget https://paddle-serving.bj.bcebos.com/bin/serving-gpu-101-${SERVING_VERSION}.tar.gz + wget $serving_bin tar xf serving-gpu-101-${SERVING_VERSION}.tar.gz - echo "export SERVING_BIN=$PWD/serving-gpu-101-${SERVING_VERSION}/serving">>/root/.bashrc + mv $PWD/serving-gpu-101-${SERVING_VERSION} $PWD/serving_bin + echo "export SERVING_BIN=$PWD/serving_bin/serving">>/root/.bashrc rm -rf serving-gpu-101-${SERVING_VERSION}.tar.gz cd - elif [[ "$RUN_ENV" == "cuda10.2" ]];then @@ -46,9 +85,10 @@ elif [[ "$RUN_ENV" == "cuda10.2" ]];then python$PYTHON_VERSION -m pip install $client_release $app_release $server_release python$PYTHON_VERSION -m pip install paddlepaddle-gpu==${PADDLE_VERSION} cd /usr/local/ - wget https://paddle-serving.bj.bcebos.com/bin/serving-gpu-102-${SERVING_VERSION}.tar.gz + wget $serving_bin tar xf serving-gpu-102-${SERVING_VERSION}.tar.gz - echo "export SERVING_BIN=$PWD/serving-gpu-102-${SERVING_VERSION}/serving">>/root/.bashrc + mv $PWD/serving-gpu-102-${SERVING_VERSION} $PWD/serving_bin + echo "export SERVING_BIN=$PWD/serving_bin/serving">>/root/.bashrc rm -rf serving-gpu-102-${SERVING_VERSION}.tar.gz cd - fi -- GitLab