|
| 1 | +@echo off |
| 2 | +setlocal enabledelayedexpansion |
| 3 | + |
| 4 | +if "%~2"=="" ( |
| 5 | + echo Usage: %~nx0 ^<DPCPPROOT^> ^<MKLROOT^> |
| 6 | + echo DPCPPROOT and MKLROOT are mandatory, should be absolute or relative path to the root directory of DPC++ compiler and oneMKL respectively. |
| 7 | + exit /b 1 |
| 8 | +) |
| 9 | + |
| 10 | +set "DPCPP_ROOT=%~1" |
| 11 | +set "ONEMKL_ROOT=%~2" |
| 12 | + |
| 13 | +rem Check existence of DPCPP and ONEMKL environments |
| 14 | +set "DPCPP_ENV=%DPCPP_ROOT%\env\vars.bat" |
| 15 | +if NOT EXIST "%DPCPP_ENV%" ( |
| 16 | + echo DPC++ compiler environment "%DPCPP_ENV%" doesn't seem to exist. |
| 17 | + exit /b 2 |
| 18 | +) |
| 19 | +call "%DPCPP_ENV%" |
| 20 | + |
| 21 | +set "ONEMKL_ENV=%ONEMKL_ROOT%\env\vars.bat" |
| 22 | +if NOT EXIST "%ONEMKL_ENV%" ( |
| 23 | + echo oneMKL environment "%ONEMKL_ENV%" doesn't seem to exist. |
| 24 | + exit /b 3 |
| 25 | +) |
| 26 | +call "%ONEMKL_ENV%" |
| 27 | + |
| 28 | +python -m pip install wheel |
| 29 | + |
| 30 | +set "CWD=%cd%\repack" |
| 31 | +if EXIST "%CWD%" rmdir "%CWD%" /s /q |
| 32 | +mkdir "%CWD%" |
| 33 | +cd "%CWD%" |
| 34 | + |
| 35 | +for %%a in ("../pytorch/dist/*") do set TORCH_WHL=%%a |
| 36 | +for %%a in ("../intel-extension-for-pytorch/dist/*") do set IPEX_WHL=%%a |
| 37 | + |
| 38 | +wheel unpack "../pytorch/dist/%TORCH_WHL%" |
| 39 | +for /f "tokens=*" %%g in ('dir /a:d /b ^| findstr ^^torch') do set TORCH_REPACK_DIR=%%g |
| 40 | + |
| 41 | +wheel unpack "../intel-extension-for-pytorch/dist/%IPEX_WHL%" |
| 42 | +for /f "tokens=*" %%g in ('dir /a:d /b ^| findstr ^^intel_extension_for_pytorch') do set IPEX_REPACK_DIR=%%g |
| 43 | + |
| 44 | +set "torch_dlls=uv.dll;libiomp5md.dll" |
| 45 | +for %%d in ("%torch_dlls:;=";"%") do ( |
| 46 | + set /a FOUND=0 |
| 47 | + for %%p in ("%PATH:;=";"%") do ( |
| 48 | + if !FOUND! EQU 0 ( |
| 49 | + if EXIST "%%~p\%%~d" ( |
| 50 | + set /a FOUND=1 |
| 51 | + xcopy /s "%%~p\%%~d" "%TORCH_REPACK_DIR%\torch\lib" |
| 52 | + ) |
| 53 | + ) |
| 54 | + ) |
| 55 | + if !FOUND! EQU 0 ( |
| 56 | + echo %%d not found in current environment! |
| 57 | + exit /b 1 |
| 58 | + ) |
| 59 | +) |
| 60 | + |
| 61 | +set "ipex_dlls=sycl7.dll;pi_level_zero.dll;pi_win_proxy_loader.dll;mkl_core.2.dll;mkl_sycl_blas.4.dll;mkl_sycl_lapack.4.dll;mkl_sycl_dft.4.dll;mkl_tbb_thread.2.dll;libmmd.dll;svml_dispmd.dll" |
| 62 | + |
| 63 | +for %%d in ("%ipex_dlls:;=";"%") do ( |
| 64 | + set /a FOUND=0 |
| 65 | + for %%p in ("%PATH:;=";"%") do ( |
| 66 | + if !FOUND! EQU 0 ( |
| 67 | + if EXIST "%%~p\%%~d" ( |
| 68 | + set /a FOUND=1 |
| 69 | + xcopy /s "%%~p\%%~d" "%IPEX_REPACK_DIR%\intel_extension_for_pytorch\bin" |
| 70 | + ) |
| 71 | + ) |
| 72 | + ) |
| 73 | + if !FOUND! EQU 0 ( |
| 74 | + echo %%d not found in current environment! |
| 75 | + exit /b 1 |
| 76 | + ) |
| 77 | +) |
| 78 | + |
| 79 | +wheel pack %TORCH_REPACK_DIR% |
| 80 | +wheel pack %IPEX_REPACK_DIR% |
| 81 | + |
| 82 | +cd .. |
0 commit comments