From a91642454f36533925422b7bc4d99d18ab10d14e Mon Sep 17 00:00:00 2001 From: Sing_chan <51314274+betterpig@users.noreply.github.com> Date: Thu, 24 Mar 2022 17:20:44 +0800 Subject: [PATCH] make vcvars64 and cuda_version can be set in xly pipe (#40870) * make vcvars64 and cuda_version can be set in xly pipe * make third_party_path reused by ci and build pipe;test=windows_ci_inference;test=windows_op;test=windows_ci --- paddle/scripts/paddle_build.bat | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/paddle/scripts/paddle_build.bat b/paddle/scripts/paddle_build.bat index b3500c5724b..06d8153019f 100644 --- a/paddle/scripts/paddle_build.bat +++ b/paddle/scripts/paddle_build.bat @@ -251,6 +251,7 @@ set MSVC_STATIC_CRT=ON set ON_INFER=ON set WITH_TENSORRT=ON set WITH_INFERENCE_API_TEST=ON +set vcvars64_dir="D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" call :cmake || goto cmake_error call :build || goto build_error @@ -314,11 +315,9 @@ echo ======================================== rem set vs language to english to block showIncludes, this need vs has installed English language package. set VSLANG=1033 rem Configure the environment for 64-bit builds. 'DISTUTILS_USE_SDK' indicates that the user has selected the compiler. -echo %task_name%|findstr wincheck_inference >nul && ( - call "D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" -) || ( - call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" -) +if not defined vcvars64_dir set vcvars64_dir="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" +call %vcvars64_dir% + set DISTUTILS_USE_SDK=1 rem Windows 10 Kit bin dir set PATH=C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64;%PATH% @@ -381,18 +380,8 @@ echo echo ${md5_content}^>md5.txt >> cache.sh %cache_dir%\tools\busybox64.exe bash cache.sh set /p md5=< md5.txt -echo %task_name%|findstr build >nul && ( - set THIRD_PARTY_HOME=%cache_dir:\=/%/third_party - set THIRD_PARTY_PATH=!THIRD_PARTY_HOME!/%md5% - echo %task_name% is a whl-build task, will only reuse local third_party cache. - goto :cmake_impl -) || ( - echo %task_name% is a PR-CI-Windows task, will try to reuse bos and local third_party cache both. -) - if "%WITH_GPU%"=="ON" ( - for /F %%# in ('dir /b /d "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\"') do set cuda_version=%%# - set cuda_version=!cuda_version:~-4! + set cuda_version=%CUDA_TOOLKIT_ROOT_DIR:~-4% set sub_dir=cuda!cuda_version:.=! ) else ( set sub_dir=cpu @@ -400,6 +389,13 @@ if "%WITH_GPU%"=="ON" ( set THIRD_PARTY_HOME=%cache_dir:\=/%/third_party/%sub_dir% set THIRD_PARTY_PATH=%THIRD_PARTY_HOME%/%md5% +echo %task_name%|findstr build >nul && ( + echo %task_name% is a whl-build task, will only reuse local third_party cache. + goto :cmake_impl +) || ( + echo %task_name% is a PR-CI-Windows task, will try to reuse bos and local third_party cache both. +) + if not exist %THIRD_PARTY_PATH% ( echo There is no usable third_party cache in %THIRD_PARTY_PATH%, will download from bos. pip install wget -- GitLab