Skip to content

Commit c196d9a

Browse files
authored
One click configuration of CI environment (#56817)
* One click configuration of CI environment * fix bugs
1 parent 394bb8c commit c196d9a

File tree

1 file changed

+145
-42
lines changed

1 file changed

+145
-42
lines changed

tools/windows/build_compile_environment.bat

Lines changed: 145 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,36 @@
2020
:: Install compile environment for xly CI.
2121
::
2222
:: Include:
23-
:: 1. CMake 3.17.0
23+
:: 1. CMake 3.18.0
2424
:: 2. Git 2.28.0
25-
:: 3. Python 3.8.3
25+
:: 3. Python 3.8.3\3.9.7\3.10.0
2626
:: 4. Visual Studio 2017 Community
2727
:: 5. CUDA 11.2
2828
:: 6. java jre
2929
:: 7. sccache
30-
:: 8. xly agent
30+
:: 8. TensorRT
31+
:: 9. xly agent
3132

3233
:: Echo command is not required.
3334
@echo off
3435
cd /d %~dp0%
3536

37+
SET INSTALL_FLAG=%1
38+
:: 0. PR_CI_Windows_OPENBLAS
39+
:: 1. PR_CI_Windows_Inference,will install VS2019, CUDA11.2
40+
:: 2. PR_CI_Windows,CUDA10.2
41+
42+
3643
:: ===== start step 0: wget tool =====
3744
:: Download wget for windows when there is not wget tool.
38-
echo ">>>>>>>> step [0/8]: wget tool"
45+
echo ">>>>>>>> step [0/9]: wget tool"
3946
wget --help > nul 2> nul || call:install_wget
4047
goto cmake
4148

4249
:install_wget
43-
echo There is not wget in this PC, will download wget 1.20.
44-
echo Download package from https://eternallybored.org/misc/wget/1.20/64/wget.exe ...
45-
certutil -urlcache -split -f https://eternallybored.org/misc/wget/1.20/64/wget.exe > nul 2> nul
50+
echo There is not wget in this PC, will download wget 1.21.4.
51+
echo Download package from https://eternallybored.org/misc/wget/1.21.4/64/wget.exe ...
52+
certutil -urlcache -split -f https://eternallybored.org/misc/wget/1.21.4/64/wget.exe > nul 2> nul
4653
if %errorlevel% == 0 (
4754
echo Download wget tool into %cd% success.
4855
) else (
@@ -53,26 +60,26 @@ goto :eof
5360
:: ===== end step 0: wget tool =====
5461

5562
:: ===== start step 1: cmake =====
56-
:: Download CMake-3.17.0 and add in PATH when it not installed.
57-
:: TODO: limit version >= 3.17.0
63+
:: Download CMake-3.18.0 and add in PATH when it not installed.
64+
:: TODO: limit version >= 3.18.0
5865
:cmake
59-
echo ">>>>>>>> step [1/8]: CMake 3.17.0"
66+
echo ">>>>>>>> step [1/9]: CMake 3.18.0"
6067
cmake --help > nul 2> nul || call :install_cmake
6168
goto git
6269

6370
:install_cmake
64-
echo There is not cmake in this PC, will install cmake-3.17.0.
65-
echo Download package from https://cmake.org/files/v3.17/cmake-3.17.0-win64-x64.msi ...
66-
wget -O cmake-3.17.0-win64-x64.msi https://cmake.org/files/v3.17/cmake-3.17.0-win64-x64.msi
67-
echo Install cmake-3.17.0 ...
71+
echo There is not cmake in this PC, will install cmake-3.18.0.
72+
echo Download package from https://cmake.org/files/v3.18/cmake-3.18.0-win64-x64.msi ...
73+
wget -O cmake-3.18.0-win64-x64.msi https://cmake.org/files/v3.18/cmake-3.18.0-win64-x64.msi
74+
echo Install cmake-3.18.0 ...
6875
:: /passive [silent installation]
6976
:: /norestart [do not restart]
7077
:: ADD_CMAKE_TO_PATH = System [add CMake to the system PATH for all users]
71-
start /wait cmake-3.17.0-win64-x64.msi /passive /norestart ADD_CMAKE_TO_PATH=System
78+
start /wait cmake-3.18.0-win64-x64.msi /passive /norestart ADD_CMAKE_TO_PATH=System
7279
if %errorlevel% == 0 (
73-
echo Install CMake-3.17.0 success!
80+
echo Install CMake-3.18.0 success!
7481
) else (
75-
echo Error***** Install Cmake-3.17.0 failed, please re-install it manually.
82+
echo Error***** Install Cmake-3.18.0 failed, please re-install it manually.
7683
)
7784
goto :eof
7885
:: ===== end step 1: cmake =====
@@ -81,7 +88,7 @@ goto :eof
8188
:: Download Git-2.28.0 and add in PATH when it not installed.
8289
:: TODO: limit version >= 2.28.0
8390
:git
84-
echo ">>>>>>>> step [2/8]: Git 2.28.0"
91+
echo ">>>>>>>> step [2/9]: Git 2.28.0"
8592
git --help > nul 2> nul || call :install_git
8693
goto python
8794

@@ -103,17 +110,19 @@ goto :eof
103110
:: ===== end step 2: Git =====
104111

105112
:: ===== start step 3: Python =====
106-
:: Download Python-3.8.3 and add in PATH when it not installed.
113+
:: Download Python and add in PATH when it not installed.
107114
:: TODO: limit version >= 3.8.3
108115
:python
109-
echo ">>>>>>>> step [3/8]: Python 3.8.3"
110-
python -V 2>&1 | findstr /C:"Python 3.8.3" > nul 2> nul || call :install_python
116+
echo ">>>>>>>> step [3/9]: Python"
117+
where python 2>&1 | findstr /C:"Python38" > nul 2> nul || call :install_python3.8.3
118+
where python 2>&1 | findstr /C:"Python39" > nul 2> nul || call :install_python3.9.7
119+
where python 2>&1 | findstr /C:"Python310" > nul 2> nul || call :install_python3.10.0
111120
goto vs
112121

113-
:install_python
122+
:install_python3.8.3
114123
echo There is not Python in this PC, will install Python-3.8.3
115-
echo Download package from https://paddle-ci.gz.bcebos.com/window_requirement/python-3.8.3-amd64.exe ...
116-
wget -O python-3.8.3-amd64.exe https://paddle-ci.gz.bcebos.com/window_requirement/python-3.8.3-amd64.exe
124+
echo Download package from https://www.python.org/ftp/python/3.8.3/python-3.8.3-amd64.exe ...
125+
wget -O python-3.8.3-amd64.exe https://www.python.org/ftp/python/3.8.3/python-3.8.3-amd64.exe
117126
echo Install Python-3.8.3 ...
118127
:: /passive [silent install]
119128
:: InstallAllUsers [add path for all users]
@@ -126,16 +135,46 @@ if %errorlevel% == 0 (
126135
echo Error***** Install python-3.8.3 failed, please re-install it manually.
127136
)
128137
goto :eof
138+
139+
:install_python3.9.7
140+
echo There is not Python in this PC, will install Python-3.9.7
141+
echo Download package from https://www.python.org/ftp/python/3.9.7/python-3.9.7-amd64.exe ...
142+
wget -O python-3.9.7-amd64.exe https://www.python.org/ftp/python/3.9.7/python-3.9.7-amd64.exe
143+
echo Install Python-3.9.7 ...
144+
start /wait python-3.9.7-amd64.exe /passive InstallAllUsers=1 PrependPath=1 TargetDir=C:\Python39
145+
if %errorlevel% == 0 (
146+
echo Install python-3.9.7 success!
147+
) else (
148+
echo Error***** Install python-3.9.7 failed, please re-install it manually.
149+
)
150+
goto :eof
151+
152+
:install_python3.10.0
153+
echo There is not Python in this PC, will install Python-3.10.0
154+
echo Download package from https://www.python.org/ftp/python/3.10.0/python-3.10.0-amd64.exe ...
155+
wget -O python-3.10.0-amd64.exe https://www.python.org/ftp/python/3.10.0/python-3.10.0-amd64.exe
156+
echo Install Python-3.10.0 ...
157+
start /wait python-3.10.0-amd64.exe /passive InstallAllUsers=1 PrependPath=1 TargetDir=C:\Python310
158+
if %errorlevel% == 0 (
159+
echo Install python-3.10.0 success!
160+
) else (
161+
echo Error***** Install python-3.10.0 failed, please re-install it manually.
162+
)
163+
goto :eof
129164
:: ===== end step 3: Python =====
130165

131-
:: ===== start step 4: Visual Studio 2017 Community =====
166+
:: ===== start step 4: Visual Studio Community =====
132167
:: Download Visual Studio 2017 when it not installed.
133168
:vs
134-
echo ">>>>>>>> step [4/8]: Visual Studio 2017 "
135-
cmd /C "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" > nul 2> nul || call :install_visual_studio
169+
echo ">>>>>>>> step [4/9]: Visual Studio"
170+
if %INSTALL_FLAG% == 1 (
171+
cmd /C "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" > nul 2> nul || call :install_visual_studio2019
172+
) else (
173+
cmd /C "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" > nul 2> nul || call :install_visual_studio2017
174+
)
136175
goto :cuda
137176

138-
:install_visual_studio
177+
:install_visual_studio2017
139178
echo There is not Visual Studio in this PC, will install VS2017.
140179
echo Download package from "https://paddle-ci.gz.bcebos.com/window_requirement/VS2017/vs_Community.exe"
141180
wget -O vs_Community.exe "https://paddle-ci.gz.bcebos.com/window_requirement/VS2017/vs_Community.exe"
@@ -151,15 +190,57 @@ if %errorlevel% == 0 (
151190
echo Error***** Install Visual Studio 2017 failed, please re-install it manually.
152191
)
153192
goto :eof
154-
:: ===== end step 4: Visual Studio 2017 =====
155193

156-
:: ===== start step 5: CUDA 11 =====
194+
:install_visual_studio2019
195+
echo There is not Visual Studio in this PC, will install VS2019.
196+
echo Download package from "https://paddle-ci.gz.bcebos.com/window_requirement/vs_community_2019.exe"
197+
wget -O vs_community_2019.exe "https://paddle-ci.gz.bcebos.com/window_requirement/vs_community_2019.exe"
198+
echo Install Visual Studio 2019 ...
199+
start /wait vs_community_2019.exe --passive --add Microsoft.VisualStudio.Workload.NativeDesktop --add Microsoft.VisualStudio.Workload.Universal --includeRecommended
200+
if %errorlevel% == 0 (
201+
echo Install Visual Studio 2019 success!
202+
) else (
203+
echo Error***** Install Visual Studio 2019 failed, please re-install it manually.
204+
)
205+
goto :eof
206+
:: ===== end step 4: Visual Studio Community =====
207+
208+
:: ===== start step 5: CUDA =====
157209
:cuda
158-
echo ">>>>>>>> step [5/8]: CUDA 11.2"
159-
cmd /C nvcc --version 2> nul | findstr /C:"11.2" > nul 2> nul || call :install_cuda
210+
echo ">>>>>>>> step [5/9]: CUDA "
211+
if %INSTALL_FLAG% == 1 (
212+
cmd /C nvcc --version 2> nul | findstr /C:"11.2" > nul 2> nul || call :install_cuda112
213+
)
214+
if %INSTALL_FLAG% == 2 (
215+
cmd /C nvcc --version 2> nul | findstr /C:"10.2" > nul 2> nul || call :install_cuda102
216+
)
160217
goto java-jre
161218

162-
:install_cuda
219+
:install_cuda102
220+
echo There is not CUDA in this PC, will install CUDA-10.2.
221+
echo Download package from "https://paddle-ci.gz.bcebos.com/window_requirement/cuda_10.2.89_441.22_win10.exe"
222+
wget -O cuda_installer.exe "https://paddle-ci.gz.bcebos.com/window_requirement/cuda_10.2.89_441.22_win10.exe"
223+
echo Install CUDA-10.2 ...
224+
:: -s [silent install]
225+
start /wait cuda_installer.exe -s
226+
if %errorlevel% == 0 (
227+
echo Install CUDA-10.2 success!
228+
) else (
229+
echo Error***** Install CUDA-10.2 failed, please re-install it manually.
230+
goto :eof
231+
)
232+
del cuda_installer.exe
233+
234+
echo Download cudnn from "https://paddle-ci.gz.bcebos.com/window_requirement/cudnn-10.2-windows10-x64-v7.6.5.32.zip"
235+
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"
236+
tar xf cudnn-10.2-windows10-x64-v7.6.5.32.zip
237+
xcopy /E /Y /R "cuda\bin\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin"
238+
xcopy /E /Y /R "cuda\include\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include"
239+
xcopy /E /Y /R "cuda\lib\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\lib"
240+
rd /s /q cuda
241+
goto :eof
242+
243+
:install_cuda112
163244
echo There is not CUDA in this PC, will install CUDA-11.2.
164245
echo Download package from "https://paddle-ci.gz.bcebos.com/window_requirement/cuda_11.2.0_460.89_win10.exe"
165246
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 (
173254
goto :eof
174255
)
175256
del cuda_installer.exe
176-
177257
echo Download cudnn from "https://paddle-ci.gz.bcebos.com/window_requirement/cudnn-11.2-windows-x64-v8.1.0.77.zip"
178258
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"
179259
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
182262
xcopy /E /Y /R "cuda\lib\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\lib"
183263
rd /s /q cuda
184264
goto :eof
185-
:: ===== end step 5: CUDA 10 =====
265+
:: ===== end step 5: CUDA =====
186266

187267
:: ===== start step 6: java jre =====
188268
:java-jre
189-
echo ">>>>>>>> step [6/8]: java jre"
269+
echo ">>>>>>>> step [6/9]: java jre"
190270
cmd /C java -version > nul 2> nul || call :install_java
191271
goto sccache
192272

@@ -208,21 +288,44 @@ goto :eof
208288

209289
:: ===== start step 7: sccache on windowss =====
210290
:sccache
211-
echo ">>>>>>>> step [7/8]: sccache"
291+
echo ">>>>>>>> step [7/9]: sccache"
212292
cmd /C sccache -V > nul 2> nul || call :download_sccache
213-
goto xly-agent
293+
goto tensorrt
214294

215295
:download_sccache
216296
echo There is not sccache in this PC, will install sccache.
217297
echo Download package from https://paddle-ci.gz.bcebos.com/window_requirement/sccache.exe
218298
wget -O sccache.exe "https://paddle-ci.gz.bcebos.com/window_requirement/sccache.exe"
219299
copy sccache.exe C:\Python38 /Y
300+
goto :eof
220301
:: ===== end step 7: sccache on windows =====
221302

222-
:: ===== start step 8: xly agent =====
303+
:: ===== start step 8: TensorRT =====
304+
:tensorrt
305+
echo ">>>>>>>> step [8/9]: TensorRT"
306+
if %INSTALL_FLAG% == 2 (
307+
call :download_TensorRT_7_0_0_11
308+
)
309+
if %INSTALL_FLAG% == 1 (
310+
call :download_TensorRT_8_0_1_6
311+
)
312+
goto xly-agent
313+
314+
:download_TensorRT_7_0_0_11
315+
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 ^
316+
"https://paddle-ci.gz.bcebos.com/window_requirement/TensorRT-7.0.0.11.Windows10.x86_64.cuda-10.2.cudnn7.6.zip"
317+
goto :eof
318+
319+
:download_TensorRT_8_0_1_6
320+
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 ^
321+
"https://paddle-ci.gz.bcebos.com/window_requirement/TensorRT-8.0.1.6.Windows10.x86_64.cuda-11.3.cudnn8.2.zip"
322+
goto :eof
323+
:: ===== end step 8: TensorRT =====
324+
325+
:: ===== start step 9: xly agent =====
223326
:xly-agent
224-
echo ">>>>>>>> step [8/8]: xly agent"
225-
wget -O agent.jar "https://xly.bce.baidu.com/sa_server/agent/v1/download?version=1.2.8"
226-
:: ===== end step 8: xly agent =====
327+
echo ">>>>>>>> step [9/9]: xly agent"
328+
if not exist agent.jar wget -O agent.jar "https://xly.bce.baidu.com/sa_server/agent/v1/download?version=1.2.8"
329+
:: ===== end step 9: xly agent =====
227330

228331
pause

0 commit comments

Comments
 (0)