|
| 1 | +@echo on |
| 2 | +REM Description: Install Intel Support Packages on Windows |
| 3 | +REM BKM reference: https://www.intel.com/content/www/us/en/developer/articles/tool/pytorch-prerequisites-for-intel-gpus.html |
| 4 | + |
| 5 | +set XPU_INSTALL_MODE=%~1 |
| 6 | +if "%XPU_INSTALL_MODE%"=="" goto xpu_bundle_install_start |
| 7 | +if "%XPU_INSTALL_MODE%"=="bundle" goto xpu_bundle_install_start |
| 8 | +if "%XPU_INSTALL_MODE%"=="driver" goto xpu_driver_install_start |
| 9 | +if "%XPU_INSTALL_MODE%"=="all" goto xpu_driver_install_start |
| 10 | + |
| 11 | +:arg_error |
| 12 | + |
| 13 | +echo Illegal XPU installation mode. The value can be "bundle"/"driver"/"all" |
| 14 | +echo If keep the value as space, will use default "bundle" mode |
| 15 | +exit /b 1 |
| 16 | + |
| 17 | +:xpu_driver_install_start |
| 18 | +:: TODO Need more testing for driver installation |
| 19 | +set XPU_DRIVER_LINK=https://downloadmirror.intel.com/830975/gfx_win_101.5972.exe |
| 20 | +curl -o xpu_driver.exe --retry 3 --retry-all-errors -k %XPU_DRIVER_LINK% |
| 21 | +echo "XPU Driver installing..." |
| 22 | +start /wait "Intel XPU Driver Installer" "xpu_driver.exe" |
| 23 | +if errorlevel 1 exit /b 1 |
| 24 | +del xpu_driver.exe |
| 25 | +if "%XPU_INSTALL_MODE%"=="driver" goto xpu_install_end |
| 26 | + |
| 27 | +:xpu_bundle_install_start |
| 28 | + |
| 29 | +set XPU_BUNDLE_PARENT_DIR=C:\Program Files (x86)\Intel\oneAPI |
| 30 | +set XPU_BUNDLE_URL=https://registrationcenter-download.intel.com/akdlm/IRC_NAS/9d1a91e2-e8b8-40a5-8c7f-5db768a6a60c/w_intel-for-pytorch-gpu-dev_p_0.5.3.37_offline.exe |
| 31 | +set XPU_BUNDLE_PRODUCT_NAME=intel.oneapi.win.intel-for-pytorch-gpu-dev.product |
| 32 | +set XPU_BUNDLE_VERSION=0.5.3+31 |
| 33 | +set XPU_BUNDLE_INSTALLED=0 |
| 34 | +set XPU_BUNDLE_UNINSTALL=0 |
| 35 | +set XPU_EXTRA_URL=https://registrationcenter-download.intel.com/akdlm/IRC_NAS/9d1a91e2-e8b8-40a5-8c7f-5db768a6a60c/w_intel-pti-dev_p_0.9.0.37_offline.exe |
| 36 | +set XPU_EXTRA_PRODUCT_NAME=intel.oneapi.win.intel-pti-dev.product |
| 37 | +set XPU_EXTRA_VERSION=0.9.0+36 |
| 38 | +set XPU_EXTRA_INSTALLED=0 |
| 39 | +set XPU_EXTRA_UNINSTALL=0 |
| 40 | + |
| 41 | +if not [%XPU_VERSION%]==[] if [%XPU_VERSION%]==[2025.0] ( |
| 42 | + set XPU_BUNDLE_URL=https://registrationcenter-download.intel.com/akdlm/IRC_NAS/efc86abd-cb77-452e-a03f-a741895b8ece/intel-deep-learning-essentials-2025.0.0.336_offline.exe |
| 43 | + set XPU_BUNDLE_PRODUCT_NAME=intel.oneapi.win.deep-learning-essentials.product |
| 44 | + set XPU_BUNDLE_VERSION=2025.0.0+335 |
| 45 | + set XPU_BUNDLE_INSTALLED=0 |
| 46 | + set XPU_BUNDLE_UNINSTALL=0 |
| 47 | + set XPU_EXTRA_URL=NULL |
| 48 | + set XPU_EXTRA_PRODUCT_NAME=intel.oneapi.win.compiler.product |
| 49 | + set XPU_EXTRA_VERSION=2025.0.1+1226 |
| 50 | + set XPU_EXTRA_INSTALLED=0 |
| 51 | + set XPU_EXTRA_UNINSTALL=0 |
| 52 | +) |
| 53 | + |
| 54 | +:: Check if XPU bundle is target version or already installed |
| 55 | +if exist "%XPU_BUNDLE_PARENT_DIR%\Installer\installer.exe" goto xpu_bundle_ver_check |
| 56 | +goto xpu_bundle_install |
| 57 | + |
| 58 | +:xpu_bundle_ver_check |
| 59 | + |
| 60 | +"%XPU_BUNDLE_PARENT_DIR%\Installer\installer.exe" --list-products > xpu_bundle_installed_ver.log |
| 61 | + |
| 62 | +for /f "tokens=1,2" %%a in (xpu_bundle_installed_ver.log) do ( |
| 63 | + if "%%a"=="%XPU_BUNDLE_PRODUCT_NAME%" ( |
| 64 | + echo %%a Installed Version: %%b |
| 65 | + set XPU_BUNDLE_INSTALLED=1 |
| 66 | + if not "%XPU_BUNDLE_VERSION%"=="%%b" ( |
| 67 | + start /wait "Installer Title" "%XPU_BUNDLE_PARENT_DIR%\Installer\installer.exe" --action=remove --eula=accept --silent --product-id %%a --product-ver %%b --log-dir uninstall_bundle |
| 68 | + set XPU_BUNDLE_UNINSTALL=1 |
| 69 | + ) |
| 70 | + ) |
| 71 | + if "%%a"=="%XPU_EXTRA_PRODUCT_NAME%" ( |
| 72 | + echo %%a Installed Version: %%b |
| 73 | + set XPU_EXTRA_INSTALLED=1 |
| 74 | + if not "%XPU_EXTRA_VERSION%"=="%%b" ( |
| 75 | + start /wait "Installer Title" "%XPU_BUNDLE_PARENT_DIR%\Installer\installer.exe" --action=remove --eula=accept --silent --product-id %%a --product-ver %%b --log-dir uninstall_bundle |
| 76 | + set XPU_EXTRA_UNINSTALL=1 |
| 77 | + ) |
| 78 | + ) |
| 79 | + if not "%%b" == "Version" if not [%%b]==[] if not "%%a"=="%XPU_BUNDLE_PRODUCT_NAME%" if not "%%a"=="%XPU_EXTRA_PRODUCT_NAME%" ( |
| 80 | + echo "Uninstalling...." |
| 81 | + start /wait "Installer Title" "%XPU_BUNDLE_PARENT_DIR%\Installer\installer.exe" --action=remove --eula=accept --silent --product-id %%a --product-ver %%b --log-dir uninstall_bundle |
| 82 | + ) |
| 83 | +) |
| 84 | +if errorlevel 1 exit /b 1 |
| 85 | +if exist xpu_bundle_installed_ver.log del xpu_bundle_installed_ver.log |
| 86 | +if exist uninstall_bundle rmdir /s /q uninstall_bundle |
| 87 | +if "%XPU_BUNDLE_INSTALLED%"=="0" goto xpu_bundle_install |
| 88 | +if "%XPU_BUNDLE_UNINSTALL%"=="1" goto xpu_bundle_install |
| 89 | + |
| 90 | +:xpu_extra_check |
| 91 | + |
| 92 | +if "%XPU_EXTRA_URL%"=="NULL" goto xpu_install_end |
| 93 | +if "%XPU_EXTRA_INSTALLED%"=="0" goto xpu_extra_install |
| 94 | +if "%XPU_EXTRA_UNINSTALL%"=="1" goto xpu_extra_install |
| 95 | +goto xpu_install_end |
| 96 | + |
| 97 | +:xpu_bundle_install |
| 98 | + |
| 99 | +curl -o xpu_bundle.exe --retry 3 --retry-all-errors -k %XPU_BUNDLE_URL% |
| 100 | +echo "XPU Bundle installing..." |
| 101 | +start /wait "Intel Pytorch Bundle Installer" "xpu_bundle.exe" --action=install --eula=accept --silent --log-dir install_bundle |
| 102 | +if errorlevel 1 exit /b 1 |
| 103 | +del xpu_bundle.exe |
| 104 | +goto xpu_extra_check |
| 105 | + |
| 106 | +:xpu_extra_install |
| 107 | + |
| 108 | +curl -o xpu_extra.exe --retry 3 --retry-all-errors -k %XPU_EXTRA_URL% |
| 109 | +echo "Intel XPU EXTRA installing..." |
| 110 | +start /wait "Intel XPU EXTRA Installer" "xpu_extra.exe" --action=install --eula=accept --silent --log-dir install_bundle |
| 111 | +if errorlevel 1 exit /b 1 |
| 112 | +del xpu_extra.exe |
| 113 | + |
| 114 | +:xpu_install_end |
0 commit comments