未验证 提交 f763cb81 编写于 作者: I iducn 提交者: GitHub

Modify the shell script according to the specification (#28302)

* 01:Modify the shell script according to the specification

* 01:Modify the shell script according to the specification
上级 3ccc0a2f
...@@ -13,6 +13,6 @@ ...@@ -13,6 +13,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
DIRNAME=`dirname $0` DIRNAME="$(dirname "$0")"
source $DIRNAME/.common_test_util.sh sh "$DIRNAME"/.common_test_util.sh
set_port $@ set_port "$@"
...@@ -24,12 +24,14 @@ ...@@ -24,12 +24,14 @@
PYPATH="" PYPATH=""
set -x set -x
while getopts "d:" opt; do while getopts "d:" opt; do
case $opt in case "$opt" in
d) d)
PYPATH=$OPTARG PYPATH=$OPTARG
;; ;;
*)
;;
esac esac
done done
shift $(($OPTIND - 1)) shift $(("$OPTIND" - 1))
export PYTHONPATH=$PYPATH:$PYTHONPATH export PYTHONPATH=$PYPATH:$PYTHONPATH
$@ "$@"
#!/bin/bash
set -x set -x
cd `dirname $0` cd "$(dirname "$0")" || exit
rm -rf build/ data/ rm -rf build/ data/
set +x set +x
#!/bin/bash #!/bin/bash
set -x set -x
PADDLE_ROOT=$1 PADDLE_ROOT="$1"
TURN_ON_MKL=$2 # use MKL or Openblas TURN_ON_MKL="$2" # use MKL or Openblas
TEST_GPU_CPU=$3 # test both GPU/CPU mode or only CPU mode TEST_GPU_CPU="$3" # test both GPU/CPU mode or only CPU mode
DATA_DIR=$4 # dataset DATA_DIR="$4" # dataset
TENSORRT_INCLUDE_DIR=$5 # TensorRT header file dir, default to /usr/local/TensorRT/include TENSORRT_INCLUDE_DIR="$5" # TensorRT header file dir, default to /usr/local/TensorRT/include
TENSORRT_LIB_DIR=$6 # TensorRT lib file dir, default to /usr/local/TensorRT/lib TENSORRT_LIB_DIR="$6" # TensorRT lib file dir, default to /usr/local/TensorRT/lib
MSVC_STATIC_CRT=$7 MSVC_STATIC_CRT="$7"
inference_install_dir=${PADDLE_ROOT}/build/paddle_inference_install_dir inference_install_dir="${PADDLE_ROOT}"/build/paddle_inference_install_dir
cd `dirname $0` cd "$(dirname "$0")" || exit
current_dir=`pwd` current_dir=$(pwd)
if [ $2 == ON ]; then if [ "$2" == ON ]; then
# You can export yourself if move the install path # You can export yourself if move the install path
MKL_LIB=${inference_install_dir}/third_party/install/mklml/lib MKL_LIB="${inference_install_dir}"/third_party/install/mklml/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${MKL_LIB} export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"${MKL_LIB}"
fi fi
if [ $3 == ON ]; then if [ "$3" == ON ]; then
use_gpu_list='true false' use_gpu_list='true false'
else else
use_gpu_list='false' use_gpu_list='false'
fi fi
USE_TENSORRT=OFF USE_TENSORRT=OFF
if [ -d "$TENSORRT_INCLUDE_DIR" -a -d "$TENSORRT_LIB_DIR" ]; then if [ -d "$TENSORRT_INCLUDE_DIR" ] && [ -d "$TENSORRT_LIB_DIR" ]; then
USE_TENSORRT=ON USE_TENSORRT=ON
fi fi
...@@ -32,77 +32,79 @@ URL_ROOT=http://paddlemodels.bj.bcebos.com/${PREFIX} ...@@ -32,77 +32,79 @@ URL_ROOT=http://paddlemodels.bj.bcebos.com/${PREFIX}
# download vis_demo data # download vis_demo data
function download() { function download() {
dir_name=$1 dir_name="$1"
mkdir -p $dir_name mkdir -p "$dir_name"
cd $dir_name cd "$dir_name" || exit
if [[ -e "${PREFIX}${dir_name}.tar.gz" ]]; then if [[ -e "${PREFIX}${dir_name}.tar.gz" ]]; then
echo "${PREFIX}${dir_name}.tar.gz has been downloaded." echo "${PREFIX}${dir_name}.tar.gz has been downloaded."
else else
wget -q ${URL_ROOT}$dir_name.tar.gz wget -q "${URL_ROOT}""$dir_name".tar.gz
tar xzf *.tar.gz tar xzf ./*.tar.gz
fi fi
cd .. cd .. || exit
} }
mkdir -p $DATA_DIR mkdir -p "$DATA_DIR"
cd $DATA_DIR cd "$DATA_DIR" || exit
vis_demo_list='se_resnext50 ocr mobilenet' vis_demo_list='se_resnext50 ocr mobilenet'
for vis_demo_name in $vis_demo_list; do for vis_demo_name in $vis_demo_list; do
download $vis_demo_name download "$vis_demo_name"
done done
# download word2vec data # download word2vec data
mkdir -p word2vec mkdir -p word2vec
cd word2vec cd word2vec || exit
if [[ -e "word2vec.inference.model.tar.gz" ]]; then if [[ -e "word2vec.inference.model.tar.gz" ]]; then
echo "word2vec.inference.model.tar.gz has been downloaded." echo "word2vec.inference.model.tar.gz has been downloaded."
else else
wget -q http://paddle-inference-dist.bj.bcebos.com/word2vec.inference.model.tar.gz wget -q http://paddle-inference-dist.bj.bcebos.com/word2vec.inference.model.tar.gz
tar xzf *.tar.gz tar xzf ./*.tar.gz
fi fi
# compile and test the demo # compile and test the demo
cd $current_dir cd "$current_dir" || exit
mkdir -p build mkdir -p build
cd build cd build || exit
rm -rf * rm -rf ./*
for WITH_STATIC_LIB in ON OFF; do for WITH_STATIC_LIB in ON OFF; do
if [ $(echo `uname` | grep "Win") != "" ]; then if [ "$(uname | grep Win)" != "" ]; then
# -----simple_on_word2vec on windows----- # -----simple_on_word2vec on windows-----
cmake .. -G "Visual Studio 14 2015" -A x64 -DPADDLE_LIB=${inference_install_dir} \ cmake .. -G "Visual Studio 14 2015" -A x64 -DPADDLE_LIB="${inference_install_dir}" \
-DWITH_MKL=$TURN_ON_MKL \ -DWITH_MKL="$TURN_ON_MKL" \
-DDEMO_NAME=simple_on_word2vec \ -DDEMO_NAME=simple_on_word2vec \
-DWITH_GPU=$TEST_GPU_CPU \ -DWITH_GPU="$TEST_GPU_CPU" \
-DWITH_STATIC_LIB=$WITH_STATIC_LIB \ -DWITH_STATIC_LIB="$WITH_STATIC_LIB" \
-DMSVC_STATIC_CRT=$MSVC_STATIC_CRT -DMSVC_STATIC_CRT="$MSVC_STATIC_CRT"
msbuild /maxcpucount /property:Configuration=Release cpp_inference_demo.sln msbuild /maxcpucount /property:Configuration=Release cpp_inference_demo.sln
for use_gpu in $use_gpu_list; do for use_gpu in $use_gpu_list; do
Release/simple_on_word2vec.exe \ Release/simple_on_word2vec.exe \
--dirname=$DATA_DIR/word2vec/word2vec.inference.model \ --dirname="$DATA_DIR"/word2vec/word2vec.inference.model \
--use_gpu=$use_gpu --use_gpu="$use_gpu"
if [ $? -ne 0 ]; then EXCODE="$?"
if [ "$EXCODE" -ne 0 ]; then
echo "simple_on_word2vec demo runs fail." echo "simple_on_word2vec demo runs fail."
exit 1 exit 1
fi fi
done done
# -----vis_demo on windows----- # -----vis_demo on windows-----
rm -rf * rm -rf ./*
cmake .. -G "Visual Studio 14 2015" -A x64 -DPADDLE_LIB=${inference_install_dir} \ cmake .. -G "Visual Studio 14 2015" -A x64 -DPADDLE_LIB="${inference_install_dir}" \
-DWITH_MKL=$TURN_ON_MKL \ -DWITH_MKL="$TURN_ON_MKL" \
-DDEMO_NAME=vis_demo \ -DDEMO_NAME=vis_demo \
-DWITH_GPU=$TEST_GPU_CPU \ -DWITH_GPU="$TEST_GPU_CPU" \
-DWITH_STATIC_LIB=$WITH_STATIC_LIB \ -DWITH_STATIC_LIB="$WITH_STATIC_LIB" \
-DMSVC_STATIC_CRT=$MSVC_STATIC_CRT -DMSVC_STATIC_CRT="$MSVC_STATIC_CRT"
msbuild /maxcpucount /property:Configuration=Release cpp_inference_demo.sln msbuild /maxcpucount /property:Configuration=Release cpp_inference_demo.sln
for use_gpu in $use_gpu_list; do for use_gpu in $use_gpu_list; do
for vis_demo_name in $vis_demo_list; do for vis_demo_name in $vis_demo_list; do
Release/vis_demo.exe \ Release/vis_demo.exe \
--modeldir=$DATA_DIR/$vis_demo_name/model \ --modeldir="$DATA_DIR"/"$vis_demo_name"/model \
--data=$DATA_DIR/$vis_demo_name/data.txt \ --data="$DATA_DIR"/"$vis_demo_name"/data.txt \
--refer=$DATA_DIR/$vis_demo_name/result.txt \ --refer="$DATA_DIR"/"$vis_demo_name"/result.txt \
--use_gpu=$use_gpu --use_gpu="$use_gpu"
if [ $? -ne 0 ]; then EXCODE="$?"
if [ "$EXCODE" -ne 0 ]; then
echo "vis demo $vis_demo_name runs fail." echo "vis demo $vis_demo_name runs fail."
exit 1 exit 1
fi fi
...@@ -110,63 +112,66 @@ for WITH_STATIC_LIB in ON OFF; do ...@@ -110,63 +112,66 @@ for WITH_STATIC_LIB in ON OFF; do
done done
else else
# -----simple_on_word2vec on linux/mac----- # -----simple_on_word2vec on linux/mac-----
rm -rf * rm -rf ./*
cmake .. -DPADDLE_LIB=${inference_install_dir} \ cmake .. -DPADDLE_LIB="${inference_install_dir}" \
-DWITH_MKL=$TURN_ON_MKL \ -DWITH_MKL="$TURN_ON_MKL" \
-DDEMO_NAME=simple_on_word2vec \ -DDEMO_NAME=simple_on_word2vec \
-DWITH_GPU=$TEST_GPU_CPU \ -DWITH_GPU="$TEST_GPU_CPU" \
-DWITH_STATIC_LIB=$WITH_STATIC_LIB -DWITH_STATIC_LIB="$WITH_STATIC_LIB"
make -j$(nproc) make -j"$(nproc)"
word2vec_model=$DATA_DIR'/word2vec/word2vec.inference.model' word2vec_model="$DATA_DIR"'/word2vec/word2vec.inference.model'
if [ -d $word2vec_model ]; then if [ -d "$word2vec_model" ]; then
for use_gpu in $use_gpu_list; do for use_gpu in $use_gpu_list; do
./simple_on_word2vec \ ./simple_on_word2vec \
--dirname=$DATA_DIR/word2vec/word2vec.inference.model \ --dirname="$DATA_DIR"/word2vec/word2vec.inference.model \
--use_gpu=$use_gpu --use_gpu="$use_gpu"
if [ $? -ne 0 ]; then EXCODE="$?"
if [ "$EXCODE" -ne 0 ]; then
echo "simple_on_word2vec demo runs fail." echo "simple_on_word2vec demo runs fail."
exit 1 exit 1
fi fi
done done
fi fi
# ---------vis_demo on linux/mac--------- # ---------vis_demo on linux/mac---------
rm -rf * rm -rf ./*
cmake .. -DPADDLE_LIB=${inference_install_dir} \ cmake .. -DPADDLE_LIB="${inference_install_dir}" \
-DWITH_MKL=$TURN_ON_MKL \ -DWITH_MKL="$TURN_ON_MKL" \
-DDEMO_NAME=vis_demo \ -DDEMO_NAME=vis_demo \
-DWITH_GPU=$TEST_GPU_CPU \ -DWITH_GPU="$TEST_GPU_CPU" \
-DWITH_STATIC_LIB=$WITH_STATIC_LIB -DWITH_STATIC_LIB="$WITH_STATIC_LIB"
make -j$(nproc) make -j"$(nproc)"
for use_gpu in $use_gpu_list; do for use_gpu in $use_gpu_list; do
for vis_demo_name in $vis_demo_list; do for vis_demo_name in $vis_demo_list; do
./vis_demo \ ./vis_demo \
--modeldir=$DATA_DIR/$vis_demo_name/model \ --modeldir="$DATA_DIR"/"$vis_demo_name"/model \
--data=$DATA_DIR/$vis_demo_name/data.txt \ --data="$DATA_DIR"/"$vis_demo_name"/data.txt \
--refer=$DATA_DIR/$vis_demo_name/result.txt \ --refer="$DATA_DIR"/"$vis_demo_name"/result.txt \
--use_gpu=$use_gpu --use_gpu="$use_gpu"
if [ $? -ne 0 ]; then EXCODE="$?"
if [ "$EXCODE" -ne 0 ]; then
echo "vis demo $vis_demo_name runs fail." echo "vis demo $vis_demo_name runs fail."
exit 1 exit 1
fi fi
done done
done done
# --------tensorrt mobilenet on linux/mac------ # --------tensorrt mobilenet on linux/mac------
if [ $USE_TENSORRT == ON -a $TEST_GPU_CPU == ON ]; then if [ "$USE_TENSORRT" == ON ] && [ "$TEST_GPU_CPU" == ON ]; then
rm -rf * rm -rf ./*
cmake .. -DPADDLE_LIB=${inference_install_dir} \ cmake .. -DPADDLE_LIB="${inference_install_dir}" \
-DWITH_MKL=$TURN_ON_MKL \ -DWITH_MKL="$TURN_ON_MKL" \
-DDEMO_NAME=trt_mobilenet_demo \ -DDEMO_NAME=trt_mobilenet_demo \
-DWITH_GPU=$TEST_GPU_CPU \ -DWITH_GPU="$TEST_GPU_CPU" \
-DWITH_STATIC_LIB=$WITH_STATIC_LIB \ -DWITH_STATIC_LIB="$WITH_STATIC_LIB" \
-DUSE_TENSORRT=$USE_TENSORRT \ -DUSE_TENSORRT="$USE_TENSORRT" \
-DTENSORRT_INCLUDE_DIR=$TENSORRT_INCLUDE_DIR \ -DTENSORRT_INCLUDE_DIR="$TENSORRT_INCLUDE_DIR" \
-DTENSORRT_LIB_DIR=$TENSORRT_LIB_DIR -DTENSORRT_LIB_DIR="$TENSORRT_LIB_DIR"
make -j$(nproc) make -j"$(nproc)"
./trt_mobilenet_demo \ ./trt_mobilenet_demo \
--modeldir=$DATA_DIR/mobilenet/model \ --modeldir="$DATA_DIR"/mobilenet/model \
--data=$DATA_DIR/mobilenet/data.txt \ --data="$DATA_DIR"/mobilenet/data.txt \
--refer=$DATA_DIR/mobilenet/result.txt --refer="$DATA_DIR"/mobilenet/result.txt
if [ $? -ne 0 ]; then EXCODE="$?"
if [ "$EXCODE" != 0 ]; then
echo "trt demo trt_mobilenet_demo runs fail." echo "trt demo trt_mobilenet_demo runs fail."
exit 1 exit 1
fi fi
......
#!/bin/sh #!/bin/sh
lib=$1 lib="$1"
if [ $# -ne 1 ]; then echo "No input library"; exit -1 ; fi if [ "$#" -ne 1 ]; then echo "No input library"; exit 1 ; fi
num_paddle_syms=$(nm -D ${lib} | grep paddle | wc -l) num_paddle_syms=$(nm -D "${lib}" | grep -c paddle )
num_google_syms=$(nm -D ${lib} | grep google | grep -v paddle | grep "T " | wc -l) num_google_syms=$(nm -D "${lib}" | grep google | grep -v paddle | grep -c "T " )
if [ $num_paddle_syms -le 0 ]; then echo "Have no paddle symbols"; exit -1 ; fi if [ "$num_paddle_syms" -le 0 ]; then echo "Have no paddle symbols"; exit 1 ; fi
if [ $num_google_syms -ge 1 ]; then echo "Have some google symbols"; exit -1 ; fi if [ "$num_google_syms" -ge 1 ]; then echo "Have some google symbols"; exit 1 ; fi
exit 0 exit 0
...@@ -15,6 +15,6 @@ ...@@ -15,6 +15,6 @@
# limitations under the License. # limitations under the License.
set -x set -x
cd "$(dirname "$0")" cd "$(dirname "$0")" || exit
rm -rf build/ rm -rf build/
set +x set +x
...@@ -14,14 +14,14 @@ function download() { ...@@ -14,14 +14,14 @@ function download() {
download download
# build demo trainer # build demo trainer
paddle_install_dir=${PADDLE_ROOT}/build/paddle_install_dir paddle_install_dir="${PADDLE_ROOT}"/build/paddle_install_dir
mkdir -p build mkdir -p build
cd build cd build || exit
rm -rf * rm -rf ./*
cmake .. -DPADDLE_LIB=$paddle_install_dir \ cmake .. -DPADDLE_LIB="$paddle_install_dir" \
-DWITH_MKLDNN=$TURN_ON_MKL \ -DWITH_MKLDNN="$TURN_ON_MKL" \
-DWITH_MKL=$TURN_ON_MKL -DWITH_MKL="$TURN_ON_MKL"
make make
cd .. cd ..
......
#!/bin/bash
set -exu set -exu
build/demo_trainer --flagfile="train.cfg" build/demo_trainer --flagfile="train.cfg"
...@@ -15,14 +15,14 @@ ...@@ -15,14 +15,14 @@
# limitations under the License. # limitations under the License.
function start_build_docker() { function start_build_docker() {
docker pull $IMG docker pull "$IMG"
apt_mirror='s#http://archive.ubuntu.com/ubuntu#mirror://mirrors.ubuntu.com/mirrors.txt#g' apt_mirror='s#http://archive.ubuntu.com/ubuntu#mirror://mirrors.ubuntu.com/mirrors.txt#g'
DOCKER_ENV=$(cat <<EOL DOCKER_ENV=$(cat <<EOL
-e FLAGS_fraction_of_gpu_memory_to_use=0.15 \ -e FLAGS_fraction_of_gpu_memory_to_use=0.15 \
-e CTEST_OUTPUT_ON_FAILURE=1 \ -e CTEST_OUTPUT_ON_FAILURE=1 \
-e CTEST_PARALLEL_LEVEL=1 \ -e CTEST_PARALLEL_LEVEL=1 \
-e APT_MIRROR=${apt_mirror} \ -e APT_MIRROR="${apt_mirror}" \
-e WITH_GPU=ON \ -e WITH_GPU=ON \
-e CUDA_ARCH_NAME=Auto \ -e CUDA_ARCH_NAME=Auto \
-e WITH_AVX=ON \ -e WITH_AVX=ON \
...@@ -39,24 +39,24 @@ EOL ...@@ -39,24 +39,24 @@ EOL
) )
DOCKER_CMD="nvidia-docker" DOCKER_CMD="nvidia-docker"
if ! [ -x "$(command -v ${DOCKER_CMD})" ]; then if ! [ -x "$(command -v "${DOCKER_CMD}")" ]; then
DOCKER_CMD="docker" DOCKER_CMD="docker"
fi fi
if [ ! -d "${HOME}/.ccache" ]; then if [ ! -d "${HOME}/.ccache" ]; then
mkdir ${HOME}/.ccache mkdir "${HOME}"/.ccache
fi fi
set -ex set -ex
${DOCKER_CMD} run -it \ "${DOCKER_CMD}" run -it \
${DOCKER_ENV} \ "${DOCKER_ENV}" \
-e SCRIPT_NAME=$0 \ -e SCRIPT_NAME="$0" \
-e CONTENT_DEC_PASSWD=$CONTENT_DEC_PASSWD \ -e CONTENT_DEC_PASSWD="$CONTENT_DEC_PASSWD" \
-e TRAVIS_BRANCH=$TRAVIS_BRANCH \ -e TRAVIS_BRANCH="$TRAVIS_BRANCH" \
-e TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST \ -e TRAVIS_PULL_REQUEST="$TRAVIS_PULL_REQUEST" \
-v $PADDLE_ROOT:/paddle \ -v "$PADDLE_ROOT":/paddle \
-v ${HOME}/.ccache:/root/.ccache \ -v "${HOME}"/.ccache:/root/.ccache \
-w /paddle \ -w /paddle \
$IMG \ "$IMG" \
paddle/scripts/paddle_build.sh $@ paddle/scripts/paddle_build.sh "$@"
set +x set +x
} }
...@@ -65,7 +65,7 @@ function main() { ...@@ -65,7 +65,7 @@ function main() {
VERSION="latest-dev" VERSION="latest-dev"
PADDLE_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}")/../../" && pwd )" PADDLE_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}")/../../" && pwd )"
IMG=${DOCKER_REPO}:${VERSION} IMG=${DOCKER_REPO}:${VERSION}
start_build_docker $@ start_build_docker "$@"
} }
main $@ main "$@"
#!/usr/bin/env bash #!/usr/bin/env bash
set -ex set -ex
SYSTEM=`uname -s` SYSTEM="$(uname -s)"
rm -f protoc-3.11.3-linux-x86_64.* rm -f protoc-3.11.3-linux-x86_64.*
if [ "$SYSTEM" == "Linux" ]; then if [ "$SYSTEM" == "Linux" ]; then
wget --no-check-certificate https://github.com/protocolbuffers/protobuf/releases/download/v3.11.3/protoc-3.11.3-linux-x86_64.zip wget --no-check-certificate https://github.com/protocolbuffers/protobuf/releases/download/v3.11.3/protoc-3.11.3-linux-x86_64.zip
...@@ -28,5 +28,5 @@ if [ "$1" != "" ]; then ...@@ -28,5 +28,5 @@ if [ "$1" != "" ]; then
fi fi
fi fi
python spider.py --version=$version --url=$url python spider.py --version=$version --url="$url"
tar czf cudaErrorMessage.tar.gz cudaErrorMessage.pb tar czf cudaErrorMessage.tar.gz cudaErrorMessage.pb
...@@ -24,8 +24,8 @@ wget -q -O $DIR/$DEB $URL ...@@ -24,8 +24,8 @@ wget -q -O $DIR/$DEB $URL
cd $DIR && ar x $DEB && tar xf data.tar.xz cd $DIR && ar x $DEB && tar xf data.tar.xz
DEBS=$(find ./var/ -name "*.deb") DEBS=$(find ./var/ -name "*.deb")
for sub_deb in $DEBS; do for sub_deb in $DEBS; do
echo $sub_deb echo "$sub_deb"
ar x $sub_deb && tar xf data.tar.xz ar x "$sub_deb" && tar xf data.tar.xz
done done
mv -f usr/include/nccl.h /usr/local/include/ mv -f usr/include/nccl.h /usr/local/include/
mv -f usr/lib/x86_64-linux-gnu/libnccl* /usr/local/lib/ mv -f usr/lib/x86_64-linux-gnu/libnccl* /usr/local/lib/
......
...@@ -31,9 +31,9 @@ ...@@ -31,9 +31,9 @@
# <real API implement>\t<API recommend>,<API other alias name1>,<API other alias name2>,... # <real API implement>\t<API recommend>,<API other alias name1>,<API other alias name2>,...
PADDLE_ROOT="$(dirname $(readlink -f ${BASH_SOURCE[0]}))/.." PADDLE_ROOT="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/.."
find ${PADDLE_ROOT}/python/ -name '*.py' \ find "${PADDLE_ROOT}"/python/ -name '*.py' \
| xargs grep -v '^#' \ | xargs grep -v '^#' \
| grep 'DEFINE_ALIAS' \ | grep 'DEFINE_ALIAS' \
| perl -ne ' | perl -ne '
......
#!/bin/bash #!/bin/bash
# Copyright (c) 2020 PaddlePaddle 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.
VERSION=$(nvcc --version | grep release | grep -oEi "release ([0-9]+)\.([0-9])"| sed "s/release //") VERSION=$(nvcc --version | grep release | grep -oEi "release ([0-9]+)\.([0-9])"| sed "s/release //")
if [ "$VERSION" == "10.0" ]; then if [ "$VERSION" == "10.0" ]; then
DEB="nccl-repo-ubuntu1604-2.4.7-ga-cuda10.0_1-1_amd64.deb" DEB="nccl-repo-ubuntu1604-2.4.7-ga-cuda10.0_1-1_amd64.deb"
...@@ -24,10 +39,10 @@ wget -q -O $DIR/$DEB $URL ...@@ -24,10 +39,10 @@ wget -q -O $DIR/$DEB $URL
cd $DIR && ar x $DEB && tar xf data.tar.xz cd $DIR && ar x $DEB && tar xf data.tar.xz
DEBS=$(find ./var/ -name "*.deb") DEBS=$(find ./var/ -name "*.deb")
for sub_deb in $DEBS; do for sub_deb in $DEBS; do
echo $sub_deb echo "$sub_deb"
ar x $sub_deb && tar xf data.tar.xz ar x "$sub_deb" && tar xf data.tar.xz
done done
mv -f usr/include/nccl.h /usr/local/include/ mv -f usr/include/nccl.h /usr/local/include/
mv -f usr/lib/x86_64-linux-gnu/libnccl* /usr/local/lib/ mv -f usr/lib/x86_64-linux-gnu/libnccl* /usr/local/lib/
rm /usr/include/nccl.h rm /usr/include/nccl.h
rm -rf $DIR rm -rf "$DIR"
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册