未验证 提交 c196d9aa 编写于 作者: X xuxinyi389 提交者: GitHub

One click configuration of CI environment (#56817)

* One click configuration of CI environment

* fix bugs
上级 394bb8c2
......@@ -20,29 +20,36 @@
:: Install compile environment for xly CI.
::
:: Include:
:: 1. CMake 3.17.0
:: 1. CMake 3.18.0
:: 2. Git 2.28.0
:: 3. Python 3.8.3
:: 3. Python 3.8.3\3.9.7\3.10.0
:: 4. Visual Studio 2017 Community
:: 5. CUDA 11.2
:: 6. java jre
:: 7. sccache
:: 8. xly agent
:: 8. TensorRT
:: 9. xly agent
:: Echo command is not required.
@echo off
cd /d %~dp0%
SET INSTALL_FLAG=%1
:: 0. PR_CI_Windows_OPENBLAS
:: 1. PR_CI_Windows_Inference,will install VS2019, CUDA11.2
:: 2. PR_CI_Windows,CUDA10.2
:: ===== start step 0: wget tool =====
:: Download wget for windows when there is not wget tool.
echo ">>>>>>>> step [0/8]: wget tool"
echo ">>>>>>>> step [0/9]: wget tool"
wget --help > nul 2> nul || call:install_wget
goto cmake
:install_wget
echo There is not wget in this PC, will download wget 1.20.
echo Download package from https://eternallybored.org/misc/wget/1.20/64/wget.exe ...
certutil -urlcache -split -f https://eternallybored.org/misc/wget/1.20/64/wget.exe > nul 2> nul
echo There is not wget in this PC, will download wget 1.21.4.
echo Download package from https://eternallybored.org/misc/wget/1.21.4/64/wget.exe ...
certutil -urlcache -split -f https://eternallybored.org/misc/wget/1.21.4/64/wget.exe > nul 2> nul
if %errorlevel% == 0 (
echo Download wget tool into %cd% success.
) else (
......@@ -53,26 +60,26 @@ goto :eof
:: ===== end step 0: wget tool =====
:: ===== start step 1: cmake =====
:: Download CMake-3.17.0 and add in PATH when it not installed.
:: TODO: limit version >= 3.17.0
:: Download CMake-3.18.0 and add in PATH when it not installed.
:: TODO: limit version >= 3.18.0
:cmake
echo ">>>>>>>> step [1/8]: CMake 3.17.0"
echo ">>>>>>>> step [1/9]: CMake 3.18.0"
cmake --help > nul 2> nul || call :install_cmake
goto git
:install_cmake
echo There is not cmake in this PC, will install cmake-3.17.0.
echo Download package from https://cmake.org/files/v3.17/cmake-3.17.0-win64-x64.msi ...
wget -O cmake-3.17.0-win64-x64.msi https://cmake.org/files/v3.17/cmake-3.17.0-win64-x64.msi
echo Install cmake-3.17.0 ...
echo There is not cmake in this PC, will install cmake-3.18.0.
echo Download package from https://cmake.org/files/v3.18/cmake-3.18.0-win64-x64.msi ...
wget -O cmake-3.18.0-win64-x64.msi https://cmake.org/files/v3.18/cmake-3.18.0-win64-x64.msi
echo Install cmake-3.18.0 ...
:: /passive [silent installation]
:: /norestart [do not restart]
:: ADD_CMAKE_TO_PATH = System [add CMake to the system PATH for all users]
start /wait cmake-3.17.0-win64-x64.msi /passive /norestart ADD_CMAKE_TO_PATH=System
start /wait cmake-3.18.0-win64-x64.msi /passive /norestart ADD_CMAKE_TO_PATH=System
if %errorlevel% == 0 (
echo Install CMake-3.17.0 success!
echo Install CMake-3.18.0 success!
) else (
echo Error***** Install Cmake-3.17.0 failed, please re-install it manually.
echo Error***** Install Cmake-3.18.0 failed, please re-install it manually.
)
goto :eof
:: ===== end step 1: cmake =====
......@@ -81,7 +88,7 @@ goto :eof
:: Download Git-2.28.0 and add in PATH when it not installed.
:: TODO: limit version >= 2.28.0
:git
echo ">>>>>>>> step [2/8]: Git 2.28.0"
echo ">>>>>>>> step [2/9]: Git 2.28.0"
git --help > nul 2> nul || call :install_git
goto python
......@@ -103,17 +110,19 @@ goto :eof
:: ===== end step 2: Git =====
:: ===== start step 3: Python =====
:: Download Python-3.8.3 and add in PATH when it not installed.
:: Download Python and add in PATH when it not installed.
:: TODO: limit version >= 3.8.3
:python
echo ">>>>>>>> step [3/8]: Python 3.8.3"
python -V 2>&1 | findstr /C:"Python 3.8.3" > nul 2> nul || call :install_python
echo ">>>>>>>> step [3/9]: Python"
where python 2>&1 | findstr /C:"Python38" > nul 2> nul || call :install_python3.8.3
where python 2>&1 | findstr /C:"Python39" > nul 2> nul || call :install_python3.9.7
where python 2>&1 | findstr /C:"Python310" > nul 2> nul || call :install_python3.10.0
goto vs
:install_python
:install_python3.8.3
echo There is not Python in this PC, will install Python-3.8.3
echo Download package from https://paddle-ci.gz.bcebos.com/window_requirement/python-3.8.3-amd64.exe ...
wget -O python-3.8.3-amd64.exe https://paddle-ci.gz.bcebos.com/window_requirement/python-3.8.3-amd64.exe
echo Download package from https://www.python.org/ftp/python/3.8.3/python-3.8.3-amd64.exe ...
wget -O python-3.8.3-amd64.exe https://www.python.org/ftp/python/3.8.3/python-3.8.3-amd64.exe
echo Install Python-3.8.3 ...
:: /passive [silent install]
:: InstallAllUsers [add path for all users]
......@@ -126,16 +135,46 @@ if %errorlevel% == 0 (
echo Error***** Install python-3.8.3 failed, please re-install it manually.
)
goto :eof
:install_python3.9.7
echo There is not Python in this PC, will install Python-3.9.7
echo Download package from https://www.python.org/ftp/python/3.9.7/python-3.9.7-amd64.exe ...
wget -O python-3.9.7-amd64.exe https://www.python.org/ftp/python/3.9.7/python-3.9.7-amd64.exe
echo Install Python-3.9.7 ...
start /wait python-3.9.7-amd64.exe /passive InstallAllUsers=1 PrependPath=1 TargetDir=C:\Python39
if %errorlevel% == 0 (
echo Install python-3.9.7 success!
) else (
echo Error***** Install python-3.9.7 failed, please re-install it manually.
)
goto :eof
:install_python3.10.0
echo There is not Python in this PC, will install Python-3.10.0
echo Download package from https://www.python.org/ftp/python/3.10.0/python-3.10.0-amd64.exe ...
wget -O python-3.10.0-amd64.exe https://www.python.org/ftp/python/3.10.0/python-3.10.0-amd64.exe
echo Install Python-3.10.0 ...
start /wait python-3.10.0-amd64.exe /passive InstallAllUsers=1 PrependPath=1 TargetDir=C:\Python310
if %errorlevel% == 0 (
echo Install python-3.10.0 success!
) else (
echo Error***** Install python-3.10.0 failed, please re-install it manually.
)
goto :eof
:: ===== end step 3: Python =====
:: ===== start step 4: Visual Studio 2017 Community =====
:: ===== start step 4: Visual Studio Community =====
:: Download Visual Studio 2017 when it not installed.
:vs
echo ">>>>>>>> step [4/8]: Visual Studio 2017 "
cmd /C "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" > nul 2> nul || call :install_visual_studio
echo ">>>>>>>> step [4/9]: Visual Studio"
if %INSTALL_FLAG% == 1 (
cmd /C "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" > nul 2> nul || call :install_visual_studio2019
) else (
cmd /C "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" > nul 2> nul || call :install_visual_studio2017
)
goto :cuda
:install_visual_studio
:install_visual_studio2017
echo There is not Visual Studio in this PC, will install VS2017.
echo Download package from "https://paddle-ci.gz.bcebos.com/window_requirement/VS2017/vs_Community.exe"
wget -O vs_Community.exe "https://paddle-ci.gz.bcebos.com/window_requirement/VS2017/vs_Community.exe"
......@@ -151,15 +190,57 @@ if %errorlevel% == 0 (
echo Error***** Install Visual Studio 2017 failed, please re-install it manually.
)
goto :eof
:: ===== end step 4: Visual Studio 2017 =====
:: ===== start step 5: CUDA 11 =====
:install_visual_studio2019
echo There is not Visual Studio in this PC, will install VS2019.
echo Download package from "https://paddle-ci.gz.bcebos.com/window_requirement/vs_community_2019.exe"
wget -O vs_community_2019.exe "https://paddle-ci.gz.bcebos.com/window_requirement/vs_community_2019.exe"
echo Install Visual Studio 2019 ...
start /wait vs_community_2019.exe --passive --add Microsoft.VisualStudio.Workload.NativeDesktop --add Microsoft.VisualStudio.Workload.Universal --includeRecommended
if %errorlevel% == 0 (
echo Install Visual Studio 2019 success!
) else (
echo Error***** Install Visual Studio 2019 failed, please re-install it manually.
)
goto :eof
:: ===== end step 4: Visual Studio Community =====
:: ===== start step 5: CUDA =====
:cuda
echo ">>>>>>>> step [5/8]: CUDA 11.2"
cmd /C nvcc --version 2> nul | findstr /C:"11.2" > nul 2> nul || call :install_cuda
echo ">>>>>>>> step [5/9]: CUDA "
if %INSTALL_FLAG% == 1 (
cmd /C nvcc --version 2> nul | findstr /C:"11.2" > nul 2> nul || call :install_cuda112
)
if %INSTALL_FLAG% == 2 (
cmd /C nvcc --version 2> nul | findstr /C:"10.2" > nul 2> nul || call :install_cuda102
)
goto java-jre
:install_cuda
:install_cuda102
echo There is not CUDA in this PC, will install CUDA-10.2.
echo Download package from "https://paddle-ci.gz.bcebos.com/window_requirement/cuda_10.2.89_441.22_win10.exe"
wget -O cuda_installer.exe "https://paddle-ci.gz.bcebos.com/window_requirement/cuda_10.2.89_441.22_win10.exe"
echo Install CUDA-10.2 ...
:: -s [silent install]
start /wait cuda_installer.exe -s
if %errorlevel% == 0 (
echo Install CUDA-10.2 success!
) else (
echo Error***** Install CUDA-10.2 failed, please re-install it manually.
goto :eof
)
del cuda_installer.exe
echo Download cudnn from "https://paddle-ci.gz.bcebos.com/window_requirement/cudnn-10.2-windows10-x64-v7.6.5.32.zip"
wget -O cudnn-10.2-windows10-x64-v7.6.5.32.zip "https://paddle-ci.gz.bcebos.com/window_requirement/cudnn-10.2-windows10-x64-v7.6.5.32.zip"
tar xf cudnn-10.2-windows10-x64-v7.6.5.32.zip
xcopy /E /Y /R "cuda\bin\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin"
xcopy /E /Y /R "cuda\include\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include"
xcopy /E /Y /R "cuda\lib\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\lib"
rd /s /q cuda
goto :eof
:install_cuda112
echo There is not CUDA in this PC, will install CUDA-11.2.
echo Download package from "https://paddle-ci.gz.bcebos.com/window_requirement/cuda_11.2.0_460.89_win10.exe"
wget -O cuda_installer.exe "https://paddle-ci.gz.bcebos.com/window_requirement/cuda_11.2.0_460.89_win10.exe"
......@@ -173,7 +254,6 @@ if %errorlevel% == 0 (
goto :eof
)
del cuda_installer.exe
echo Download cudnn from "https://paddle-ci.gz.bcebos.com/window_requirement/cudnn-11.2-windows-x64-v8.1.0.77.zip"
wget -O cudnn-11.2-windows-x64-v8.1.0.77.zip "https://paddle-ci.gz.bcebos.com/window_requirement/cudnn-11.2-windows-x64-v8.1.0.77.zip"
tar xf cudnn-11.2-windows-x64-v8.1.0.77.zip
......@@ -182,11 +262,11 @@ xcopy /E /Y /R "cuda\include\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\C
xcopy /E /Y /R "cuda\lib\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\lib"
rd /s /q cuda
goto :eof
:: ===== end step 5: CUDA 10 =====
:: ===== end step 5: CUDA =====
:: ===== start step 6: java jre =====
:java-jre
echo ">>>>>>>> step [6/8]: java jre"
echo ">>>>>>>> step [6/9]: java jre"
cmd /C java -version > nul 2> nul || call :install_java
goto sccache
......@@ -208,21 +288,44 @@ goto :eof
:: ===== start step 7: sccache on windowss =====
:sccache
echo ">>>>>>>> step [7/8]: sccache"
echo ">>>>>>>> step [7/9]: sccache"
cmd /C sccache -V > nul 2> nul || call :download_sccache
goto xly-agent
goto tensorrt
:download_sccache
echo There is not sccache in this PC, will install sccache.
echo Download package from https://paddle-ci.gz.bcebos.com/window_requirement/sccache.exe
wget -O sccache.exe "https://paddle-ci.gz.bcebos.com/window_requirement/sccache.exe"
copy sccache.exe C:\Python38 /Y
goto :eof
:: ===== end step 7: sccache on windows =====
:: ===== start step 8: xly agent =====
:: ===== start step 8: TensorRT =====
:tensorrt
echo ">>>>>>>> step [8/9]: TensorRT"
if %INSTALL_FLAG% == 2 (
call :download_TensorRT_7_0_0_11
)
if %INSTALL_FLAG% == 1 (
call :download_TensorRT_8_0_1_6
)
goto xly-agent
:download_TensorRT_7_0_0_11
if not exist TensorRT-7.0.0.11.Windows10.x86_64.cuda-10.2.cudnn7.6.zip wget -O TensorRT-7.0.0.11.Windows10.x86_64.cuda-10.2.cudnn7.6.zip ^
"https://paddle-ci.gz.bcebos.com/window_requirement/TensorRT-7.0.0.11.Windows10.x86_64.cuda-10.2.cudnn7.6.zip"
goto :eof
:download_TensorRT_8_0_1_6
if not exist TTensorRT-8.0.1.6.Windows10.x86_64.cuda-11.3.cudnn8.2.zip wget -O TensorRT-8.0.1.6.Windows10.x86_64.cuda-11.3.cudnn8.2.zip ^
"https://paddle-ci.gz.bcebos.com/window_requirement/TensorRT-8.0.1.6.Windows10.x86_64.cuda-11.3.cudnn8.2.zip"
goto :eof
:: ===== end step 8: TensorRT =====
:: ===== start step 9: xly agent =====
:xly-agent
echo ">>>>>>>> step [8/8]: xly agent"
wget -O agent.jar "https://xly.bce.baidu.com/sa_server/agent/v1/download?version=1.2.8"
:: ===== end step 8: xly agent =====
echo ">>>>>>>> step [9/9]: xly agent"
if not exist agent.jar wget -O agent.jar "https://xly.bce.baidu.com/sa_server/agent/v1/download?version=1.2.8"
:: ===== end step 9: xly agent =====
pause
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册