44set startup_time = %time%
55echo startup at: %startup_time%
66
7- set " VER_IPEX = xpu-main "
7+ set " VER_IPEX = v2.6.10+ xpu"
88set " ENABLE_ONEAPI_INTEGRATION = 1"
99
1010set 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+
3348set " DPCPP_ROOT = NA"
3449set " ONEMKL_ROOT = NA"
3550
98113
99114echo AOT flags:[%AOT% ]
100115
116+
101117if %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
133149set " BASEFOLDER = %~dp0 "
134150cd " %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-
152152rem Checkout the latest Intel(R) Extension for PyTorch source
153153echo Update IPEX submodule
154154cd intel-extension-for-pytorch
@@ -240,8 +240,10 @@ if not exist %OUTPUT_FOLDER% mkdir %OUTPUT_FOLDER%
240240echo " Clear folder %OUTPUT_FOLDER% "
241241del /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
408410echo All created WHL files are saved to folder: %OUTPUT_FOLDER%
409411dir %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%
411419echo " 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
414424endlocal
415425exit /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
418455SETLOCAL ENABLEDELAYEDEXPANSION
419456 set " startup_time = %~1 "
0 commit comments