提交 80489920 编写于 作者: T tianshuo78520a 提交者: Jiabin Yang

add cuda10 support in fast_install.sh and add dynamic get version for release (#19106)

add cuda10 support in fast_install.sh and add dynamic get version for release, then remove useless ave check for MacOS install check
上级 32598ffd
...@@ -33,8 +33,7 @@ function yellow(){ ...@@ -33,8 +33,7 @@ function yellow(){
} }
path='http://paddlepaddle.org/download?url=' path='http://paddlepaddle.org/download?url='
#release_version=`curl -s https://pypi.org/project/paddlepaddle/|grep -E "/project/paddlepaddle/"|grep "release"|awk -F '/' '{print $(NF-1)}'|head -1` release_version=`pip show paddlepaddle|grep Version|awk '{print $NF}'`
release_version=1.5.1
python_list=( python_list=(
"27" "27"
"35" "35"
...@@ -144,6 +143,10 @@ function checkLinuxCUDA(){ ...@@ -144,6 +143,10 @@ function checkLinuxCUDA(){
CUDA=`cat /usr/local/cuda9/version.txt | grep 'CUDA Version'|awk -F '[ .]' '{print $3}'` CUDA=`cat /usr/local/cuda9/version.txt | grep 'CUDA Version'|awk -F '[ .]' '{print $3}'`
tmp_cuda9=$CUDA tmp_cuda9=$CUDA
fi fi
if [ -f "/usr/local/cuda10/version.txt" ];then
CUDA=`cat /usr/local/cuda10/version.txt | grep 'CUDA Version'|awk -F '[ .]' '{print $3}'`
tmp_cuda10=$CUDA
fi
fi fi
if [ "$tmp_cuda" != "" ];then if [ "$tmp_cuda" != "" ];then
...@@ -155,6 +158,9 @@ function checkLinuxCUDA(){ ...@@ -155,6 +158,9 @@ function checkLinuxCUDA(){
if [ "$tmp_cuda9" != "" ];then if [ "$tmp_cuda9" != "" ];then
echo "检测结果:找到CUDA $tmp_cuda9" echo "检测结果:找到CUDA $tmp_cuda9"
fi fi
if [ "$tmp_cuda10" != "" ];then
echo "检测结果:找到CUDA $tmp_cuda10"
fi
if [ "$CUDA" == "" ];then if [ "$CUDA" == "" ];then
echo "检测结果:没有在常规路径下找到cuda/version.txt文件" echo "检测结果:没有在常规路径下找到cuda/version.txt文件"
...@@ -184,11 +190,11 @@ function checkLinuxCUDA(){ ...@@ -184,11 +190,11 @@ function checkLinuxCUDA(){
fi fi
fi fi
if [ "$CUDA" == "8" ] || [ "$CUDA" == "9" ];then if [ "$CUDA" == "8" ] || [ "$CUDA" == "9" ] || [ "$CUDA" == "10" ];then
echo "您的CUDA版本是${CUDA}" echo "您的CUDA版本是${CUDA}"
break break
else else
echo "目前支持CUDA8/9,暂不支持您的CUDA${CUDA},将为您安装CPU版本的PaddlePaddle" echo "目前支持CUDA8/9/10,暂不支持您的CUDA${CUDA},将为您安装CPU版本的PaddlePaddle"
echo echo
use_cpu use_cpu
fi fi
...@@ -202,13 +208,7 @@ function checkLinuxCUDA(){ ...@@ -202,13 +208,7 @@ function checkLinuxCUDA(){
function checkLinuxMathLibrary(){ function checkLinuxMathLibrary(){
while true while true
do do
if [ "$AVX" == "" ];then if [ "$GPU" == "gpu" ];then
echo "正在检测您环境中是否存在AVX指令集..."
echo
echo "检测结果:您电脑上没有AVX指令集,目前针对无AVX指令集的环境,我们仅提供支持mkl数学库的PaddlePaddle,将为您安装此版本的PaddlePaddle"
math='mkl'
break
elif [ "$GPU" == "gpu" ];then
math='mkl' math='mkl'
echo "检测到您的机器上配备GPU,推荐您使用mkl数学库" echo "检测到您的机器上配备GPU,推荐您使用mkl数学库"
break break
...@@ -245,7 +245,7 @@ function checkLinuxPaddleVersion(){ ...@@ -245,7 +245,7 @@ function checkLinuxPaddleVersion(){
2. 稳定版(推荐):如您无特殊开发需求,建议使用此版本,目前最新的版本号为 ${release_version} 2. 稳定版(推荐):如您无特殊开发需求,建议使用此版本,目前最新的版本号为 ${release_version}
=> 请输入数字1或2。如输入其他字符或直接回车,将会默认选择【 2. 稳定版 】 。请在这里输入并回车:" paddle_version => 请输入数字1或2。如输入其他字符或直接回车,将会默认选择【 2. 稳定版 】 。请在这里输入并回车:" paddle_version
if [ "$paddle_version" == "" ];then if [ "$paddle_version" == "" ];then
paddle_version="release-${release_version}" paddle_version="2"
echo "您选择了数字【2】,为您安装release-${release_version}" echo "您选择了数字【2】,为您安装release-${release_version}"
break break
fi fi
...@@ -366,7 +366,13 @@ function checkLinuxPython(){ ...@@ -366,7 +366,13 @@ function checkLinuxPython(){
exit 0 exit 0
fi fi
if [ "$python_version" == "27" ];then if [ "$python_version" == "27" ];then
python_version_all=`$python_path -V 2>&1|awk -F '[ .]' '{print $4}'`
if [[ $python_version_all -le 15 ]];then
echo "Python2版本小于2.7.15,请更新Python2版本或使用Python3"
exit 0
fi
uncode=`python -c "import pip._internal;print(pip._internal.pep425tags.get_supported())"|grep "cp27mu"` uncode=`python -c "import pip._internal;print(pip._internal.pep425tags.get_supported())"|grep "cp27mu"`
if [[ "$uncode" == "" ]];then if [[ "$uncode" == "" ]];then
uncode= uncode=
...@@ -384,42 +390,23 @@ function checkLinuxPython(){ ...@@ -384,42 +390,23 @@ function checkLinuxPython(){
done done
} }
function checkLinuxAVX(){
while true
do
if [[ "$AVX" != "" ]];then
AVX="avx"
break
else
if [ "$CUDA" == "8" -a "$CUDNN" == "7" ] || [ "$GPU" == "cpu" ];then
AVX="noavx"
break
else
echo "Step 6. 检测是否有avx"
echo
echo "检测结果:未能找到avx,我们仅提供CPU版本或配置为CUDA8 cuDNN7的GPU版本的安装包"
break
fi
fi
done
}
function PipLinuxInstall(){ function PipLinuxInstall(){
wheel_cpu_release="http://paddle-wheel.bj.bcebos.com/${release_version}-${GPU}-${AVX}-${math}/paddlepaddle-${release_version}-cp${python_version}-cp${python_version}m${uncode}-linux_x86_64.whl" wheel_cpu_release="http://paddle-wheel.bj.bcebos.com/${release_version}-${GPU}-${math}/paddlepaddle-${release_version}-cp${python_version}-cp${python_version}m${uncode}-linux_x86_64.whl"
wheel_gpu_release="http://paddle-wheel.bj.bcebos.com/${release_version}-gpu-cuda${CUDA}-cudnn${CUDNN}-${AVX}-${math}/paddlepaddle_gpu-${release_version}.post${CUDA}${CUDNN}-cp${python_version}-cp${python_version}m${uncode}-linux_x86_64.whl" wheel_gpu_release="http://paddle-wheel.bj.bcebos.com/${release_version}-gpu-cuda${CUDA}-cudnn${CUDNN}-${math}/paddlepaddle_gpu-${release_version}.post${CUDA}${CUDNN}-cp${python_version}-cp${python_version}m${uncode}-linux_x86_64.whl"
wheel_gpu_release_noavx="http://paddle-wheel.bj.bcebos.com/${release_version}-gpu-cuda${CUDA}-cudnn${CUDNN}-${AVX}-${math}/paddlepaddle_gpu-${release_version}-cp${python_version}-cp${python_version}m${uncode}-linux_x86_64.whl" wheel_cpu_develop="http://paddle-wheel.bj.bcebos.com/latest-cpu-${math}/paddlepaddle-latest-cp${python_version}-cp${python_version}m${uncode}-linux_x86_64.whl"
wheel_cpu_develop="http://paddle-wheel.bj.bcebos.com/latest-cpu-${AVX}-${math}/paddlepaddle-latest-cp${python_version}-cp${python_version}m${uncode}-linux_x86_64.whl" wheel_gpu_develop="http://paddle-wheel.bj.bcebos.com/latest-gpu-cuda${CUDA}-cudnn${CUDNN}-${math}/paddlepaddle_gpu-latest-cp${python_version}-cp${python_version}m${uncode}-linux_x86_64.whl"
wheel_gpu_develop="http://paddle-wheel.bj.bcebos.com/latest-gpu-cuda${CUDA}-cudnn${CUDNN}-${AVX}-${math}/paddlepaddle_gpu-latest-cp${python_version}-cp${python_version}m${uncode}-linux_x86_64.whl"
if [[ "$paddle_version" == "2" ]];then if [[ "$paddle_version" == "2" ]];then
if [[ "$GPU" == "gpu" ]];then if [[ "$GPU" == "gpu" ]];then
if [[ ${AVX} == "avx" ]];then rm -rf `echo $wheel_cpu_release|awk -F '/' '{print $NF}'`
rm -rf `echo $wheel_gpu_release|awk -F '/' '{print $NF}'`
wget -q $wheel_gpu_release wget -q $wheel_gpu_release
if [ "$?" == "0" ];then if [ "$?" == "0" ];then
$python_path -m pip install ${use_virtualenv} -i https://mirrors.aliyun.com/pypi/simple --trusted-host=mirrors.aliyun.com $wheel_gpu_release $python_path -m pip install ${use_virtualenv} -i https://mirrors.aliyun.com/pypi/simple --trusted-host=mirrors.aliyun.com $wheel_gpu_release
if [ "$?" == 0 ];then if [ "$?" == 0 ];then
echo 安装成功 echo 安装成功
exit 0
else else
echo 安装失败 echo 安装失败
exit 1 exit 1
...@@ -428,22 +415,6 @@ function PipLinuxInstall(){ ...@@ -428,22 +415,6 @@ function PipLinuxInstall(){
echo paddlepaddle whl包下载失败 echo paddlepaddle whl包下载失败
exit 1 exit 1
fi fi
else
rm -rf `echo $wheel_gpu_release_novax|awk -F '/' '{print $NF}'`
wget -q $wheel_gpu_release_novax
if [ "$?" == "0" ];then
$python_path -m pip install ${use_virtualenv} -i https://mirrors.aliyun.com/pypi/simple --trusted-host=mirrors.aliyun.com $wheel_gpu_release_noavx
if [ "$?" == 0 ];then
echo 安装成功
else
echo 安装失败
exit 1
fi
else
echo paddlepaddle whl包下载失败
exit 1
fi
fi
else else
rm -rf `echo $wheel_cpu_release|awk -F '/' '{print $NF}'` rm -rf `echo $wheel_cpu_release|awk -F '/' '{print $NF}'`
wget -q $wheel_cpu_release wget -q $wheel_cpu_release
...@@ -451,6 +422,7 @@ function PipLinuxInstall(){ ...@@ -451,6 +422,7 @@ function PipLinuxInstall(){
$python_path -m pip install ${use_virtualenv} -i https://mirrors.aliyun.com/pypi/simple --trusted-host=mirrors.aliyun.com $wheel_cpu_release $python_path -m pip install ${use_virtualenv} -i https://mirrors.aliyun.com/pypi/simple --trusted-host=mirrors.aliyun.com $wheel_cpu_release
if [ "$?" == 0 ];then if [ "$?" == 0 ];then
echo 安装成功 echo 安装成功
exit 0
else else
echo 安装失败 echo 安装失败
exit 1 exit 1
...@@ -460,14 +432,15 @@ function PipLinuxInstall(){ ...@@ -460,14 +432,15 @@ function PipLinuxInstall(){
exit 1 exit 1
fi fi
fi fi
else fi
if [[ "$GPU" == "gpu" ]];then if [[ "$GPU" == "gpu" ]];then
rm -rf `echo $wheel_gpu_develop|awk -F '/' '{print $NF}'` rm -rf `echo $wheel_gpu_develop|awk -F '/' '{print $NF}'`
wget -q $wheel_gpu_develop wget -q $wheel_gpu_develop
if [ "$?" == "0" ];then if [ "$?" == "0" ];then
$python_path -m pip install ${use_virtualenv} -i https://mirrors.aliyun.com/pypi/simple --trusted-host=mirrors.aliyun.com $wheel_gpu_develop $python_path -m pip install ${use_virtualenv} -i https://mirrors.aliyun.com/pypi/simple --trusted-host=mirrors.aliyun.com $wheel_gpu_develop
if [ "$?" == 0 ];then if [ "$?" == 0 ];then
echo 安装成功 echo 安装成功
exit 0
else else
echo 安装失败 echo 安装失败
exit 1 exit 1
...@@ -476,13 +449,14 @@ function PipLinuxInstall(){ ...@@ -476,13 +449,14 @@ function PipLinuxInstall(){
echo paddlepaddle whl包下载失败 echo paddlepaddle whl包下载失败
exit 1 exit 1
fi fi
else else
rm -rf `echo $wheel_cpu_develop|awk -F '/' '{print $NF}'` rm -rf `echo $wheel_cpu_develop|awk -F '/' '{print $NF}'`
wget -q $wheel_cpu_develop wget -q $wheel_cpu_develop
if [ "$?" == "0" ];then if [ "$?" == "0" ];then
$python_path -m pip install ${use_virtualenv} -i https://mirrors.aliyun.com/pypi/simple --trusted-host=mirrors.aliyun.com $wheel_cpu_develop $python_path -m pip install ${use_virtualenv} -i https://mirrors.aliyun.com/pypi/simple --trusted-host=mirrors.aliyun.com $wheel_cpu_develop
if [ "$?" == 0 ];then if [ "$?" == 0 ];then
echo 安装成功 echo 安装成功
exit 0
else else
echo 安装失败 echo 安装失败
exit 1 exit 1
...@@ -492,14 +466,12 @@ function PipLinuxInstall(){ ...@@ -492,14 +466,12 @@ function PipLinuxInstall(){
exit 1 exit 1
fi fi
fi fi
fi
} }
function checkLinuxGPU(){ function checkLinuxGPU(){
read -n1 -p "即将检测您的机器是否含GPU,请按回车键继续..." read -n1 -p "即将检测您的机器是否含GPU,请按回车键继续..."
echo echo
AVX=`cat /proc/cpuinfo |grep avx|tail -1|grep avx`
which nvidia-smi >/dev/null 2>&1 which nvidia-smi >/dev/null 2>&1
if [ "$?" != "0" ];then if [ "$?" != "0" ];then
GPU='cpu' GPU='cpu'
...@@ -730,8 +702,6 @@ gpu_list=( ...@@ -730,8 +702,6 @@ gpu_list=(
echo echo
checkLinuxPython checkLinuxPython
echo echo
checkLinuxAVX
echo
echo "Step 6.是否使用Python的虚拟环境" echo "Step 6.是否使用Python的虚拟环境"
use_virtualenv="--user" use_virtualenv="--user"
checkPythonVirtualenv checkPythonVirtualenv
...@@ -757,6 +727,9 @@ function checkMacPython2(){ ...@@ -757,6 +727,9 @@ function checkMacPython2(){
if [[ $? == "0" ]];then if [[ $? == "0" ]];then
if [ "$python_version" == "" ] || ( [ "$python_root" == "/usr/bin/python" ] && ( [ "$python_version" \< "$python_min" ] || ( [ "$python_version" \> "$python_min" ] && [ ${#python_version} -lt ${#python_min} ] ) ) );then if [ "$python_version" == "" ] || ( [ "$python_root" == "/usr/bin/python" ] && ( [ "$python_version" \< "$python_min" ] || ( [ "$python_version" \> "$python_min" ] && [ ${#python_version} -lt ${#python_min} ] ) ) );then
clearMacPythonEnv clearMacPythonEnv
elif [[ "$python_version" < "2.7.15" ]];then
echo -e " => 在您的环境中找到 \033[32m[ $python_version ]\033[0m,此版本小于2.7.15不建议使用,请选择其他版本."
exit
else else
check_python=`echo $python_version | grep "Python 2"` check_python=`echo $python_version | grep "Python 2"`
if [[ -n "$check_python" ]];then if [[ -n "$check_python" ]];then
...@@ -974,20 +947,6 @@ function checkMacPythonVersion(){ ...@@ -974,20 +947,6 @@ function checkMacPythonVersion(){
done done
} }
function checkMacAVX(){
read -n1 -p "Step 4. 检测您的Mac是否支持AVX指令集,请按回车键继续..."
if [[ $AVX != "" ]];then
AVX="avx"
echo ""
green " 检测结果:支持"
echo ""
return 0
else
red " 检测结果:不支持。非常抱歉,PaddlePaddle在Mac系统暂不提供no_avx类型的安装包,您可以选择在Linux系统中安装no_avx版的PaddlePaddle, 请按回车键退出..."
echo
return 1
fi
}
function checkMacGPU(){ function checkMacGPU(){
read -n1 -p "Step 5. 选择CPU/GPU版本,请按回车键继续..." read -n1 -p "Step 5. 选择CPU/GPU版本,请按回车键继续..."
...@@ -1003,7 +962,6 @@ function checkMacGPU(){ ...@@ -1003,7 +962,6 @@ function checkMacGPU(){
function macos() { function macos() {
path='http://paddlepaddle.org/download?url=' path='http://paddlepaddle.org/download?url='
AVX=`sysctl -a | grep cpu | grep AVX1.0 | tail -1 | grep AVX`
while true while true
do do
...@@ -1012,8 +970,6 @@ function macos() { ...@@ -1012,8 +970,6 @@ function macos() {
checkMacPythonVersion checkMacPythonVersion
checkMacAVX
checkMacGPU checkMacGPU
...@@ -1021,7 +977,6 @@ function macos() { ...@@ -1021,7 +977,6 @@ function macos() {
echo echo
yellow "即将为您下载并安装PaddlePaddle,请按回车键继续..." yellow "即将为您下载并安装PaddlePaddle,请按回车键继续..."
read -n1 -p "" read -n1 -p ""
echo
if [[ $paddle_version == "2" ]];then if [[ $paddle_version == "2" ]];then
$python_root -m pip install paddlepaddle $python_root -m pip install paddlepaddle
if [[ $? == "0" ]];then if [[ $? == "0" ]];then
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册