Skip to content

Commit b5f20d5

Browse files
Fix the windows build script for no local code (#5400)
* git clone ipex code when there is no code locally, update the ipex version, enhance the sanity test * rm created test script after test, install torch,vision,audio to build IPEX only * rm wrong char
1 parent 499a970 commit b5f20d5

File tree

2 files changed

+58
-21
lines changed

2 files changed

+58
-21
lines changed

scripts/compile_bundle.bat

Lines changed: 57 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ SETLOCAL
44
set startup_time=%time%
55
echo startup at: %startup_time%
66

7-
set "VER_IPEX=xpu-main"
7+
set "VER_IPEX=v2.6.10+xpu"
88
set "ENABLE_ONEAPI_INTEGRATION=1"
99

1010
set CMAKE_SHARED_LINKER_FLAGS=/FORCE:MULTIPLE
@@ -30,6 +30,21 @@ if %argC% LSS 2 (
3030
exit /b 1
3131
)
3232

33+
rem Check required packages version
34+
if not exist intel-extension-for-pytorch (
35+
git clone https://github.com/intel/intel-extension-for-pytorch.git intel-extension-for-pytorch
36+
cd intel-extension-for-pytorch
37+
if not "%VER_IPEX%"=="" (
38+
git rm -rf .
39+
git clean -fxd
40+
git reset
41+
git checkout .
42+
git fetch
43+
git checkout %VER_IPEX%
44+
)
45+
cd ..
46+
)
47+
3348
set "DPCPP_ROOT=NA"
3449
set "ONEMKL_ROOT=NA"
3550

@@ -98,6 +113,7 @@ rem )
98113

99114
echo AOT flags:[%AOT%]
100115

116+
101117
if %BUILD_IPEX_ONLY% equ 1 (
102118
echo Building IPEX only
103119
set IPEX_ROOT=intel-extension-for-pytorch
@@ -133,22 +149,6 @@ rem Save current directory path
133149
set "BASEFOLDER=%~dp0"
134150
cd "%BASEFOLDER%"
135151

136-
rem Check required packages version
137-
if not exist intel-extension-for-pytorch (
138-
git clone https://github.com/intel/intel-extension-for-pytorch.git
139-
cd intel-extension-for-pytorch
140-
if not "%VER_IPEX%"=="" (
141-
git rm -rf .
142-
git clean -fxd
143-
git reset
144-
git checkout .
145-
git checkout main
146-
git pull
147-
git checkout %VER_IPEX%
148-
)
149-
cd ..
150-
)
151-
152152
rem Checkout the latest Intel(R) Extension for PyTorch source
153153
echo Update IPEX submodule
154154
cd intel-extension-for-pytorch
@@ -240,8 +240,10 @@ if not exist %OUTPUT_FOLDER% mkdir %OUTPUT_FOLDER%
240240
echo "Clear folder %OUTPUT_FOLDER%"
241241
del /F/Q "%OUTPUT_FOLDER%\*.*"
242242

243-
if %BUILD_IPEX_ONLY% NEQ 1 (
244-
243+
if %BUILD_IPEX_ONLY% EQU 1 (
244+
echo Install packages: torch==%PYTORCH_VER% torchvision==%VISION_VER% torchaudio==%AUDIO_VER%
245+
python -m pip install torch==%PYTORCH_VER% torchvision==%VISION_VER% torchaudio==%AUDIO_VER% --index-url https://download.pytorch.org/whl/xpu
246+
) else (
245247
python -m pip uninstall -y torch torchvision torchaudio intel-extension-for-pytorch
246248

247249
rem remove the packages installed by last buliding & Sanity test. Avoid to impact next building.
@@ -408,12 +410,47 @@ rem show built whl files
408410
echo All created WHL files are saved to folder: %OUTPUT_FOLDER%
409411
dir %OUTPUT_FOLDER%
410412

413+
pip list | findstr torch
414+
415+
set PYTHON_FILE=test_build.bat
416+
echo Create Test Script: %PYTHON_FILE%
417+
418+
call:create_test_py_file %PYTHON_FILE%
411419
echo "Sanity Test"
412-
python -c "import torch; print(f'torch_version: {torch.__version__}'); import torchvision; print(f'torchvision_version: {torchvision.__version__}'); import torchaudio; print(f'torchaudio_version: {torchaudio.__version__}'); import intel_extension_for_pytorch as ipex; print(f'ipex_version: {ipex.__version__}');print(f'ipex_aot: {ipex.__build_aot__}');"
420+
python %PYTHON_FILE%
421+
echo Remove %PYTHON_FILE%
422+
del %PYTHON_FILE%
413423

414424
endlocal
415425
exit /b 0
416426

427+
:create_test_py_file
428+
SETLOCAL ENABLEDELAYEDEXPANSION
429+
set "PYTHON_FILE=%~1"
430+
echo try: >%PYTHON_FILE%
431+
echo ^ ^import torch >>%PYTHON_FILE%
432+
echo ^ ^print(f^'torch version: {torch.__version__}^') >>%PYTHON_FILE%
433+
echo except: >>%PYTHON_FILE%
434+
echo ^ ^print(f^'torch version: Can\^'t import torch^') >>%PYTHON_FILE%
435+
echo try: >>%PYTHON_FILE%
436+
echo ^ ^import torchvision >>%PYTHON_FILE%
437+
echo ^ ^print(f^'torchvision version: {torchvision.__version__}^') >>%PYTHON_FILE%
438+
echo except: >>%PYTHON_FILE%
439+
echo ^ ^print(f^'torchvision version: Can\^'t import torchvision^') >>%PYTHON_FILE%
440+
echo try: >>%PYTHON_FILE%
441+
echo ^ ^import torchaudio >>%PYTHON_FILE%
442+
echo ^ ^print(f^'torchaudio version: {torchaudio.__version__}^') >>%PYTHON_FILE%
443+
echo except: >>%PYTHON_FILE%
444+
echo ^ ^print(f^'torchaudio version: Can\^'t import torchaudio^') >>%PYTHON_FILE%
445+
echo try: >>%PYTHON_FILE%
446+
echo ^ ^import intel_extension_for_pytorch as ipex >>%PYTHON_FILE%
447+
echo ^ ^print(f'ipex version: {ipex.__version__}') >>%PYTHON_FILE%
448+
echo ^ ^print(f'ipex_aot: {ipex.__build_aot__}') >>%PYTHON_FILE%
449+
echo except: >>%PYTHON_FILE%
450+
echo ^ ^print(f^'ipex version: Can\^'t import intel_extension_for_pytorch^') >>%PYTHON_FILE%
451+
ENDLOCAL
452+
goto:eof
453+
417454
:calcu_time
418455
SETLOCAL ENABLEDELAYEDEXPANSION
419456
set "startup_time=%~1"

scripts/compile_bundle.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
set -eo pipefail
77

8-
VER_IPEX=xpu-main
8+
VER_IPEX="v2.6.10+xpu"
99
ENABLE_ONEAPI_INTEGRATION=1
1010

1111
if [[ $# -lt 2 ]]; then

0 commit comments

Comments
 (0)