Skip to content

Commit 6891134

Browse files
authored
[cherry-pick] fix third_party cache bugs (#36048)
cherry-pick #35858#35895
1 parent 2de7a7f commit 6891134

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

paddle/scripts/paddle_build.bat

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ if not defined NIGHTLY_MODE set PRECISION_TEST=OFF
7676
if not defined retry_times set retry_times=3
7777
if not defined PYTHON_ROOT set PYTHON_ROOT=C:\Python37
7878
if not defined BUILD_DIR set BUILD_DIR=build
79+
set task_name=%1
80+
set UPLOAD_TP_FILE=OFF
7981

8082
rem ------initialize the python environment------
8183
set PYTHON_EXECUTABLE=%PYTHON_ROOT%\python.exe
@@ -363,17 +365,24 @@ echo echo ${md5_content}^>md5.txt >> cache.sh
363365
%cache_dir%\tools\busybox64.exe bash cache.sh
364366

365367
set /p md5=< md5.txt
368+
echo %task_name%|findstr build >nul && (
369+
set THIRD_PARTY_HOME=%cache_dir:\=/%/third_party
370+
set THIRD_PARTY_PATH=!THIRD_PARTY_HOME!/%md5%
371+
echo %task_name% is a whl-build task, will only reuse local third_party cache.
372+
goto :cmake_impl
373+
) || (
374+
echo %task_name% is a PR-CI-Windows task, will try to reuse bos and local third_party cache both.
375+
)
376+
366377
if "%WITH_GPU%"=="ON" (
367-
for /F "delims=" %%# in ('nvcc --version^|findstr V1') do set cuda_version=%%#
368-
set cuda_version=!cuda_version:~-7,4!
378+
for /F %%# in ('dir /b /d "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\"') do set cuda_version=%%#
379+
set cuda_version=!cuda_version:~-4!
369380
set sub_dir=cuda!cuda_version:.=!
370381
) else (
371382
set sub_dir=cpu
372383
)
373-
374384
set THIRD_PARTY_HOME=%cache_dir:\=/%/third_party/%sub_dir%
375385
set THIRD_PARTY_PATH=%THIRD_PARTY_HOME%/%md5%
376-
set UPLOAD_TP_FILE=OFF
377386

378387
if not exist %THIRD_PARTY_PATH% (
379388
echo There is no usable third_party cache in %THIRD_PARTY_PATH%, will download from bos.
@@ -397,7 +406,7 @@ if not exist %THIRD_PARTY_PATH% (
397406
if not exist %THIRD_PARTY_PATH% ( set UPLOAD_TP_FILE=ON )
398407
cd %work_dir%\%BUILD_DIR%
399408
) else (
400-
echo Found reusable third_party cache locally, will reuse it.
409+
echo Found reusable third_party cache in %THIRD_PARTY_PATH%, will reuse it.
401410
)
402411

403412
:cmake_impl
@@ -512,8 +521,8 @@ if %ERRORLEVEL% NEQ 0 (
512521
)
513522
)
514523

515-
set BCE_FILE=%cache_dir%\bce-python-sdk-0.8.33\BosClient.py
516-
if %UPLOAD_TP_FILE%==ON (
524+
if "%UPLOAD_TP_FILE%"=="ON" (
525+
set BCE_FILE=%cache_dir%\bce-python-sdk-0.8.33\BosClient.py
517526
echo Uploading third_party: checking bce ...
518527
if not exist %cache_dir%\bce-python-sdk-0.8.33 (
519528
echo There is no bce in this PC, will install bce.

0 commit comments

Comments
 (0)