@@ -54,14 +54,14 @@ wmic process where name="python.exe" call terminate 2>NUL
5454rem ------initialize common variable------
5555if not defined GENERATOR set GENERATOR = " Visual Studio 15 2017 Win64"
5656if not defined BRANCH set BRANCH = develop
57- if not defined WITH_TENSORRT set WITH_TENSORRT = ON
57+ if not defined WITH_TENSORRT set WITH_TENSORRT = ON
5858if not defined TENSORRT_ROOT set TENSORRT_ROOT = D:/TensorRT
5959if not defined CUDA_ARCH_NAME set CUDA_ARCH_NAME = Auto
6060if not defined WITH_GPU set WITH_GPU = ON
6161if not defined WITH_MKL set WITH_MKL = ON
6262if not defined WITH_AVX set WITH_AVX = ON
6363if not defined WITH_TESTING set WITH_TESTING = ON
64- if not defined MSVC_STATIC_CRT set MSVC_STATIC_CRT = OFF
64+ if not defined MSVC_STATIC_CRT set MSVC_STATIC_CRT = ON
6565if not defined WITH_PYTHON set WITH_PYTHON = ON
6666if not defined ON_INFER set ON_INFER = ON
6767if not defined WITH_INFERENCE_API_TEST set WITH_INFERENCE_API_TEST = ON
@@ -75,6 +75,7 @@ if not defined LOG_LEVEL set LOG_LEVEL=normal
7575if not defined PRECISION_TEST set PRECISION_TEST = OFF
7676if not defined NIGHTLY_MODE set PRECISION_TEST = OFF
7777if not defined retry_times set retry_times = 2
78+ if not defined PYTHON_ROOT set PYTHON_ROOT = C:\Python37
7879
7980rem -------set cache build directory-----------
8081rmdir build\python /s/q
@@ -83,9 +84,6 @@ rmdir build\paddle_inference_install_dir /s/q
8384rmdir build\paddle_inference_c_install_dir /s/q
8485del build\CMakeCache.txt
8586
86- : set CI_SKIP_CPP_TEST if only *.py changed
87- git diff --name-only %BRANCH% | findstr /V " \.py" || set CI_SKIP_CPP_TEST = ON
88-
8987if " %WITH_CACHE% " == " OFF" (
9088 rmdir build /s/q
9189 goto :mkbuild
@@ -135,58 +133,6 @@ dir .
135133dir %cache_dir%
136134dir paddle\fluid\pybind\Release
137135
138- rem ------initialize the python environment------
139- if not defined PYTHON_ROOT set PYTHON_ROOT = C:\Python37
140- set PYTHON_EXECUTABLE = %PYTHON_ROOT% \python.exe
141- set PATH = %PYTHON_ROOT% ;%PYTHON_ROOT% \Scripts;%PATH%
142-
143- rem ToDo: virtual environment can't be deleted safely, some process not exit when task is canceled
144- rem Now use system python environment temporarily
145- rem %PYTHON_EXECUTABLE% -m pip install virtualenv
146- rem %PYTHON_EXECUTABLE% -m virtualenv paddle_winci
147- rem call paddle_winci\Scripts\activate.bat
148-
149- rem ------pre install python requirement----------
150- where python
151- where pip
152- pip install wheel --user
153- pip install -r %work_dir% \python\requirements.txt --user
154-
155- if %ERRORLEVEL% NEQ 0 (
156- echo pip install requirements.txt failed!
157- exit /b 7
158- )
159-
160- rem ------pre install clcache and init config----------
161- rem pip install clcache --user
162- pip uninstall -y clcache
163- :: set USE_CLCACHE to enable clcache
164- rem set USE_CLCACHE=1
165- :: In some scenarios, CLCACHE_HARDLINK can save one file copy.
166- rem set CLCACHE_HARDLINK=1
167- :: If it takes more than 1000s to obtain the right to use the cache, an error will be reported
168- rem set CLCACHE_OBJECT_CACHE_TIMEOUT_MS=1000000
169- :: set maximum cache size to 20G
170- rem clcache.exe -M 21474836480
171-
172- :: install ninja if GENERATOR is Ninja
173- if %GENERATOR% == " Ninja" (
174- pip install ninja
175- if %errorlevel% NEQ 0 (
176- echo pip install ninja failed!
177- exit /b 7
178- )
179- )
180-
181- rem ------show summary of current environment----------
182- cmake --version
183- if " %WITH_GPU% " == " ON" (
184- nvcc --version
185- nvidia-smi
186- )
187- :: python %work_dir%\tools\summary_env.py
188- :: %cache_dir%\tools\busybox64.exe bash %work_dir%\tools\get_cpu_info.sh
189-
190136goto :CASE_%1
191137
192138echo " Usage: paddle_build.bat [OPTION]"
@@ -266,8 +212,10 @@ rem "Other configurations are added here"
266212rem :CASE_wincheck_others
267213rem call ...
268214
215+
269216rem ---------------------------------------------------------------------------------------------
270217:cmake
218+ @ ECHO OFF
271219echo ========================================
272220echo Step 1. Cmake ...
273221echo ========================================
@@ -281,12 +229,52 @@ set PATH=C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64;%PATH%
281229for /F %% # in ('wmic os get localdatetime^ |findstr 20') do set start = %% #
282230set start = %start:~4 ,10 %
283231
284- @ ECHO ON
285- if not defined CUDA_TOOLKIT_ROOT_DIR set CUDA_TOOLKIT_ROOT_DIR = C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0
232+ if not defined CUDA_TOOLKIT_ROOT_DIR set CUDA_TOOLKIT_ROOT_DIR = C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2
286233set PATH = %TENSORRT_ROOT:/ =\ % \lib;%CUDA_TOOLKIT_ROOT_DIR% \bin;%CUDA_TOOLKIT_ROOT_DIR% \libnvvp;%PATH%
287234
288- rem ------set third_party cache dir------
235+ rem install ninja if GENERATOR is Ninja
236+ if %GENERATOR% == " Ninja" (
237+ pip install ninja
238+ if %errorlevel% NEQ 0 (
239+ echo pip install ninja failed!
240+ exit /b 7
241+ )
242+ )
289243
244+ rem ------show summary of current GPU environment----------
245+ cmake --version
246+ if " %WITH_GPU% " == " ON" (
247+ nvcc --version
248+ nvidia-smi
249+ )
250+
251+ rem ------initialize the python environment------
252+ set PYTHON_EXECUTABLE = %PYTHON_ROOT% \python.exe
253+ set PATH = %PYTHON_ROOT% ;%PYTHON_ROOT% \Scripts;%PATH%
254+ if %WITH_PYTHON% == " OFF" (
255+ where python
256+ where pip
257+ pip install wheel --user
258+ pip install -r %work_dir% \python\requirements.txt --user
259+ if %ERRORLEVEL% NEQ 0 (
260+ echo pip install requirements.txt failed!
261+ exit /b 7
262+ )
263+ )
264+
265+ rem ------pre install clcache and init config----------
266+ rem pip install clcache --user
267+ pip uninstall -y clcache
268+ :: set USE_CLCACHE to enable clcache
269+ rem set USE_CLCACHE=1
270+ :: In some scenarios, CLCACHE_HARDLINK can save one file copy.
271+ rem set CLCACHE_HARDLINK=1
272+ :: If it takes more than 1000s to obtain the right to use the cache, an error will be reported
273+ rem set CLCACHE_OBJECT_CACHE_TIMEOUT_MS=1000000
274+ :: set maximum cache size to 20G
275+ rem clcache.exe -M 21474836480
276+
277+ rem ------set third_party cache dir------
290278: clear third party cache every once in a while
291279for /F %% # in ('wmic os get localdatetime^ |findstr 20') do set datetime = %% #
292280set day_now = %datetime:~6 ,2 %
@@ -500,6 +488,10 @@ echo ========================================
500488echo Step 4. Running unit tests ...
501489echo ========================================
502490
491+
492+ : set CI_SKIP_CPP_TEST if only *.py changed
493+ git diff --name-only %BRANCH% | findstr /V " \.py" || set CI_SKIP_CPP_TEST = ON
494+
503495pip install -r %work_dir% \python\unittest_py\requirements.txt --user
504496if %ERRORLEVEL% NEQ 0 (
505497 echo pip install unittest requirements.txt failed!
0 commit comments