Skip to content

Commit

Permalink
Revert "Dynamic MKL windows" (#1682)
Browse files Browse the repository at this point in the history
  • Loading branch information
atalman committed Jan 23, 2024
1 parent 122ff0d commit 7d70465
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 26 deletions.
5 changes: 5 additions & 0 deletions conda/pytorch-nightly/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ if "%desired_cuda%" == "12.1" (

set DISTUTILS_USE_SDK=1

curl https://s3.amazonaws.com/ossci-windows/mkl_2020.2.254.7z -k -O
7z x -aoa mkl_2020.2.254.7z -omkl
set CMAKE_INCLUDE_PATH=%SRC_DIR%\mkl\include
set LIB=%SRC_DIR%\mkl\lib;%LIB%

set libuv_ROOT=%PREFIX%\Library
echo libuv_ROOT=%libuv_ROOT%

Expand Down
7 changes: 2 additions & 5 deletions conda/pytorch-nightly/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ requirements:
- mkl-include # [x86_64]
- mkl=2020.2 # [py <= 311 and x86_64 and not win]
- mkl=2023.1 # [py >= 312 and x86_64]
- mkl-devel=2021.4.0 # [x86_64 and win and py<=311]
- mkl-devel=2023.1 # [x86_64 and win and py>=312]
- mkl=2021.4 # [x86_64 and win and py <= 311]
{% endif %}
- typing_extensions
- ninja
Expand All @@ -42,9 +41,7 @@ requirements:
run:
- python
{% if cross_compile_arm64 == 0 %}
- mkl >=2018 # [x86_64 and not win]
- mkl=2021.4 # [x86_64 and win and py <= 311]
- mkl=2023.1 # [x86_64 and win and py >= 312]
- mkl >=2018 # [x86_64]
{% endif %}
- libuv # [win]
- intel-openmp # [win]
Expand Down
6 changes: 5 additions & 1 deletion windows/build_pytorch.bat
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ exit /B 1
:: Install MKL
rmdir /s /q mkl
del mkl_2020.2.254.7z
curl https://s3.amazonaws.com/ossci-windows/mkl_2020.2.254.7z -k -O
7z x -aoa mkl_2020.2.254.7z -omkl
set CMAKE_INCLUDE_PATH=%cd%\mkl\include
set LIB=%cd%\mkl\lib;%LIB%

:: Download MAGMA Files on CUDA builds
set MAGMA_VERSION=2.5.4
Expand Down Expand Up @@ -122,7 +126,7 @@ for %%v in (%DESIRED_PYTHON_PREFIX%) do (
) else (
set "PATH=%CONDA_HOME%\envs\%%v;%CONDA_HOME%\envs\%%v\scripts;%CONDA_HOME%\envs\%%v\Library\bin;%ORIG_PATH%"
)
pip install ninja mkl-include==2021.4.0 mkl-devel==2021.4.0
pip install ninja
@setlocal
:: Set Flags
if not "%CUDA_VERSION%"=="cpu" (
Expand Down
4 changes: 0 additions & 4 deletions windows/internal/copy.bat
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ copy "%CUDA_PATH%\extras\CUPTI\lib64\cupti64_*.dll*" pytorch\torch\lib

copy "C:\Program Files\NVIDIA Corporation\NvToolsExt\bin\x64\nvToolsExt64_1.dll*" pytorch\torch\lib
copy "%CONDA_LIB_PATH%\libiomp*5md.dll" pytorch\torch\lib
IF "%PACKAGE_TYPE%"=="libtorch" (
copy "%CONDA_LIB_PATH%\mkl_intel_thread.1.dll" pytorch\torch\lib
copy "%CONDA_LIB_PATH%\mkl_core.1.dll" pytorch\torch\lib
)
:: Should be set in build_pytorch.bat
copy "%libuv_ROOT%\bin\uv.dll" pytorch\torch\lib

Expand Down
5 changes: 0 additions & 5 deletions windows/internal/copy_cpu.bat
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
copy "%CONDA_LIB_PATH%\libiomp*5md.dll" pytorch\torch\lib
:: Should be set in build_pytorch.bat
copy "%libuv_ROOT%\bin\uv.dll" pytorch\torch\lib

IF "%PACKAGE_TYPE%"=="libtorch" (
copy "%CONDA_LIB_PATH%\mkl_intel_thread.1.dll" pytorch\torch\lib
copy "%CONDA_LIB_PATH%\mkl_core.1.dll" pytorch\torch\lib
)
19 changes: 8 additions & 11 deletions windows/internal/smoke_test.bat
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ if errorlevel 1 exit /b 1

set "PATH=%CD%\Python%PYTHON_VERSION%\Scripts;%CD%\Python;%PATH%"

pip install -q numpy protobuf
pip install -q numpy protobuf "mkl>=2019"
if errorlevel 1 exit /b 1

for /F "delims=" %%i in ('where /R "%PYTORCH_FINAL_PACKAGE_DIR:/=\%" *.whl') do pip install "%%i"
Expand Down Expand Up @@ -87,18 +87,14 @@ set "PATH=%CONDA_HOME%;%CONDA_HOME%\scripts;%CONDA_HOME%\Library\bin;%PATH%"

conda create -qyn testenv python=%DESIRED_PYTHON%
if errorlevel 1 exit /b 1
call conda install -yq conda-build
if errorlevel 1 exit /b 1

call %CONDA_HOME%\condabin\activate.bat testenv
if errorlevel 1 exit /b 1
set "NO_ARCH_PATH=%PYTORCH_FINAL_PACKAGE_DIR:/=\%\noarch"
mkdir %NO_ARCH_PATH%
for /F "delims=" %%i in ('where /R "%PYTORCH_FINAL_PACKAGE_DIR:/=\%" *') do xcopy "%%i" %NO_ARCH_PATH% /Y
if ERRORLEVEL 1 exit /b 1
call conda index %PYTORCH_FINAL_PACKAGE_DIR%
if errorlevel 1 exit /b 1
call conda install -yq -c "file:///%PYTORCH_FINAL_PACKAGE_DIR%" pytorch==%PYTORCH_BUILD_VERSION% -c pytorch -c numba/label/dev -c nvidia

:: do conda install to make sure all the dependencies are installed
:: Install numpy see: https://github.com/pytorch/pytorch/issues/107228
:: todo: Remove numpy install once the issue above is resolved
call conda install -yq numpy pytorch %CONDA_EXTRA_ARGS%
if ERRORLEVEL 1 exit /b 1

set /a CUDA_VER=%CUDA_VERSION%
Expand All @@ -107,7 +103,8 @@ set CUDA_VER_MINOR=%CUDA_VERSION:~-1,1%
set CUDA_VERSION_STR=%CUDA_VER_MAJOR%.%CUDA_VER_MINOR%

:: Install package we just build

for /F "delims=" %%i in ('where /R "%PYTORCH_FINAL_PACKAGE_DIR:/=\%" *.tar.bz2') do call conda install -yq "%%i" --offline
if ERRORLEVEL 1 exit /b 1

:smoke_test
python -c "import torch"
Expand Down

0 comments on commit 7d70465

Please sign in to comment.